@@ -1020,6 +1020,37 @@ struct TargetAArch64 : public GenericTarget<TargetAArch64> {
10201020};
10211021} // namespace
10221022
1023+ // ===----------------------------------------------------------------------===//
1024+ // PPC (AIX 32 bit) target specifics.
1025+ // ===----------------------------------------------------------------------===//
1026+ namespace {
1027+ struct TargetPPC : public GenericTarget <TargetPPC> {
1028+ using GenericTarget::GenericTarget;
1029+
1030+ static constexpr int defaultWidth = 32 ;
1031+
1032+ CodeGenSpecifics::Marshalling
1033+ complexArgumentType (mlir::Location, mlir::Type eleTy) const override {
1034+ CodeGenSpecifics::Marshalling marshal;
1035+ // two distinct element type arguments (re, im)
1036+ marshal.emplace_back (eleTy, AT{});
1037+ marshal.emplace_back (eleTy, AT{});
1038+ return marshal;
1039+ }
1040+
1041+ CodeGenSpecifics::Marshalling
1042+ complexReturnType (mlir::Location, mlir::Type eleTy) const override {
1043+ CodeGenSpecifics::Marshalling marshal;
1044+ // Use a type that will be translated into LLVM as:
1045+ // { t, t } struct of 2 element type
1046+ marshal.emplace_back (
1047+ mlir::TupleType::get (eleTy.getContext (), mlir::TypeRange{eleTy, eleTy}),
1048+ AT{});
1049+ return marshal;
1050+ }
1051+ };
1052+ } // namespace
1053+
10231054// ===----------------------------------------------------------------------===//
10241055// PPC64 (AIX 64 bit) target specifics.
10251056// ===----------------------------------------------------------------------===//
@@ -1847,6 +1878,9 @@ fir::CodeGenSpecifics::get(mlir::MLIRContext *ctx, llvm::Triple &&trp,
18471878 case llvm::Triple::ArchType::aarch64:
18481879 return std::make_unique<TargetAArch64>(
18491880 ctx, std::move (trp), std::move (kindMap), targetCPU, targetFeatures, dl);
1881+ case llvm::Triple::ArchType::ppc:
1882+ return std::make_unique<TargetPPC>(ctx, std::move (trp), std::move (kindMap),
1883+ targetCPU, targetFeatures, dl);
18501884 case llvm::Triple::ArchType::ppc64:
18511885 return std::make_unique<TargetPPC64>(
18521886 ctx, std::move (trp), std::move (kindMap), targetCPU, targetFeatures, dl);
0 commit comments