eandrews created this revision.
eandrews added reviewers: qiucf, rjmccall.
eandrews requested review of this revision.
This patch reverts incorrect IR - introduced in commit d11ec6f67e45
<https://reviews.llvm.org/rGd11ec6f67e45c630ab87bfb6010dcc93e89542fc>
(https://reviews.llvm.org/rGd11ec6f67e45c630ab87bfb6010dcc93e89542fc) - for
complex types declared using __attribute__((mode(TC))). TC mode corresponds to
__float128 type.
https://reviews.llvm.org/D112975
Files:
clang/lib/Basic/TargetInfo.cpp
clang/test/CodeGenCXX/complex128.cpp
Index: clang/test/CodeGenCXX/complex128.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGenCXX/complex128.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-linux-gnu %s -o - |
FileCheck %s
+
+// Define __complex128 type corresponding to __float128 (as in GCC headers).
+typedef _Complex float __attribute__((mode(TC))) __complex128;
+
+void check() {
+ // CHECK: alloca { fp128, fp128 }
+ __complex128 tmp;
+}
Index: clang/lib/Basic/TargetInfo.cpp
===================================================================
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -300,8 +300,11 @@
if (ExplicitType == FloatModeKind::Ibm128)
return hasIbm128Type() ? FloatModeKind::Ibm128
: FloatModeKind::NoFloat;
- if (ExplicitType == FloatModeKind::LongDouble)
- return ExplicitType;
+ if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
+ &getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
+ return FloatModeKind::LongDouble;
+ if (hasFloat128Type())
+ return FloatModeKind::Float128;
break;
}
Index: clang/test/CodeGenCXX/complex128.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGenCXX/complex128.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-unknown-linux-gnu %s -o - | FileCheck %s
+
+// Define __complex128 type corresponding to __float128 (as in GCC headers).
+typedef _Complex float __attribute__((mode(TC))) __complex128;
+
+void check() {
+ // CHECK: alloca { fp128, fp128 }
+ __complex128 tmp;
+}
Index: clang/lib/Basic/TargetInfo.cpp
===================================================================
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -300,8 +300,11 @@
if (ExplicitType == FloatModeKind::Ibm128)
return hasIbm128Type() ? FloatModeKind::Ibm128
: FloatModeKind::NoFloat;
- if (ExplicitType == FloatModeKind::LongDouble)
- return ExplicitType;
+ if (&getLongDoubleFormat() == &llvm::APFloat::PPCDoubleDouble() ||
+ &getLongDoubleFormat() == &llvm::APFloat::IEEEquad())
+ return FloatModeKind::LongDouble;
+ if (hasFloat128Type())
+ return FloatModeKind::Float128;
break;
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits