[PATCH] D112975: Fix complex types declared using mode TC
Elizabeth Andrews via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 2 12:01:27 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c8d3053fa0c: Fix complex types declared using mode TC (authored by eandrews).
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112975/new/
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112975.384178.patch
Type: text/x-patch
Size: 1190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211102/2e4f65f8/attachment.bin>
More information about the cfe-commits
mailing list