[PATCH] D88130: [PPC] [AIX] Implement calling convention IR for C99 complex types on AIX
Chris Bowler via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 22 19:53:09 PDT 2020
cebowleratibm created this revision.
cebowleratibm added reviewers: ZarkoCA, daltenty, sfertile.
Herald added subscribers: cfe-commits, nemanjai.
Herald added a project: clang.
cebowleratibm requested review of this revision.
Builds on D88105 <https://reviews.llvm.org/D88105> to add AIX calling convention logic to Clang for C99 complex types on AIX.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88130
Files:
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/aix-complex.c
clang/test/CodeGen/powerpc-c99complex.c
Index: clang/test/CodeGen/powerpc-c99complex.c
===================================================================
--- clang/test/CodeGen/powerpc-c99complex.c
+++ clang/test/CodeGen/powerpc-c99complex.c
@@ -1,11 +1,13 @@
-// RUN: %clang_cc1 -triple powerpc64-unknown-linux -emit-llvm %s -o - | FileCheck %s --check-prefixes=PPC64LNX
-// RUN: %clang_cc1 -triple ppc64le-unknown-linux -emit-llvm %s -o - | FileCheck %s --check-prefixes=PPC64LNX
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOLDBL128
+// RUN: %clang_cc1 -triple powerpc-unknown-aix -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOLDBL128
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-LDBL128
+// RUN: %clang_cc1 -triple ppc64le-unknown-linux -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-LDBL128
// RUN: %clang_cc1 -triple powerpc-unknown-linux -emit-llvm %s -o - | FileCheck %s --check-prefix=PPC32LNX
_Complex float foo1(_Complex float x) {
return x;
-// PPC64LNX-LABEL: define { float, float } @foo1(float %x.{{.*}}, float %x.{{.*}}) #0 {
-// PPC64LNX: ret { float, float }
+// CHECK-LABEL: define { float, float } @foo1(float %x.{{.*}}, float %x.{{.*}}) #0 {
+// CHECK: ret { float, float }
// PPC32LNX-LABEL: define void @foo1({ float, float }* noalias sret align 4 %agg.result, { float, float }* byval({ float, float }) align 4 %x) #0 {
// PPC32LNX: [[RETREAL:%.*]] = getelementptr inbounds { float, float }, { float, float }* %agg.result, i32 0, i32 0
@@ -16,8 +18,8 @@
_Complex double foo2(_Complex double x) {
return x;
-// PPC64LNX-LABEL: define { double, double } @foo2(double %x.{{.*}}, double %x.{{.*}}) #0 {
-// PPC64LNX: ret { double, double }
+// CHECK-LABEL: define { double, double } @foo2(double %x.{{.*}}, double %x.{{.*}}) #0 {
+// CHECK: ret { double, double }
// PPC32LNX-LABEL: define void @foo2({ double, double }* noalias sret align 8 %agg.result, { double, double }* byval({ double, double }) align 8 %x) #0 {
// PPC32LNX: [[RETREAL:%.*]] = getelementptr inbounds { double, double }, { double, double }* %agg.result, i32 0, i32 0
@@ -28,8 +30,11 @@
_Complex long double foo3(_Complex long double x) {
return x;
-// PPC64LNX-LDBL128-LABEL: define { ppc_fp128, ppc_fp128 } @foo3(ppc_fp128 %x.{{.*}}, ppc_fp128 %x.{{.*}}) #0 {
-// PPC64LNX-LDBL128: ret { ppc_fp128, ppc_fp128 }
+// CHECK-NOLDBL128-LABEL: define { double, double } @foo3(double %x.{{.*}}, double %x.{{.*}}) #0 {
+// CHECK-NOLDBL128: ret { double, double }
+
+// CHECK-LDBL128-LABEL: define { ppc_fp128, ppc_fp128 } @foo3(ppc_fp128 %x.{{.*}}, ppc_fp128 %x.{{.*}}) #0 {
+// CHECK-LDBL128: ret { ppc_fp128, ppc_fp128 }
// PPC32LNX-LABEL: define void @foo3({ ppc_fp128, ppc_fp128 }* noalias sret align 16 %agg.result, { ppc_fp128, ppc_fp128 }* byval({ ppc_fp128, ppc_fp128 }) align 16 %x) #0 {
// PPC32LNX: [[RETREAL:%.*]] = getelementptr inbounds { ppc_fp128, ppc_fp128 }, { ppc_fp128, ppc_fp128 }* %agg.result, i32 0, i32 0
Index: clang/test/CodeGen/aix-complex.c
===================================================================
--- clang/test/CodeGen/aix-complex.c
+++ /dev/null
@@ -1,10 +0,0 @@
-// REQUIRES: powerpc-registered-target
-// RUN: not %clang_cc1 -triple powerpc-unknown-aix \
-// RUN: -emit-llvm -o - %s 2>&1 | FileCheck %s
-// RUN: not %clang_cc1 -triple powerpc64-unknown-aix \
-// RUN: -emit-llvm -o - %s 2>&1 | FileCheck %s
-
-// CHECK: fatal error: error in backend: complex type is not supported on AIX yet
-_Complex float foo_float(_Complex float x) {
- return x;
-}
Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -4504,7 +4504,7 @@
ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy) const {
if (RetTy->isAnyComplexType())
- llvm::report_fatal_error("complex type is not supported on AIX yet");
+ return ABIArgInfo::getDirect();
if (RetTy->isVectorType())
llvm::report_fatal_error("vector type is not supported on AIX yet");
@@ -4525,7 +4525,7 @@
Ty = useFirstFieldIfTransparentUnion(Ty);
if (Ty->isAnyComplexType())
- llvm::report_fatal_error("complex type is not supported on AIX yet");
+ return ABIArgInfo::getDirect();
if (Ty->isVectorType())
llvm::report_fatal_error("vector type is not supported on AIX yet");
@@ -4550,8 +4550,9 @@
}
CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty) const {
- if (Ty->isAnyComplexType())
- llvm::report_fatal_error("complex type is not supported on AIX yet");
+ // Complex types are passed just like their elements.
+ if (const ComplexType *CTy = Ty->getAs<ComplexType>())
+ Ty = CTy->getElementType();
if (Ty->isVectorType())
llvm::report_fatal_error("vector type is not supported on AIX yet");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88130.293627.patch
Type: text/x-patch
Size: 5067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200923/c004b5d1/attachment-0001.bin>
More information about the cfe-commits
mailing list