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;
   }
 


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
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to