diff --git a/flang/lib/Optimizer/CodeGen/Target.cpp b/flang/lib/Optimizer/CodeGen/Target.cpp index e2f8fb9d239a1..374308fa58947 100644 --- a/flang/lib/Optimizer/CodeGen/Target.cpp +++ b/flang/lib/Optimizer/CodeGen/Target.cpp @@ -1020,6 +1020,37 @@ struct TargetAArch64 : public GenericTarget { }; } // namespace +//===----------------------------------------------------------------------===// +// PPC (AIX 32 bit) target specifics. +//===----------------------------------------------------------------------===// +namespace { +struct TargetPPC : public GenericTarget { + using GenericTarget::GenericTarget; + + static constexpr int defaultWidth = 32; + + CodeGenSpecifics::Marshalling + complexArgumentType(mlir::Location, mlir::Type eleTy) const override { + CodeGenSpecifics::Marshalling marshal; + // two distinct element type arguments (re, im) + marshal.emplace_back(eleTy, AT{}); + marshal.emplace_back(eleTy, AT{}); + return marshal; + } + + CodeGenSpecifics::Marshalling + complexReturnType(mlir::Location, mlir::Type eleTy) const override { + CodeGenSpecifics::Marshalling marshal; + // Use a type that will be translated into LLVM as: + // { t, t } struct of 2 element type + marshal.emplace_back( + mlir::TupleType::get(eleTy.getContext(), mlir::TypeRange{eleTy, eleTy}), + AT{}); + return marshal; + } +}; +} // namespace + //===----------------------------------------------------------------------===// // PPC64 (AIX 64 bit) target specifics. //===----------------------------------------------------------------------===// @@ -1847,6 +1878,9 @@ fir::CodeGenSpecifics::get(mlir::MLIRContext *ctx, llvm::Triple &&trp, case llvm::Triple::ArchType::aarch64: return std::make_unique( ctx, std::move(trp), std::move(kindMap), targetCPU, targetFeatures, dl); + case llvm::Triple::ArchType::ppc: + return std::make_unique(ctx, std::move(trp), std::move(kindMap), + targetCPU, targetFeatures, dl); case llvm::Triple::ArchType::ppc64: return std::make_unique( ctx, std::move(trp), std::move(kindMap), targetCPU, targetFeatures, dl); diff --git a/flang/test/Fir/comdat.fir b/flang/test/Fir/comdat.fir index 2f5da505e4903..ea777c389ed34 100644 --- a/flang/test/Fir/comdat.fir +++ b/flang/test/Fir/comdat.fir @@ -3,6 +3,7 @@ // RUN: fir-opt %s --fir-to-llvm-ir="target=x86_64-pc-windows-msvc" | FileCheck %s --check-prefixes="CHECK-COMDAT" // RUN: fir-opt %s --fir-to-llvm-ir="target=aarch64-apple-darwin" | FileCheck %s --check-prefixes="CHECK-NOCOMDAT" // RUN: fir-opt %s --fir-to-llvm-ir="target=powerpc64-ibm-aix" | FileCheck %s --check-prefixes="CHECK-NOCOMDAT" +// RUN: fir-opt %s --fir-to-llvm-ir="target=powerpc-ibm-aix" | FileCheck %s --check-prefixes="CHECK-NOCOMDAT" // CHECK-COMDAT: llvm.func linkonce @fun_linkonce(%arg0: i32) -> i32 comdat(@__llvm_comdat::@fun_linkonce) // CHECK-NOCOMDAT: llvm.func linkonce @fun_linkonce(%arg0: i32) -> i32 { @@ -38,4 +39,4 @@ fir.global linkonce @global_linkonce constant : i32 { fir.global linkonce_odr @global_linkonce_odr constant : i32 { %0 = arith.constant 0 : i32 fir.has_value %0 : i32 -} \ No newline at end of file +} diff --git a/flang/test/Fir/target-rewrite-complex.fir b/flang/test/Fir/target-rewrite-complex.fir index 405b14031f0c5..c8cf867713632 100644 --- a/flang/test/Fir/target-rewrite-complex.fir +++ b/flang/test/Fir/target-rewrite-complex.fir @@ -8,6 +8,7 @@ // RUN: fir-opt --target-rewrite="target=sparcv9-sun-solaris2.11" %s | FileCheck %s --check-prefix=SPARCV9 // RUN: fir-opt --target-rewrite="target=riscv64-unknown-linux-gnu" %s | FileCheck %s --check-prefix=RISCV64 // RUN: fir-opt --target-rewrite="target=powerpc64-ibm-aix7.2.0.0" %s | FileCheck %s --check-prefix=PPC64 +// RUN: fir-opt --target-rewrite="target=powerpc-ibm-aix7.2.0.0" %s | FileCheck %s --check-prefix=PPC // RUN: fir-opt --target-rewrite="target=loongarch64-unknown-linux-gnu" %s | FileCheck %s --check-prefix=LOONGARCH64 // Test that we rewrite the signature and body of a function that returns a @@ -21,6 +22,7 @@ // SPARCV9-LABEL: func @returncomplex4() -> tuple // RISCV64-LABEL: func @returncomplex4() -> tuple // PPC64-LABEL: func @returncomplex4() -> tuple +// PPC-LABEL: func @returncomplex4() -> tuple // LOONGARCH64-LABEL: func @returncomplex4() -> tuple func.func @returncomplex4() -> complex { // I32: fir.insert_value @@ -41,6 +43,8 @@ func.func @returncomplex4() -> complex { // RISCV64: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value // PPC64: fir.insert_value // PPC64: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value + // PPC: fir.insert_value + // PPC: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value // LOONGARCH64: fir.insert_value // LOONGARCH64: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value %1 = fir.undefined complex @@ -94,6 +98,11 @@ func.func @returncomplex4() -> complex { // PPC64: fir.store [[VAL]] to [[ADDRC]] : !fir.ref> // PPC64: [[RES:%[0-9A-Za-z]+]] = fir.load [[ADDRT]] : !fir.ref> // PPC64: return [[RES]] : tuple + // PPC: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple + // PPC: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> + // PPC: fir.store [[VAL]] to [[ADDRC]] : !fir.ref> + // PPC: [[RES:%[0-9A-Za-z]+]] = fir.load [[ADDRT]] : !fir.ref> + // PPC: return [[RES]] : tuple // LOONGARCH64: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple // LOONGARCH64: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> return %6 : complex @@ -113,6 +122,7 @@ func.func @returncomplex4() -> complex { // SPARCV9-LABEL: func @returncomplex8() -> tuple // RISCV64-LABEL: func @returncomplex8() -> tuple // PPC64-LABEL: func @returncomplex8() -> tuple +// PPC-LABEL: func @returncomplex8() -> tuple // LOONGARCH64-LABEL: func @returncomplex8() -> tuple func.func @returncomplex8() -> complex { // I32: fir.insert_value @@ -133,6 +143,8 @@ func.func @returncomplex8() -> complex { // RISCV64: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value {{.*}} // PPC64: fir.insert_value // PPC64: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value {{.*}} + // PPC: fir.insert_value + // PPC: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value {{.*}} // LOONGARCH64: fir.insert_value // LOONGARCH64: [[VAL:%[0-9A-Za-z]+]] = fir.insert_value {{.*}} %1 = fir.undefined complex @@ -182,6 +194,11 @@ func.func @returncomplex8() -> complex { // PPC64: fir.store [[VAL]] to [[ADDRC]] : !fir.ref> // PPC64: [[RES:%[0-9A-Za-z]+]] = fir.load [[ADDRT]] : !fir.ref> // PPC64: return [[RES]] : tuple + // PPC: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple + // PPC: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> + // PPC: fir.store [[VAL]] to [[ADDRC]] : !fir.ref> + // PPC: [[RES:%[0-9A-Za-z]+]] = fir.load [[ADDRT]] : !fir.ref> + // PPC: return [[RES]] : tuple // LOONGARCH64: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple // LOONGARCH64: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> // LOONGARCH64: fir.store [[VAL]] to [[ADDRC]] : !fir.ref> @@ -200,6 +217,7 @@ func.func @returncomplex8() -> complex { // SPARCV9-LABEL: func private @paramcomplex4(f32, f32) // RISCV64-LABEL: func private @paramcomplex4(f32, f32) // PPC64-LABEL: func private @paramcomplex4(f32, f32) +// PPC-LABEL: func private @paramcomplex4(f32, f32) // LOONGARCH64-LABEL: func private @paramcomplex4(f32, f32) func.func private @paramcomplex4(complex) -> () @@ -213,6 +231,7 @@ func.func private @paramcomplex4(complex) -> () // SPARCV9-LABEL: func @callcomplex4 // RISCV64-LABEL: func @callcomplex4 // PPC64-LABEL: func @callcomplex4 +// PPC-LABEL: func @callcomplex4 // LOONGARCH64-LABEL: func @callcomplex4 func.func @callcomplex4(%arg0 : !fir.class>) { @@ -225,6 +244,7 @@ func.func @callcomplex4(%arg0 : !fir.class tuple // RISCV64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex4() : () -> tuple // PPC64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex4() : () -> tuple + // PPC: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex4() : () -> tuple // LOONGARCH64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex4() : () -> tuple %1 = fir.call @returncomplex4() : () -> complex @@ -308,6 +328,14 @@ func.func @callcomplex4(%arg0 : !fir.class) -> f32 // PPC64: fir.call @paramcomplex4([[A]], [[B]]) : (f32, f32) -> () + // PPC: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple + // PPC: fir.store [[RES]] to [[ADDRT]] : !fir.ref> + // PPC: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> + // PPC: [[V:%[0-9A-Za-z]+]] = fir.load [[ADDRC]] : !fir.ref> + // PPC: [[A:%[0-9A-Za-z]+]] = fir.extract_value [[V]], [0 : i32] : (complex) -> f32 + // PPC: [[B:%[0-9A-Za-z]+]] = fir.extract_value [[V]], [1 : i32] : (complex) -> f32 + // PPC: fir.call @paramcomplex4([[A]], [[B]]) : (f32, f32) -> () + // LOONGARCH64: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple // LOONGARCH64: fir.store [[RES]] to [[ADDRT]] : !fir.ref> // LOONGARCH64: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> @@ -325,6 +353,7 @@ func.func @callcomplex4(%arg0 : !fir.class>) (%{{.*}} : !fir.class>) -> tuple {pass_arg_pos = 0 : i32} // SPARCV9: [[RES:%[0-9A-Za-z]+]] = fir.dispatch "ret_complex"(%{{.*}} : !fir.class>) (%{{.*}} : !fir.class>) -> tuple {pass_arg_pos = 0 : i32} // PPC64: [[RES:%[0-9A-Za-z]+]] = fir.dispatch "ret_complex"(%{{.*}} : !fir.class>) (%{{.*}} : !fir.class>) -> tuple {pass_arg_pos = 0 : i32} + // PPC: [[RES:%[0-9A-Za-z]+]] = fir.dispatch "ret_complex"(%{{.*}} : !fir.class>) (%{{.*}} : !fir.class>) -> tuple {pass_arg_pos = 0 : i32} %2 = fir.dispatch "ret_complex"(%arg0 : !fir.class>) (%arg0 : !fir.class>) -> complex {pass_arg_pos = 0 : i32} // I32: [[ADDRI64:%[0-9A-Za-z]+]] = fir.alloca i64 @@ -400,6 +429,14 @@ func.func @callcomplex4(%arg0 : !fir.class>) (%{{.*}}, [[A]], [[B]] : !fir.class>, f32, f32) {pass_arg_pos = 0 : i32} fir.dispatch "with_complex"(%arg0 : !fir.class>) (%arg0, %2 : !fir.class>, complex) {pass_arg_pos = 0 : i32} + // PPC: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple + // PPC: fir.store [[RES]] to [[ADDRT]] : !fir.ref> + // PPC: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> + // PPC: [[V:%[0-9A-Za-z]+]] = fir.load [[ADDRC]] : !fir.ref> + // PPC: [[A:%[0-9A-Za-z]+]] = fir.extract_value [[V]], [0 : i32] : (complex) -> f32 + // PPC: [[B:%[0-9A-Za-z]+]] = fir.extract_value [[V]], [1 : i32] : (complex) -> f32 + // PPC: fir.dispatch "with_complex"(%{{.*}} : !fir.class>) (%{{.*}}, [[A]], [[B]] : !fir.class>, f32, f32) {pass_arg_pos = 0 : i32} + fir.dispatch "with_complex"(%arg0 : !fir.class>) (%arg0, %2 : !fir.class>, complex) {pass_arg_pos = 0 : i32} // I32: fir.dispatch "with_complex2"(%{{.*}} : !fir.class>) (%{{.*}}, %{{.*}} : !fir.ref>, !fir.class>) {pass_arg_pos = 1 : i32} // I32_MINGW: fir.dispatch "with_complex2"(%{{.*}} : !fir.class>) (%{{.*}}, %{{.*}} : !fir.ref>, !fir.class>) {pass_arg_pos = 1 : i32} @@ -410,6 +447,7 @@ func.func @callcomplex4(%arg0 : !fir.class>) (%{{.*}}, %{{.*}}, %{{.*}} : f32, f32, !fir.class>) {pass_arg_pos = 2 : i32} // RISCV64: fir.dispatch "with_complex2"(%{{.*}} : !fir.class>) (%{{.*}}, %{{.*}}, %{{.*}} : f32, f32, !fir.class>) {pass_arg_pos = 2 : i32} // PPC64: fir.dispatch "with_complex2"(%{{.*}} : !fir.class>) (%{{.*}}, %{{.*}}, %{{.*}} : f32, f32, !fir.class>) {pass_arg_pos = 2 : i32} + // PPC: fir.dispatch "with_complex2"(%{{.*}} : !fir.class>) (%{{.*}}, %{{.*}}, %{{.*}} : f32, f32, !fir.class>) {pass_arg_pos = 2 : i32} // LOONGARCH64: fir.dispatch "with_complex2"(%{{.*}} : !fir.class>) (%{{.*}}, %{{.*}}, %{{.*}} : f32, f32, !fir.class>) {pass_arg_pos = 2 : i32} fir.dispatch "with_complex2"(%arg0 : !fir.class>) (%2, %arg0 : complex, !fir.class>) {pass_arg_pos = 1 : i32} @@ -426,6 +464,7 @@ func.func @callcomplex4(%arg0 : !fir.class) -> () @@ -439,6 +478,7 @@ func.func private @paramcomplex8(complex) -> () // SPARCV9-LABEL: func @callcomplex8() // RISCV64-LABEL: func @callcomplex8() // PPC64-LABEL: func @callcomplex8() +// PPC-LABEL: func @callcomplex8() // LOONGARCH64-LABEL: func @callcomplex8() func.func @callcomplex8() { // I32: [[RES:%[0-9A-Za-z]+]] = fir.alloca tuple @@ -453,6 +493,7 @@ func.func @callcomplex8() { // SPARCV9: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex8() : () -> tuple // RISCV64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex8() : () -> tuple // PPC64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex8() : () -> tuple + // PPC: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex8() : () -> tuple // LOONGARCH64: [[RES:%[0-9A-Za-z]+]] = fir.call @returncomplex8() : () -> tuple %1 = fir.call @returncomplex8() : () -> complex @@ -527,6 +568,14 @@ func.func @callcomplex8() { // PPC64: [[B:%[0-9A-Za-z]+]] = fir.extract_value [[V]], [1 : i32] : (complex) -> f64 // PPC64: fir.call @paramcomplex8([[A]], [[B]]) : (f64, f64) -> () + // PPC: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple + // PPC: fir.store [[RES]] to [[ADDRT]] : !fir.ref> + // PPC: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> + // PPC: [[V:%[0-9A-Za-z]+]] = fir.load [[ADDRC]] : !fir.ref> + // PPC: [[A:%[0-9A-Za-z]+]] = fir.extract_value [[V]], [0 : i32] : (complex) -> f64 + // PPC: [[B:%[0-9A-Za-z]+]] = fir.extract_value [[V]], [1 : i32] : (complex) -> f64 + // PPC: fir.call @paramcomplex8([[A]], [[B]]) : (f64, f64) -> () + // LOONGARCH64: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple // LOONGARCH64: fir.store [[RES]] to [[ADDRT]] : !fir.ref> // LOONGARCH64: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> @@ -549,6 +598,7 @@ func.func @callcomplex8() { // SPARCV9-LABEL: func private @calleemultipleparamscomplex4(f32, f32, f32, f32, f32, f32) // RISCV64-LABEL: func private @calleemultipleparamscomplex4(f32, f32, f32, f32, f32, f32) // PPC64-LABEL: func private @calleemultipleparamscomplex4(f32, f32, f32, f32, f32, f32) +// PPC-LABEL: func private @calleemultipleparamscomplex4(f32, f32, f32, f32, f32, f32) // LOONGARCH64-LABEL: func private @calleemultipleparamscomplex4(f32, f32, f32, f32, f32, f32) func.func private @calleemultipleparamscomplex4(complex, complex, complex) -> () @@ -570,6 +620,8 @@ func.func private @calleemultipleparamscomplex4(complex, complex, comp // RISCV64-SAME: ([[A1:%[0-9A-Za-z]+]]: f32, [[B1:%[0-9A-Za-z]+]]: f32, [[A2:%[0-9A-Za-z]+]]: f32, [[B2:%[0-9A-Za-z]+]]: f32, [[A3:%[0-9A-Za-z]+]]: f32, [[B3:%[0-9A-Za-z]+]]: f32) // PPC64-LABEL: func @multipleparamscomplex4 // PPC64-SAME: ([[A1:%[0-9A-Za-z]+]]: f32, [[B1:%[0-9A-Za-z]+]]: f32, [[A2:%[0-9A-Za-z]+]]: f32, [[B2:%[0-9A-Za-z]+]]: f32, [[A3:%[0-9A-Za-z]+]]: f32, [[B3:%[0-9A-Za-z]+]]: f32) +// PPC-LABEL: func @multipleparamscomplex4 +// PPC-SAME: ([[A1:%[0-9A-Za-z]+]]: f32, [[B1:%[0-9A-Za-z]+]]: f32, [[A2:%[0-9A-Za-z]+]]: f32, [[B2:%[0-9A-Za-z]+]]: f32, [[A3:%[0-9A-Za-z]+]]: f32, [[B3:%[0-9A-Za-z]+]]: f32) // LOONGARCH64-LABEL: func @multipleparamscomplex4 // LOONGARCH64-SAME: ([[A1:%[0-9A-Za-z]+]]: f32, [[B1:%[0-9A-Za-z]+]]: f32, [[A2:%[0-9A-Za-z]+]]: f32, [[B2:%[0-9A-Za-z]+]]: f32, [[A3:%[0-9A-Za-z]+]]: f32, [[B3:%[0-9A-Za-z]+]]: f32) func.func @multipleparamscomplex4(%z1 : complex, %z2 : complex, %z3 : complex) { @@ -751,6 +803,7 @@ func.func @multipleparamscomplex4(%z1 : complex, %z2 : complex, %z3 : // RISCV64-DAG: [[B3_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z3]], [1 : i32] : (complex) -> f32 // RISCV64: fir.call @calleemultipleparamscomplex4([[A1_EXTR]], [[B1_EXTR]], [[A2_EXTR]], [[B2_EXTR]], [[A3_EXTR]], [[B3_EXTR]]) : (f32, f32, f32, f32, f32, f32) -> () + // PPC64-DAG: [[Z3_EMPTY:%[0-9A-Za-z]+]] = fir.undefined complex // PPC64-DAG: [[Z3_PARTIAL:%[0-9A-Za-z]+]] = fir.insert_value [[Z3_EMPTY]], [[A3]], [0 : i32] : (complex, f32) -> complex // PPC64-DAG: [[Z3:%[0-9A-Za-z]+]] = fir.insert_value [[Z3_PARTIAL]], [[B3]], [1 : i32] : (complex, f32) -> complex @@ -769,6 +822,26 @@ func.func @multipleparamscomplex4(%z1 : complex, %z2 : complex, %z3 : // PPC64-DAG: [[B3_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z3]], [1 : i32] : (complex) -> f32 // PPC64: fir.call @calleemultipleparamscomplex4([[A1_EXTR]], [[B1_EXTR]], [[A2_EXTR]], [[B2_EXTR]], [[A3_EXTR]], [[B3_EXTR]]) : (f32, f32, f32, f32, f32, f32) -> () + + // PPC-DAG: [[Z3_EMPTY:%[0-9A-Za-z]+]] = fir.undefined complex + // PPC-DAG: [[Z3_PARTIAL:%[0-9A-Za-z]+]] = fir.insert_value [[Z3_EMPTY]], [[A3]], [0 : i32] : (complex, f32) -> complex + // PPC-DAG: [[Z3:%[0-9A-Za-z]+]] = fir.insert_value [[Z3_PARTIAL]], [[B3]], [1 : i32] : (complex, f32) -> complex + // PPC-DAG: [[Z2_EMPTY:%[0-9A-Za-z]+]] = fir.undefined complex + // PPC-DAG: [[Z2_PARTIAL:%[0-9A-Za-z]+]] = fir.insert_value [[Z2_EMPTY]], [[A2]], [0 : i32] : (complex, f32) -> complex + // PPC-DAG: [[Z2:%[0-9A-Za-z]+]] = fir.insert_value [[Z2_PARTIAL]], [[B2]], [1 : i32] : (complex, f32) -> complex + // PPC-DAG: [[Z1_EMPTY:%[0-9A-Za-z]+]] = fir.undefined complex + // PPC-DAG: [[Z1_PARTIAL:%[0-9A-Za-z]+]] = fir.insert_value [[Z1_EMPTY]], [[A1]], [0 : i32] : (complex, f32) -> complex + // PPC-DAG: [[Z1:%[0-9A-Za-z]+]] = fir.insert_value [[Z1_PARTIAL]], [[B1]], [1 : i32] : (complex, f32) -> complex + + // PPC-DAG: [[A1_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z1]], [0 : i32] : (complex) -> f32 + // PPC-DAG: [[B1_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z1]], [1 : i32] : (complex) -> f32 + // PPC-DAG: [[A2_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z2]], [0 : i32] : (complex) -> f32 + // PPC-DAG: [[B2_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z2]], [1 : i32] : (complex) -> f32 + // PPC-DAG: [[A3_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z3]], [0 : i32] : (complex) -> f32 + // PPC-DAG: [[B3_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z3]], [1 : i32] : (complex) -> f32 + + // PPC: fir.call @calleemultipleparamscomplex4([[A1_EXTR]], [[B1_EXTR]], [[A2_EXTR]], [[B2_EXTR]], [[A3_EXTR]], [[B3_EXTR]]) : (f32, f32, f32, f32, f32, f32) -> () + // LOONGARCH64-DAG: [[Z3_EMPTY:%[0-9A-Za-z]+]] = fir.undefined complex // LOONGARCH64-DAG: [[Z3_PARTIAL:%[0-9A-Za-z]+]] = fir.insert_value [[Z3_EMPTY]], [[A3]], [0 : i32] : (complex, f32) -> complex // LOONGARCH64-DAG: [[Z3:%[0-9A-Za-z]+]] = fir.insert_value [[Z3_PARTIAL]], [[B3]], [1 : i32] : (complex, f32) -> complex @@ -821,6 +894,9 @@ func.func @multipleparamscomplex4(%z1 : complex, %z2 : complex, %z3 : // PPC64-LABEL: func private @mlircomplexf32 // PPC64-SAME: ([[A1:%[0-9A-Za-z]+]]: f32, [[B1:%[0-9A-Za-z]+]]: f32, [[A2:%[0-9A-Za-z]+]]: f32, [[B2:%[0-9A-Za-z]+]]: f32) // PPC64-SAME: -> tuple +// PPC-LABEL: func private @mlircomplexf32 +// PPC-SAME: ([[A1:%[0-9A-Za-z]+]]: f32, [[B1:%[0-9A-Za-z]+]]: f32, [[A2:%[0-9A-Za-z]+]]: f32, [[B2:%[0-9A-Za-z]+]]: f32) +// PPC-SAME: -> tuple // LOONGARCH64-LABEL: func private @mlircomplexf32 // LOONGARCH64-SAME: ([[A1:%[0-9A-Za-z]+]]: f32, [[B1:%[0-9A-Za-z]+]]: f32, [[A2:%[0-9A-Za-z]+]]: f32, [[B2:%[0-9A-Za-z]+]]: f32) // LOONGARCH64-SAME: -> tuple @@ -970,6 +1046,20 @@ func.func private @mlircomplexf32(%z1: complex, %z2: complex) -> compl // PPC64: [[VAL:%[0-9A-Za-z]+]] = fir.call @mlircomplexf32([[A1_EXTR]], [[B1_EXTR]], [[A2_EXTR]], [[B2_EXTR]]) : (f32, f32, f32, f32) -> tuple + // PPC-DAG: [[Z2_EMPTY:%[0-9A-Za-z]+]] = fir.undefined complex + // PPC-DAG: [[Z2_PARTIAL:%[0-9A-Za-z]+]] = fir.insert_value [[Z2_EMPTY]], [[A2]], [0 : i32] : (complex, f32) -> complex + // PPC-DAG: [[Z2:%[0-9A-Za-z]+]] = fir.insert_value [[Z2_PARTIAL]], [[B2]], [1 : i32] : (complex, f32) -> complex + // PPC-DAG: [[Z1_EMPTY:%[0-9A-Za-z]+]] = fir.undefined complex + // PPC-DAG: [[Z1_PARTIAL:%[0-9A-Za-z]+]] = fir.insert_value [[Z1_EMPTY]], [[A1]], [0 : i32] : (complex, f32) -> complex + // PPC-DAG: [[Z1:%[0-9A-Za-z]+]] = fir.insert_value [[Z1_PARTIAL]], [[B1]], [1 : i32] : (complex, f32) -> complex + + // PPC-DAG: [[A1_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z1]], [0 : i32] : (complex) -> f32 + // PPC-DAG: [[B1_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z1]], [1 : i32] : (complex) -> f32 + // PPC-DAG: [[A2_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z2]], [0 : i32] : (complex) -> f32 + // PPC-DAG: [[B2_EXTR:%[0-9A-Za-z]+]] = fir.extract_value [[Z2]], [1 : i32] : (complex) -> f32 + + // PPC: [[VAL:%[0-9A-Za-z]+]] = fir.call @mlircomplexf32([[A1_EXTR]], [[B1_EXTR]], [[A2_EXTR]], [[B2_EXTR]]) : (f32, f32, f32, f32) -> tuple + // LOONGARCH64-DAG: [[Z2_EMPTY:%[0-9A-Za-z]+]] = fir.undefined complex // LOONGARCH64-DAG: [[Z2_PARTIAL:%[0-9A-Za-z]+]] = fir.insert_value [[Z2_EMPTY]], [[A2]], [0 : i32] : (complex, f32) -> complex // LOONGARCH64-DAG: [[Z2:%[0-9A-Za-z]+]] = fir.insert_value [[Z2_PARTIAL]], [[B2]], [1 : i32] : (complex, f32) -> complex @@ -1075,6 +1165,16 @@ func.func private @mlircomplexf32(%z1: complex, %z2: complex) -> compl // PPC64: [[RES:%[0-9A-Za-z]+]] = fir.load [[ADDRT_2]] : !fir.ref> // PPC64: return [[RES]] : tuple + // PPC: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple + // PPC: fir.store [[VAL]] to [[ADDRT]] : !fir.ref> + // PPC: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> + // PPC: [[V:%[0-9A-Za-z]+]] = fir.load [[ADDRC]] : !fir.ref> + // PPC: [[ADDRT_2:%[0-9A-Za-z]+]] = fir.alloca tuple + // PPC: [[ADDRC_2:%[0-9A-Za-z]+]] = fir.convert [[ADDRT_2]] : (!fir.ref>) -> !fir.ref> + // PPC: fir.store [[V]] to [[ADDRC_2]] : !fir.ref> + // PPC: [[RES:%[0-9A-Za-z]+]] = fir.load [[ADDRT_2]] : !fir.ref> + // PPC: return [[RES]] : tuple + // LOONGARCH64: [[ADDRT:%[0-9A-Za-z]+]] = fir.alloca tuple // LOONGARCH64: fir.store [[VAL]] to [[ADDRT]] : !fir.ref> // LOONGARCH64: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRT]] : (!fir.ref>) -> !fir.ref> @@ -1097,6 +1197,7 @@ func.func private @mlircomplexf32(%z1: complex, %z2: complex) -> compl // SPARCV9-LABEL: func @addrof() // RISCV64-LABEL: func @addrof() // PPC64-LABEL: func @addrof() +// PPC-LABEL: func @addrof() // LOONGARCH64-LABEL: func @addrof() func.func @addrof() { // I32: {{%.*}} = fir.address_of(@returncomplex4) : () -> i64 @@ -1107,6 +1208,7 @@ func.func @addrof() { // PPC64le: {{%.*}} = fir.address_of(@returncomplex4) : () -> tuple // RISCV64: {{%.*}} = fir.address_of(@returncomplex4) : () -> tuple // PPC64: {{%.*}} = fir.address_of(@returncomplex4) : () -> tuple + // PPC: {{%.*}} = fir.address_of(@returncomplex4) : () -> tuple // LOONGARCH64: {{%.*}} = fir.address_of(@returncomplex4) : () -> tuple %r = fir.address_of(@returncomplex4) : () -> complex @@ -1119,6 +1221,7 @@ func.func @addrof() { // SPARCV9: {{%.*}} = fir.address_of(@paramcomplex4) : (f32, f32) -> () // RISCV64: {{%.*}} = fir.address_of(@paramcomplex4) : (f32, f32) -> () // PPC64: {{%.*}} = fir.address_of(@paramcomplex4) : (f32, f32) -> () + // PPC: {{%.*}} = fir.address_of(@paramcomplex4) : (f32, f32) -> () // LOONGARCH64: {{%.*}} = fir.address_of(@paramcomplex4) : (f32, f32) -> () %p = fir.address_of(@paramcomplex4) : (complex) -> () return