qiucf updated this revision to Diff 300887.
qiucf added a comment.

Remove `FIXME`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90208/new/

https://reviews.llvm.org/D90208

Files:
  clang/lib/Basic/Targets/PPC.cpp
  clang/test/CodeGen/ppc64-long-double.cpp


Index: clang/test/CodeGen/ppc64-long-double.cpp
===================================================================
--- clang/test/CodeGen/ppc64-long-double.cpp
+++ clang/test/CodeGen/ppc64-long-double.cpp
@@ -16,6 +16,20 @@
 // RUN: %clang_cc1 -triple powerpc64-linux-musl -emit-llvm -o - 
-mlong-double-128 %s | \
 // RUN:   FileCheck --check-prefix=IBM128 %s
 
+// Check IBM-quad and IEEE-quad macros are defined.
+// RUN: %clang -E -dM -ffreestanding -target powerpc64le-linux-gnu %s \
+// RUN:   -mabi=ibmlongdouble | FileCheck -check-prefix=CHECK-DEF-IBM128 %s
+// RUN: %clang -E -dM -ffreestanding -target powerpc64le-linux-gnu %s \
+// RUN:   -mabi=ieeelongdouble | FileCheck -check-prefix=CHECK-DEF-IEEE128 %s
+// RUN: %clang -E -dM -ffreestanding -target powerpc64le-linux-gnu %s \
+// RUN:   -mlong-double-64 | FileCheck -check-prefix=CHECK-DEF-F64 %s
+
+// CHECK-DEF-IBM128: #define __LONG_DOUBLE_128__
+// CHECK-DEF-IBM128: #define __LONG_DOUBLE_IBM128__
+// CHECK-DEF-IEEE128: #define __LONG_DOUBLE_128__
+// CHECK-DEF-IEEE128: #define __LONG_DOUBLE_IEEE128__
+// CHECK-DEF-F64-NOT: #define __LONG_DOUBLE_128__
+
 long double x = 0;
 int size = sizeof(x);
 
Index: clang/lib/Basic/Targets/PPC.cpp
===================================================================
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -118,10 +118,13 @@
   }
   Builder.defineMacro("__REGISTER_PREFIX__", "");
 
-  // FIXME: Should be controlled by command line option.
   if (LongDoubleWidth == 128) {
     Builder.defineMacro("__LONG_DOUBLE_128__");
     Builder.defineMacro("__LONGDOUBLE128");
+    if (Opts.PPCIEEELongDouble)
+      Builder.defineMacro("__LONG_DOUBLE_IEEE128__");
+    else
+      Builder.defineMacro("__LONG_DOUBLE_IBM128__");
   }
 
   // Define this for elfv2 (64-bit only) or 64-bit darwin.


Index: clang/test/CodeGen/ppc64-long-double.cpp
===================================================================
--- clang/test/CodeGen/ppc64-long-double.cpp
+++ clang/test/CodeGen/ppc64-long-double.cpp
@@ -16,6 +16,20 @@
 // RUN: %clang_cc1 -triple powerpc64-linux-musl -emit-llvm -o - -mlong-double-128 %s | \
 // RUN:   FileCheck --check-prefix=IBM128 %s
 
+// Check IBM-quad and IEEE-quad macros are defined.
+// RUN: %clang -E -dM -ffreestanding -target powerpc64le-linux-gnu %s \
+// RUN:   -mabi=ibmlongdouble | FileCheck -check-prefix=CHECK-DEF-IBM128 %s
+// RUN: %clang -E -dM -ffreestanding -target powerpc64le-linux-gnu %s \
+// RUN:   -mabi=ieeelongdouble | FileCheck -check-prefix=CHECK-DEF-IEEE128 %s
+// RUN: %clang -E -dM -ffreestanding -target powerpc64le-linux-gnu %s \
+// RUN:   -mlong-double-64 | FileCheck -check-prefix=CHECK-DEF-F64 %s
+
+// CHECK-DEF-IBM128: #define __LONG_DOUBLE_128__
+// CHECK-DEF-IBM128: #define __LONG_DOUBLE_IBM128__
+// CHECK-DEF-IEEE128: #define __LONG_DOUBLE_128__
+// CHECK-DEF-IEEE128: #define __LONG_DOUBLE_IEEE128__
+// CHECK-DEF-F64-NOT: #define __LONG_DOUBLE_128__
+
 long double x = 0;
 int size = sizeof(x);
 
Index: clang/lib/Basic/Targets/PPC.cpp
===================================================================
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -118,10 +118,13 @@
   }
   Builder.defineMacro("__REGISTER_PREFIX__", "");
 
-  // FIXME: Should be controlled by command line option.
   if (LongDoubleWidth == 128) {
     Builder.defineMacro("__LONG_DOUBLE_128__");
     Builder.defineMacro("__LONGDOUBLE128");
+    if (Opts.PPCIEEELongDouble)
+      Builder.defineMacro("__LONG_DOUBLE_IEEE128__");
+    else
+      Builder.defineMacro("__LONG_DOUBLE_IBM128__");
   }
 
   // Define this for elfv2 (64-bit only) or 64-bit darwin.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to