[PATCH] D51446: [OpenMP][bugfix] Add missing macros for Power

Gheorghe-Teodor Bercea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 30 11:10:16 PDT 2018


gtbercea updated this revision to Diff 163377.
gtbercea added a comment.

  Add test.


Repository:
  rC Clang

https://reviews.llvm.org/D51446

Files:
  lib/Frontend/InitPreprocessor.cpp
  test/Preprocessor/aux-triple.c


Index: test/Preprocessor/aux-triple.c
===================================================================
--- test/Preprocessor/aux-triple.c
+++ test/Preprocessor/aux-triple.c
@@ -50,6 +50,9 @@
 // NONE-NOT:#define __ELF__
 // LINUX:#define __ELF__ 1
 
+// PPC64LE:#define __LONGDOUBLE128 1
+// PPC64LE:#define __LONG_DOUBLE_128__ 1
+
 // NVPTX64:#define __LP64__ 1
 // NVPTX64:#define __NVPTX__ 1
 // NVPTX64:#define __PTX__ 1
Index: lib/Frontend/InitPreprocessor.cpp
===================================================================
--- lib/Frontend/InitPreprocessor.cpp
+++ lib/Frontend/InitPreprocessor.cpp
@@ -1113,13 +1113,24 @@
     Builder.defineMacro("__x86_64__");
     break;
   case llvm::Triple::ppc64:
-    Builder.defineMacro("__powerpc64__");
-    Builder.defineMacro("_CALL_ELF", "1");
-    break;
   case llvm::Triple::ppc64le:
+  {
     Builder.defineMacro("__powerpc64__");
-    Builder.defineMacro("_CALL_ELF", "2");
+
+    StringRef ABI = AuxTI.getABI();
+    // Set _CALL_ELF macro needed for gnu/stubs.h
+    if (ABI == "elfv1" || ABI == "elfv1-qpx")
+      Builder.defineMacro("_CALL_ELF", "1");
+    if (ABI == "elfv2")
+      Builder.defineMacro("_CALL_ELF", "2");
+
+    // Required by PowerPC host toolchain.
+    if (AuxTI.getLongDoubleWidth() == 128) {
+      Builder.defineMacro("__LONGDOUBLE128");
+      Builder.defineMacro("__LONG_DOUBLE_128__");
+    }
     break;
+  }
   default:
     break;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51446.163377.patch
Type: text/x-patch
Size: 1437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180830/7617e96a/attachment.bin>


More information about the cfe-commits mailing list