[PATCH] D141862: [clang][driver][AIX] Add OpenMP runtime if -fopenmp specified

2023-01-19 Thread Xing Xue via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
xingxue marked an inline comment as done.
Closed by commit rGb05fa4faf64d: [clang][driver][AIX] Add OpenMP runtime if 
-fopenmp specified (authored by xingxue).

Changed prior to commit:
  https://reviews.llvm.org/D141862?vs=490167=490563#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141862

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -1016,3 +1016,68 @@
 // CHECK-LD64-SHARED-EXPFULL: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-SHARED-EXPFULL: "-lm"
 // CHECK-LD64-SHARED-EXPFULL: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0. -fopenmp to use default OpenMP runtime libomp.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:-fopenmp \
+// RUN:   | FileCheck --check-prefixes=CHECK-FOPENMP,CHECK-FOPENMP-OMP %s
+// CHECK-FOPENMP-NOT: warning:
+// CHECK-FOPENMP: "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-FOPENMP: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-FOPENMP: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-FOPENMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-FOPENMP-NOT: "-bnso"
+// CHECK-FOPENMP: "-b32"
+// CHECK-FOPENMP: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-FOPENMP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-FOPENMP: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
+// CHECK-FOPENMP-NOT: "-lc++"
+// CHECK-FOPENMP-NOT: "-lc++abi"
+// CHECK-FOPENMP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-FOPENMP-NOT: "--as-needed"
+// CHECK-FOPENMP: "-lunwind"
+// CHECK-FOPENMP-NOT: "--no-as-needed"
+// CHECK-FOPENMP-NOT: "-lm"
+// CHECK-FOPENMP-OMP: "-lomp"
+// CHECK-FOPENMP-IOMP5:   "-liomp5"
+// CHECK-FOPENMP-GOMP:"-lgomp"
+// CHECK-FOPENMP: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0. -fopenmp=libomp to specify libomp explicitly.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:-fopenmp=libomp \
+// RUN:   | FileCheck --check-prefixes=CHECK-FOPENMP,CHECK-FOPENMP-OMP %s
+
+// Check powerpc-ibm-aix7.1.0.0. -fopenmp=libiomp5 to specify libgomp explicitly.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:-fopenmp=libiomp5 \
+// RUN:   | FileCheck --check-prefixes=CHECK-FOPENMP,CHECK-FOPENMP-IOMP5 %s
+
+// Check powerpc-ibm-aix7.1.0.0. -fopenmp=libgomp to specify libgomp explicitly.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:-fopenmp=libgomp \
+// RUN:   | FileCheck --check-prefixes=CHECK-FOPENMP,CHECK-FOPENMP-GOMP %s
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -fopenmp=libfoo results an error.
+// RUN: %clang %s 2>&1 -### \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-fopenmp=libfoo \
+// RUN:   | FileCheck --check-prefixes=CHECK-FOPENMP-FOO %s
+// CHECK-FOPENMP-FOO: error: unsupported argument 'libfoo' to option '-fopenmp='
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -243,6 +243,25 @@
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
 AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
 
+// Add OpenMP runtime if -fopenmp is specified.
+if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
+ options::OPT_fno_openmp, false)) {
+  switch (ToolChain.getDriver().getOpenMPRuntime(Args)) {
+  case Driver::OMPRT_OMP:
+CmdArgs.push_back("-lomp");
+break;
+  case Driver::OMPRT_IOMP5:
+CmdArgs.push_back("-liomp5");
+break;
+  case Driver::OMPRT_GOMP:
+CmdArgs.push_back("-lgomp");
+break;
+  case Driver::OMPRT_Unknown:
+// Already diagnosed.
+break;
+  }
+}
+
 // Support POSIX threads if "-pthreads" or "-pthread" is 

[PATCH] D141862: [clang][driver][AIX] Add OpenMP runtime if -fopenmp specified

2023-01-19 Thread Xing Xue via Phabricator via cfe-commits
xingxue added inline comments.



Comment at: clang/test/Driver/aix-ld.c:1027
+// RUN:-fopenmp \
+// RUN:   | FileCheck --check-prefix=CHECK-FOPENMP-OMP %s
+// CHECK-FOPENMP-OMP-NOT: warning:

daltenty wrote:
> nit: since the output for these tests are really the same, apart from one 
> line with the library name, we could use two prefixes, a common one and a 
> specific one to avoid repetition:
> ```
> // RUN:   | FileCheck --check-prefixes=CHECK-FOPENMP,CHECK-FOPENMP-OMP %s
> ```
> 
> and then the CHECK block can go something like this:
> ```
> ...
> // CHECK-FOPENMP-NOT: "-lm"
> // CHECK-FOPENMP-OMP: "-lomp"
> // CHECK-FOPENMP-IOMP5:  "-liomp5"
> // CHECK-FOPENMP-GOMP:   "-lgomp
> // CHECK-FOPENMP: "-lc"
> ...
> ```
Good suggestion, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141862

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D141862: [clang][driver][AIX] Add OpenMP runtime if -fopenmp specified

2023-01-18 Thread Xing Xue via Phabricator via cfe-commits
xingxue updated this revision to Diff 490167.
xingxue added a comment.

Addressed comments.

- added test scenarios for option `fopenmp` in `clang/test/Driver/aix-ld.c`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141862

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -1016,3 +1016,76 @@
 // CHECK-LD64-SHARED-EXPFULL: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-SHARED-EXPFULL: "-lm"
 // CHECK-LD64-SHARED-EXPFULL: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0. -fopenmp to use default OpenMP runtime libomp.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:-fopenmp \
+// RUN:   | FileCheck --check-prefix=CHECK-FOPENMP-OMP %s
+// CHECK-FOPENMP-OMP-NOT: warning:
+// CHECK-FOPENMP-OMP: "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-FOPENMP-OMP: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-FOPENMP-OMP: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-FOPENMP-OMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-FOPENMP-OMP-NOT: "-bnso"
+// CHECK-FOPENMP-OMP: "-b32"
+// CHECK-FOPENMP-OMP: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-FOPENMP-OMP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-FOPENMP-OMP: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
+// CHECK-FOPENMP-OMP-NOT: "-lc++"
+// CHECK-FOPENMP-OMP-NOT: "-lc++abi"
+// CHECK-FOPENMP-OMP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-FOPENMP-OMP-NOT: "--as-needed"
+// CHECK-FOPENMP-OMP: "-lunwind"
+// CHECK-FOPENMP-OMP-NOT: "--no-as-needed"
+// CHECK-FOPENMP-OMP-NOT: "-lm"
+// CHECK-FOPENMP-OMP: "-lomp"
+// CHECK-FOPENMP-OMP: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0. -fopenmp=libomp to specify libomp explicitly.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:-fopenmp=libomp \
+// RUN:   | FileCheck --check-prefix=CHECK-FOPENMP-OMP %s
+
+// Check powerpc-ibm-aix7.1.0.0. -fopenmp=libgomp to specify libgomp explicitly.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:-fopenmp=libgomp \
+// RUN:   | FileCheck --check-prefix=CHECK-FOPENMP-GOMP %s
+// CHECK-FOPENMP-GOMP-NOT: warning:
+// CHECK-FOPENMP-GOMP: "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-FOPENMP-GOMP: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-FOPENMP-GOMP: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-FOPENMP-GOMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-FOPENMP-GOMP-NOT: "-bnso"
+// CHECK-FOPENMP-GOMP: "-b32"
+// CHECK-FOPENMP-GOMP: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-FOPENMP-GOMP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-FOPENMP-GOMP: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
+// CHECK-FOPENMP-GOMP-NOT: "-lc++"
+// CHECK-FOPENMP-GOMP-NOT: "-lc++abi"
+// CHECK-FOPENMP-GOMP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-FOPENMP-GOMP-NOT: "--as-needed"
+// CHECK-FOPENMP-GOMP: "-lunwind"
+// CHECK-FOPENMP-GOMP-NOT: "--no-as-needed"
+// CHECK-FOPENMP-GOMP-NOT: "-lm"
+// CHECK-FOPENMP-GOMP: "-lgomp"
+// CHECK-FOPENMP-GOMP: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -fopenmp=libfoo results an error.
+// RUN: %clang %s 2>&1 -### \
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:-fopenmp=libfoo \
+// RUN:   | FileCheck --check-prefix=CHECK-FOPENMP-FOO %s
+// CHECK-FOPENMP-FOO: error: unsupported argument 'libfoo' to option '-fopenmp='
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -243,6 +243,25 @@
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
 AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
 
+// Add OpenMP runtime if -fopenmp is specified.
+if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
+ options::OPT_fno_openmp, false)) {
+  switch (ToolChain.getDriver().getOpenMPRuntime(Args)) {
+  case Driver::OMPRT_OMP:
+CmdArgs.push_back("-lomp");
+break;
+  case Driver::OMPRT_IOMP5:
+

[PATCH] D141862: [clang][driver][AIX] Add OpenMP runtime if -fopenmp specified

2023-01-16 Thread Xing Xue via Phabricator via cfe-commits
xingxue created this revision.
xingxue added reviewers: daltenty, cebowleratibm, kkwli0.
xingxue added a project: LLVM.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
xingxue requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, MaskRay.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

This patch adds OpenMP runtime to the linker command line if `-fopenmp` is 
specifed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141862

Files:
  clang/lib/Driver/ToolChains/AIX.cpp


Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -243,6 +243,25 @@
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
 AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
 
+// Add OpenMP runtime if -fopenmp is specified.
+if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
+ options::OPT_fno_openmp, false)) {
+  switch (ToolChain.getDriver().getOpenMPRuntime(Args)) {
+  case Driver::OMPRT_OMP:
+CmdArgs.push_back("-lomp");
+break;
+  case Driver::OMPRT_IOMP5:
+CmdArgs.push_back("-liomp5");
+break;
+  case Driver::OMPRT_GOMP:
+CmdArgs.push_back("-lgomp");
+break;
+  case Driver::OMPRT_Unknown:
+// Already diagnosed.
+break;
+  }
+}
+
 // Support POSIX threads if "-pthreads" or "-pthread" is present.
 if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
   CmdArgs.push_back("-lpthreads");


Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -243,6 +243,25 @@
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
 AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
 
+// Add OpenMP runtime if -fopenmp is specified.
+if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
+ options::OPT_fno_openmp, false)) {
+  switch (ToolChain.getDriver().getOpenMPRuntime(Args)) {
+  case Driver::OMPRT_OMP:
+CmdArgs.push_back("-lomp");
+break;
+  case Driver::OMPRT_IOMP5:
+CmdArgs.push_back("-liomp5");
+break;
+  case Driver::OMPRT_GOMP:
+CmdArgs.push_back("-lgomp");
+break;
+  case Driver::OMPRT_Unknown:
+// Already diagnosed.
+break;
+  }
+}
+
 // Support POSIX threads if "-pthreads" or "-pthread" is present.
 if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
   CmdArgs.push_back("-lpthreads");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137986: [Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl to 'double' version lib calls in 64-bit 'long double' mode

2022-11-18 Thread Xing Xue via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfa7477eb87fd: [Clang][CodeGen][AIX] Map __builtin_frexpl, 
__builtin_ldexpl, and… (authored by xingxue).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137986

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aix-builtin-mapping.c


Index: clang/test/CodeGen/aix-builtin-mapping.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-builtin-mapping.c
@@ -0,0 +1,22 @@
+// AIX library functions frexpl, ldexpl, and modfl are for 128-bit IBM
+// 'long double' (i.e. __ibm128). Check that the compiler generates
+// calls to the 'double' versions for corresponding builtin functions in
+// 64-bit 'long double' mode.
+
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -mlong-double-64 -emit-llvm -o - %s 
| FileCheck -check-prefix=CHECK %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -mlong-double-64 -emit-llvm -o - 
%s | FileCheck -check-prefix=CHECK %s
+
+int main()
+{
+  int DummyInt;
+  long double DummyLongDouble;
+  long double returnValue;
+
+  returnValue = __builtin_modfl(1.0L, );
+  returnValue = __builtin_frexpl(0.0L, );
+  returnValue = __builtin_ldexpl(1.0L, 1);
+}
+
+// CHECK: %call = call double @modf(double noundef 1.00e+00, ptr noundef 
%DummyLongDouble) #3
+// CHECK: %call1 = call double @frexp(double noundef 0.00e+00, ptr noundef 
%DummyInt) #3
+// CHECK: %call2 = call double @ldexp(double noundef 1.00e+00, i32 noundef 
{{(signext )?}}1) #4
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -106,6 +106,15 @@
   {Builtin::BI__builtin_nexttowardf128, "__nexttowardieee128"},
   };
 
+  // The AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+  // IBM 'long double' (i.e. __ibm128). Map to the 'double' versions
+  // if it is 64-bit 'long double' mode.
+  static SmallDenseMap AIXLongDouble64Builtins{
+  {Builtin::BI__builtin_frexpl, "frexp"},
+  {Builtin::BI__builtin_ldexpl, "ldexp"},
+  {Builtin::BI__builtin_modfl, "modf"},
+  };
+
   // If the builtin has been declared explicitly with an assembler label,
   // use the mangled name. This differs from the plain label on platforms
   // that prefix labels.
@@ -118,6 +127,12 @@
 ().getLongDoubleFormat() == ::APFloat::IEEEquad() &&
 F128Builtins.find(BuiltinID) != F128Builtins.end())
   Name = F128Builtins[BuiltinID];
+else if (getTriple().isOSAIX() &&
+ ().getLongDoubleFormat() ==
+ ::APFloat::IEEEdouble() &&
+ AIXLongDouble64Builtins.find(BuiltinID) !=
+ AIXLongDouble64Builtins.end())
+  Name = AIXLongDouble64Builtins[BuiltinID];
 else
   Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
   }


Index: clang/test/CodeGen/aix-builtin-mapping.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-builtin-mapping.c
@@ -0,0 +1,22 @@
+// AIX library functions frexpl, ldexpl, and modfl are for 128-bit IBM
+// 'long double' (i.e. __ibm128). Check that the compiler generates
+// calls to the 'double' versions for corresponding builtin functions in
+// 64-bit 'long double' mode.
+
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -mlong-double-64 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -mlong-double-64 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK %s
+
+int main()
+{
+  int DummyInt;
+  long double DummyLongDouble;
+  long double returnValue;
+
+  returnValue = __builtin_modfl(1.0L, );
+  returnValue = __builtin_frexpl(0.0L, );
+  returnValue = __builtin_ldexpl(1.0L, 1);
+}
+
+// CHECK: %call = call double @modf(double noundef 1.00e+00, ptr noundef %DummyLongDouble) #3
+// CHECK: %call1 = call double @frexp(double noundef 0.00e+00, ptr noundef %DummyInt) #3
+// CHECK: %call2 = call double @ldexp(double noundef 1.00e+00, i32 noundef {{(signext )?}}1) #4
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -106,6 +106,15 @@
   {Builtin::BI__builtin_nexttowardf128, "__nexttowardieee128"},
   };
 
+  // The AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+  // IBM 'long double' (i.e. __ibm128). Map to the 'double' versions
+  // if it is 64-bit 'long double' mode.
+  static SmallDenseMap AIXLongDouble64Builtins{
+  {Builtin::BI__builtin_frexpl, "frexp"},
+  {Builtin::BI__builtin_ldexpl, "ldexp"},
+  {Builtin::BI__builtin_modfl, "modf"},
+  };
+
   // If the builtin has been declared explicitly with an assembler label,
   // use the mangled name. This differs from the plain label on 

[PATCH] D137986: [Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl to 'double' version lib calls in 64-bit 'long double' mode

2022-11-16 Thread Xing Xue via Phabricator via cfe-commits
xingxue added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:110
+  // The AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+  // 'long double'. Map to the 'double' versions if it is 64-bit 'long
+  // double' mode.

daltenty wrote:
> I feel like we should be clear about which 128-bit double format we are 
> talking about, since it may not be immediately clear for folks who aren't 
> intimately familiar with AIX. Maybe we can reference __ibm128 or ibm 128-bit, 
> so it's clear what we mean.
Modified as suggested, thanks!



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:112
+  // double' mode.
+  static SmallDenseMap AIXLongDoubleBuiltins{
+  {Builtin::BI__builtin_frexpl, "frexp"},

hubert.reinterpretcast wrote:
> Please rename to "AIXLongDouble64Builtins".
Renamed as suggested, thanks!



Comment at: clang/test/CodeGen/aix-builtin-mapping.c:2
+// AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+// 'long double'. Check that the compiler generates calls to the 'double'
+// versions for correspoding builtin functions in 64-bit 'long double' mode.

daltenty wrote:
> 
> 
Modified as suggested, thanks!



Comment at: clang/test/CodeGen/aix-builtin-mapping.c:3
+// 'long double'. Check that the compiler generates calls to the 'double'
+// versions for correspoding builtin functions in 64-bit 'long double' mode.
+

hubert.reinterpretcast wrote:
> Fix typo.
Fixed, thanks for catching it!



Comment at: clang/test/CodeGen/aix-builtin-mapping.c:5-6
+
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -mlong-double-64 -S -o - %s | 
FileCheck %s -check-prefix=CHECK
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -mlong-double-64 -S -o - %s | 
FileCheck %s -check-prefix=CHECK
+

hubert.reinterpretcast wrote:
> This should be an IR test. Checking assembly means actually needing the 
> PowerPC target enabled in the LLVM configuration.
Changed to use IR, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137986

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137986: [Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl to 'double' version lib calls in 64-bit 'long double' mode

2022-11-16 Thread Xing Xue via Phabricator via cfe-commits
xingxue updated this revision to Diff 475853.
xingxue marked 5 inline comments as done.
xingxue edited the summary of this revision.
xingxue added a comment.

Addressed comments:

- rename `AIXLongDoubleBuiltins` to `AIXLongDouble64Builtins`
- test IR output instead of assembly output
- fix a typo in a comment
- mention `frexpl()`, `ldexpl()`, and `modfl()` are for 128-bit IBM `long 
double`, i.e. `__ibm128`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137986

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aix-builtin-mapping.c


Index: clang/test/CodeGen/aix-builtin-mapping.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-builtin-mapping.c
@@ -0,0 +1,22 @@
+// AIX library functions frexpl, ldexpl, and modfl are for 128-bit IBM
+// 'long double' (i.e. __ibm128). Check that the compiler generates
+// calls to the 'double' versions for corresponding builtin functions in
+// 64-bit 'long double' mode.
+
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -mlong-double-64 -emit-llvm -o - %s 
| FileCheck -check-prefix=CHECK %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -mlong-double-64 -emit-llvm -o - 
%s | FileCheck -check-prefix=CHECK %s
+
+int main()
+{
+  int DummyInt;
+  long double DummyLongDouble;
+  long double returnValue;
+
+  returnValue = __builtin_modfl(1.0L, );
+  returnValue = __builtin_frexpl(0.0L, );
+  returnValue = __builtin_ldexpl(1.0L, 1);
+}
+
+// CHECK: %call = call double @modf(double noundef 1.00e+00, ptr noundef 
%DummyLongDouble) #3
+// CHECK: %call1 = call double @frexp(double noundef 0.00e+00, ptr noundef 
%DummyInt) #3
+// CHECK: %call2 = call double @ldexp(double noundef 1.00e+00, i32 noundef 
{{(signext )?}}1) #4
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -106,6 +106,15 @@
   {Builtin::BI__builtin_nexttowardf128, "__nexttowardieee128"},
   };
 
+  // The AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+  // IBM 'long double' (i.e. __ibm128). Map to the 'double' versions
+  // if it is 64-bit 'long double' mode.
+  static SmallDenseMap AIXLongDouble64Builtins{
+  {Builtin::BI__builtin_frexpl, "frexp"},
+  {Builtin::BI__builtin_ldexpl, "ldexp"},
+  {Builtin::BI__builtin_modfl, "modf"},
+  };
+
   // If the builtin has been declared explicitly with an assembler label,
   // use the mangled name. This differs from the plain label on platforms
   // that prefix labels.
@@ -118,6 +127,12 @@
 ().getLongDoubleFormat() == ::APFloat::IEEEquad() &&
 F128Builtins.find(BuiltinID) != F128Builtins.end())
   Name = F128Builtins[BuiltinID];
+else if (getTriple().isOSAIX() &&
+ ().getLongDoubleFormat() ==
+ ::APFloat::IEEEdouble() &&
+ AIXLongDouble64Builtins.find(BuiltinID) !=
+ AIXLongDouble64Builtins.end())
+  Name = AIXLongDouble64Builtins[BuiltinID];
 else
   Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
   }


Index: clang/test/CodeGen/aix-builtin-mapping.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-builtin-mapping.c
@@ -0,0 +1,22 @@
+// AIX library functions frexpl, ldexpl, and modfl are for 128-bit IBM
+// 'long double' (i.e. __ibm128). Check that the compiler generates
+// calls to the 'double' versions for corresponding builtin functions in
+// 64-bit 'long double' mode.
+
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -mlong-double-64 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -mlong-double-64 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK %s
+
+int main()
+{
+  int DummyInt;
+  long double DummyLongDouble;
+  long double returnValue;
+
+  returnValue = __builtin_modfl(1.0L, );
+  returnValue = __builtin_frexpl(0.0L, );
+  returnValue = __builtin_ldexpl(1.0L, 1);
+}
+
+// CHECK: %call = call double @modf(double noundef 1.00e+00, ptr noundef %DummyLongDouble) #3
+// CHECK: %call1 = call double @frexp(double noundef 0.00e+00, ptr noundef %DummyInt) #3
+// CHECK: %call2 = call double @ldexp(double noundef 1.00e+00, i32 noundef {{(signext )?}}1) #4
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -106,6 +106,15 @@
   {Builtin::BI__builtin_nexttowardf128, "__nexttowardieee128"},
   };
 
+  // The AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+  // IBM 'long double' (i.e. __ibm128). Map to the 'double' versions
+  // if it is 64-bit 'long double' mode.
+  static SmallDenseMap AIXLongDouble64Builtins{
+  {Builtin::BI__builtin_frexpl, "frexp"},
+  

[PATCH] D137986: [Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl to 'double' version lib calls in 64-bit 'long double' mode

2022-11-14 Thread Xing Xue via Phabricator via cfe-commits
xingxue created this revision.
xingxue added reviewers: rjmccall, hubert.reinterpretcast, daltenty, 
cebowleratibm.
xingxue added a project: LLVM.
Herald added a project: All.
xingxue requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

AIX library functions `frexpl()`, `ldexpl()`, and `modfl()` are for 128-bit 
`long double`. Other `*l()` functions, e.g., `acosl()`, are for 64-bit `long 
double`. The AIX Clang compiler currently maps builtin functions 
`__builtin_frexpl()`, `__builtin_ldexpl()`, and `__builtin_modfl()` to 
`frexpl()`, `ldexpl()`, and `modfl()` in 64-bit `long double` mode which 
results in seg-faults or incorrect return values. This patch changes to map 
`__builtin_frexpl()`, `__builtin_ldexpl()`, and `__builtin_modfl()` to `double` 
version lib functions `frexp()`, `ldexp()` and `modf()` in 64-bit `long double` 
mode. The following is from AIX .

  /*
   * frexpl(), ldexpl(), and modfl() have preexisting shared versions which are
   * 128-bit only.  64-bit versions must be made available for C99 for the
   * default 64-bit long double.  These cannot simply be macros because the
   * actual routines will be the incorrect form in 64-bit mode if the user
   * forces the actual routines to be used through undef or macro suppression
   * per the standard.
   */
  #if defined(_ISOC99_SOURCE) && !defined(__LONGDOUBLE128)
  static long double _NOTHROW(frexpl, (long double __x, int *__i))
  {
   return (long double) frexp((double) __x, __i);
  }
  
  static long double _NOTHROW(ldexpl, (long double __x, int __i))
  {
   return (long double) ldexp((double) __x, __i);
  }
  
  #ifndef __MODFL
  static long double _NOTHROW(modfl, (long double __x, long double *__y))
  {
   return (long double) modf((double) __x, (double *) __y);
  }
  #endif
  #endif


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137986

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aix-builtin-mapping.c


Index: clang/test/CodeGen/aix-builtin-mapping.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-builtin-mapping.c
@@ -0,0 +1,22 @@
+// AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+// 'long double'. Check that the compiler generates calls to the 'double'
+// versions for correspoding builtin functions in 64-bit 'long double' mode.
+
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -mlong-double-64 -S -o - %s | 
FileCheck %s -check-prefix=CHECK
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -mlong-double-64 -S -o - %s | 
FileCheck %s -check-prefix=CHECK
+
+int main()
+{
+  int DummyInt;
+  long double DummyLongDouble;
+  long double returnValue;
+
+  returnValue = __builtin_modfl(1.0L, );
+  returnValue = __builtin_frexpl(0.0L, );
+  returnValue = __builtin_ldexpl(1.0L, 1);
+}
+
+// CHECK:  bl .modf[PR]
+// CHECK:  bl .frexp[PR]
+// CHECK:  bl .ldexp[PR]
+
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -106,6 +106,15 @@
   {Builtin::BI__builtin_nexttowardf128, "__nexttowardieee128"},
   };
 
+  // The AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+  // 'long double'. Map to the 'double' versions if it is 64-bit 'long
+  // double' mode.
+  static SmallDenseMap AIXLongDoubleBuiltins{
+  {Builtin::BI__builtin_frexpl, "frexp"},
+  {Builtin::BI__builtin_ldexpl, "ldexp"},
+  {Builtin::BI__builtin_modfl, "modf"},
+  };
+
   // If the builtin has been declared explicitly with an assembler label,
   // use the mangled name. This differs from the plain label on platforms
   // that prefix labels.
@@ -118,6 +127,12 @@
 ().getLongDoubleFormat() == ::APFloat::IEEEquad() &&
 F128Builtins.find(BuiltinID) != F128Builtins.end())
   Name = F128Builtins[BuiltinID];
+else if (getTriple().isOSAIX() &&
+ ().getLongDoubleFormat() ==
+ ::APFloat::IEEEdouble() &&
+ AIXLongDoubleBuiltins.find(BuiltinID) !=
+ AIXLongDoubleBuiltins.end())
+  Name = AIXLongDoubleBuiltins[BuiltinID];
 else
   Name = Context.BuiltinInfo.getName(BuiltinID) + 10;
   }


Index: clang/test/CodeGen/aix-builtin-mapping.c
===
--- /dev/null
+++ clang/test/CodeGen/aix-builtin-mapping.c
@@ -0,0 +1,22 @@
+// AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+// 'long double'. Check that the compiler generates calls to the 'double'
+// versions for correspoding builtin functions in 64-bit 'long double' mode.
+
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -mlong-double-64 -S -o - %s | FileCheck %s -check-prefix=CHECK
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -mlong-double-64 -S -o - %s | FileCheck %s -check-prefix=CHECK
+
+int main()
+{
+  int DummyInt;
+  long double 

[PATCH] D129165: [AIX][clang/test] Set/propagate AIXTHREAD_STK for AIX

2022-07-05 Thread Xing Xue via Phabricator via cfe-commits
xingxue accepted this revision.
xingxue added a comment.
This revision is now accepted and ready to land.

LGTM; thanks!  The IBM OpenMP runtime sets the default thread stack size to 
4MiB on AIX as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129165

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72736: [AIX] Add improved interface for retrieving load module paths

2020-02-13 Thread Xing Xue via Phabricator via cfe-commits
xingxue accepted this revision.
xingxue added a comment.
This revision is now accepted and ready to land.

LGTM.


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

https://reviews.llvm.org/D72736



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63786: Print NULL as "(null)" in diagnostic message

2019-06-26 Thread Xing Xue via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364462: Print NULL as (null) in diagnostic 
message (authored by xingxue, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63786?vs=206514=206724#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63786

Files:
  cfe/trunk/tools/c-index-test/c-index-test.c


Index: cfe/trunk/tools/c-index-test/c-index-test.c
===
--- cfe/trunk/tools/c-index-test/c-index-test.c
+++ cfe/trunk/tools/c-index-test/c-index-test.c
@@ -1053,7 +1053,8 @@
 if (Cursor.kind == CXCursor_InclusionDirective) {
   CXFile File = clang_getIncludedFile(Cursor);
   CXString Included = clang_getFileName(File);
-  printf(" (%s)", clang_getCString(Included));
+  const char *IncludedString = clang_getCString(Included);
+  printf(" (%s)", IncludedString ? IncludedString : "(null)");
   clang_disposeString(Included);
   
   if (clang_isFileMultipleIncludeGuarded(TU, File))
@@ -4644,18 +4645,19 @@
 CXFile File;
 CXString FileName, DiagSpelling, DiagOption, DiagCat;
 unsigned line, column, offset;
-const char *DiagOptionStr = 0, *DiagCatStr = 0;
+const char *FileNameStr = 0, *DiagOptionStr = 0, *DiagCatStr = 0;
 
 D = clang_getDiagnosticInSet(Diags, i);
 DiagLoc = clang_getDiagnosticLocation(D);
 clang_getExpansionLocation(DiagLoc, , , , );
 FileName = clang_getFileName(File);
+FileNameStr = clang_getCString(FileName);
 DiagSpelling = clang_getDiagnosticSpelling(D);
-
+
 printIndent(indent);
 
 fprintf(stderr, "%s:%d:%d: %s: %s",
-clang_getCString(FileName),
+FileNameStr ? FileNameStr : "(null)",
 line,
 column,
 getSeverityString(clang_getDiagnosticSeverity(D)),


Index: cfe/trunk/tools/c-index-test/c-index-test.c
===
--- cfe/trunk/tools/c-index-test/c-index-test.c
+++ cfe/trunk/tools/c-index-test/c-index-test.c
@@ -1053,7 +1053,8 @@
 if (Cursor.kind == CXCursor_InclusionDirective) {
   CXFile File = clang_getIncludedFile(Cursor);
   CXString Included = clang_getFileName(File);
-  printf(" (%s)", clang_getCString(Included));
+  const char *IncludedString = clang_getCString(Included);
+  printf(" (%s)", IncludedString ? IncludedString : "(null)");
   clang_disposeString(Included);
   
   if (clang_isFileMultipleIncludeGuarded(TU, File))
@@ -4644,18 +4645,19 @@
 CXFile File;
 CXString FileName, DiagSpelling, DiagOption, DiagCat;
 unsigned line, column, offset;
-const char *DiagOptionStr = 0, *DiagCatStr = 0;
+const char *FileNameStr = 0, *DiagOptionStr = 0, *DiagCatStr = 0;
 
 D = clang_getDiagnosticInSet(Diags, i);
 DiagLoc = clang_getDiagnosticLocation(D);
 clang_getExpansionLocation(DiagLoc, , , , );
 FileName = clang_getFileName(File);
+FileNameStr = clang_getCString(FileName);
 DiagSpelling = clang_getDiagnosticSpelling(D);
-
+
 printIndent(indent);
 
 fprintf(stderr, "%s:%d:%d: %s: %s",
-clang_getCString(FileName),
+FileNameStr ? FileNameStr : "(null)",
 line,
 column,
 getSeverityString(clang_getDiagnosticSeverity(D)),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-06-20 Thread Xing Xue via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363939: AIX system headers need stdint.h and inttypes.h to 
be re-enterable (authored by xingxue, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D59253?vs=202734=205822#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D59253

Files:
  cfe/trunk/lib/Headers/inttypes.h
  cfe/trunk/lib/Headers/stdint.h
  libcxx/trunk/include/inttypes.h
  libcxx/trunk/include/stdint.h
  libcxx/trunk/test/std/depr/depr.c.headers/stdint_h.sh.cpp

Index: cfe/trunk/lib/Headers/inttypes.h
===
--- cfe/trunk/lib/Headers/inttypes.h
+++ cfe/trunk/lib/Headers/inttypes.h
@@ -7,7 +7,12 @@
 \*===--===*/
 
 #ifndef __CLANG_INTTYPES_H
+// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T
+// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
+// case the header guard macro is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define __CLANG_INTTYPES_H
+#endif
 
 #if defined(_MSC_VER) && _MSC_VER < 1800
 #error MSVC does not have inttypes.h prior to Visual Studio 2013
Index: cfe/trunk/lib/Headers/stdint.h
===
--- cfe/trunk/lib/Headers/stdint.h
+++ cfe/trunk/lib/Headers/stdint.h
@@ -7,7 +7,12 @@
 \*===--===*/
 
 #ifndef __CLANG_STDINT_H
+// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T
+// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
+// case the header guard macro is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T) || !defined(__STDC_HOSTED__)
 #define __CLANG_STDINT_H
+#endif
 
 /* If we're hosted, fall back to the system's stdint.h, which might have
  * additional definitions.
Index: libcxx/trunk/include/stdint.h
===
--- libcxx/trunk/include/stdint.h
+++ libcxx/trunk/include/stdint.h
@@ -8,7 +8,12 @@
 //===--===//
 
 #ifndef _LIBCPP_STDINT_H
+// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T
+// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
+// case the header guard macro is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define _LIBCPP_STDINT_H
+#endif // _STD_TYPES_T
 
 /*
 stdint.h synopsis
Index: libcxx/trunk/include/inttypes.h
===
--- libcxx/trunk/include/inttypes.h
+++ libcxx/trunk/include/inttypes.h
@@ -8,7 +8,12 @@
 //===--===//
 
 #ifndef _LIBCPP_INTTYPES_H
+// AIX system headers need inttypes.h to be re-enterable while _STD_TYPES_T
+// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
+// case the header guard macro is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define _LIBCPP_INTTYPES_H
+#endif // _STD_TYPES_T
 
 /*
 inttypes.h synopsis
Index: libcxx/trunk/test/std/depr/depr.c.headers/stdint_h.sh.cpp
===
--- libcxx/trunk/test/std/depr/depr.c.headers/stdint_h.sh.cpp
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdint_h.sh.cpp
@@ -0,0 +1,268 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// AIX system headers need stdint.h to be re-enterable when macro _STD_TYPES_T
+// is defined. This test case tests that after including sys/types.h which
+// defines macro _STD_TYPES_T, includes stdint.h, and then undefines
+// _STD_TYPES_T, stdint.h can be entered to get to macros like UINT32_MAX.
+//
+// REQUIRES: aix
+// RUN: %compile -c
+// RUN: %compile -c -D_XOPEN_SOURCE=700
+
+// test 
+//
+// Test that limits macros are available when  is included with
+// or without macro _XOPEN_SOURCE=700.
+
+#include 
+#include 
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error 

[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-06-11 Thread Xing Xue via Phabricator via cfe-commits
xingxue added a comment.

Hi @mclow.lists, Do you have any further comments?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59253



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63041: [PlistSupport] Produce a newline to end plist output files

2019-06-10 Thread Xing Xue via Phabricator via cfe-commits
xingxue accepted this revision.
xingxue added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63041



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-06-03 Thread Xing Xue via Phabricator via cfe-commits
xingxue updated this revision to Diff 202734.
xingxue added a comment.

Addressed comments:

- Fixed typo _XOPEN_SOUECE->_XOPEN_SOURCE


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59253

Files:
  clang/lib/Headers/inttypes.h
  clang/lib/Headers/stdint.h
  libcxx/include/inttypes.h
  libcxx/include/stdint.h
  libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp

Index: libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
===
--- /dev/null
+++ libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
@@ -0,0 +1,268 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// AIX system headers need stdint.h to be re-enterable when macro _STD_TYPES_T
+// is defined. This test case tests that after including sys/types.h which
+// defines macro _STD_TYPES_T, includes stdint.h, and then undefines
+// _STD_TYPES_T, stdint.h can be entered to get to macros like UINT32_MAX.
+//
+// REQUIRES: aix
+// RUN: %compile -c
+// RUN: %compile -c -D_XOPEN_SOURCE=700
+
+// test 
+//
+// Test that limits macros are available when  is included with
+// or without macro _XOPEN_SOURCE=700.
+
+#include 
+#include 
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined

[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-06-03 Thread Xing Xue via Phabricator via cfe-commits
xingxue marked 2 inline comments as done.
xingxue added inline comments.



Comment at: libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp:21
+// Test that limits macros are available when  is included with
+// or without macro _XOPEN_SOUECE=700.
+

hubert.reinterpretcast wrote:
> Typo:
> s/_XOPEN_SOUECE/_XOPEN_SOURCE/;
Good catch!  Fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59253



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-05-28 Thread Xing Xue via Phabricator via cfe-commits
xingxue marked an inline comment as done.
xingxue added inline comments.



Comment at: libcxx/include/stdint.h:16
+#endif // _STD_TYPES_T
 
 /*

hubert.reinterpretcast wrote:
> mclow.lists wrote:
> > I don't think that this will do what you want it to.
> > Is this a supported use case?
> > 
> > ```
> > #include 
> > #define _STD_TYPES_T
> > #include 
> > ```
> > 
> > 
> The comment is perhaps not clear. We need `` to be re-enterable 
> only as long as all previous inclusions have occurred while `_STD_TYPES_T` is 
> defined. The effect of including `` without defining `_STD_TYPES_T` 
> is a strict superset of the effects of including `` in other 
> circumstances. Should we adjust the comment?
Updated comments as suggested. This patch helps scenarios such as the following 
on `AIX`.

 #include 
 #include 

where ``  included in the first line defines macro `_STD_TYPES_T`, 
includes ``, and then undefines `_STD_TYPES_T`. `` included 
in the second line can be entered to get to macros such as `UINT32_MAX`. Since 
`_STD_TYPES_T` is undefined with the second inclusion, the header guard macro 
is defined and `` is no longer re-enterable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59253



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-05-28 Thread Xing Xue via Phabricator via cfe-commits
xingxue updated this revision to Diff 201746.
xingxue added a comment.

Updated comments explaining the scenario of the changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59253

Files:
  clang/lib/Headers/inttypes.h
  clang/lib/Headers/stdint.h
  libcxx/include/inttypes.h
  libcxx/include/stdint.h
  libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp

Index: libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
===
--- /dev/null
+++ libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
@@ -0,0 +1,268 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// AIX system headers need stdint.h to be re-enterable when macro _STD_TYPES_T
+// is defined. This test case tests that after including sys/types.h which
+// defines macro _STD_TYPES_T, includes stdint.h, and then undefines
+// _STD_TYPES_T, stdint.h can be entered to get to macros like UINT32_MAX.
+//
+// REQUIRES: aix
+// RUN: %compile -c
+// RUN: %compile -c -D_XOPEN_SOURCE=700
+
+// test 
+//
+// Test that limits macros are available when  is included with
+// or without macro _XOPEN_SOUECE=700.
+
+#include 
+#include 
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined
+#endif
+

[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-05-23 Thread Xing Xue via Phabricator via cfe-commits
xingxue updated this revision to Diff 200967.
xingxue added a comment.
Herald added subscribers: jsji, jfb.

Added test case `stdint_h.sh.cpp`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59253

Files:
  clang/lib/Headers/inttypes.h
  clang/lib/Headers/stdint.h
  libcxx/include/inttypes.h
  libcxx/include/stdint.h
  libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp

Index: libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
===
--- /dev/null
+++ libcxx/test/std/depr/depr.c.headers/stdint_h.sh.cpp
@@ -0,0 +1,268 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// AIX system headers need stdint.h to be re-enterable when macro _STD_TYPES_T
+// is defined. This test case tests that after including sys/types.h which
+// defines macro _STD_TYPES_T, includes stdint.h, and then undefines
+// _STD_TYPES_T, stdint.h can be entered to get to macros like UINT32_MAX.
+//
+// REQUIRES: aix
+// RUN: %compile -c
+// RUN: %compile -c -D_XOPEN_SOURCE=700
+
+// test 
+//
+// Test that limits macros are available when  is included with
+// or without macro _XOPEN_SOUECE=700.
+
+#include 
+#include 
+
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not 

[PATCH] D61530: Add AIX Version Macros

2019-05-16 Thread Xing Xue via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC360900: Add AIX Version Macros (authored by xingxue, 
committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61530?vs=198056=199825#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D61530

Files:
  lib/Basic/Targets/OSTargets.h
  test/Preprocessor/init.c

Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -7243,6 +7243,129 @@
 // PPC-AIX:#define __powerpc__ 1
 // PPC-AIX:#define __ppc__ 1
 //
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.2.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX72 %s
+//
+// PPC-AIX72:#define _AIX32 1
+// PPC-AIX72:#define _AIX41 1
+// PPC-AIX72:#define _AIX43 1
+// PPC-AIX72:#define _AIX50 1
+// PPC-AIX72:#define _AIX51 1
+// PPC-AIX72:#define _AIX52 1
+// PPC-AIX72:#define _AIX53 1
+// PPC-AIX72:#define _AIX61 1
+// PPC-AIX72:#define _AIX71 1
+// PPC-AIX72:#define _AIX72 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix7.1.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX71 %s
+//
+// PPC-AIX71:#define _AIX32 1
+// PPC-AIX71:#define _AIX41 1
+// PPC-AIX71:#define _AIX43 1
+// PPC-AIX71:#define _AIX50 1
+// PPC-AIX71:#define _AIX51 1
+// PPC-AIX71:#define _AIX52 1
+// PPC-AIX71:#define _AIX53 1
+// PPC-AIX71:#define _AIX61 1
+// PPC-AIX71:#define _AIX71 1
+// PPC-AIX71-NOT:#define _AIX72 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix6.1.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX61 %s
+//
+// PPC-AIX61:#define _AIX32 1
+// PPC-AIX61:#define _AIX41 1
+// PPC-AIX61:#define _AIX43 1
+// PPC-AIX61:#define _AIX50 1
+// PPC-AIX61:#define _AIX51 1
+// PPC-AIX61:#define _AIX52 1
+// PPC-AIX61:#define _AIX53 1
+// PPC-AIX61:#define _AIX61 1
+// PPC-AIX61-NOT:#define _AIX71 1
+// PPC-AIX61-NOT:#define _AIX72 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix5.3.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX53 %s
+// PPC-AIX53:#define _AIX32 1
+// PPC-AIX53:#define _AIX41 1
+// PPC-AIX53:#define _AIX43 1
+// PPC-AIX53:#define _AIX50 1
+// PPC-AIX53:#define _AIX51 1
+// PPC-AIX53:#define _AIX52 1
+// PPC-AIX53:#define _AIX53 1
+// PPC-AIX53-NOT:#define _AIX61 1
+// PPC-AIX53-NOT:#define _AIX71 1
+// PPC-AIX53-NOT:#define _AIX72 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix5.2.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX52 %s
+// PPC-AIX52:#define _AIX32 1
+// PPC-AIX52:#define _AIX41 1
+// PPC-AIX52:#define _AIX43 1
+// PPC-AIX52:#define _AIX50 1
+// PPC-AIX52:#define _AIX51 1
+// PPC-AIX52:#define _AIX52 1
+// PPC-AIX52-NOT:#define _AIX53 1
+// PPC-AIX52-NOT:#define _AIX61 1
+// PPC-AIX52-NOT:#define _AIX71 1
+// PPC-AIX52-NOT:#define _AIX72 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix5.1.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX51 %s
+// PPC-AIX51:#define _AIX32 1
+// PPC-AIX51:#define _AIX41 1
+// PPC-AIX51:#define _AIX43 1
+// PPC-AIX51:#define _AIX50 1
+// PPC-AIX51:#define _AIX51 1
+// PPC-AIX51-NOT:#define _AIX52 1
+// PPC-AIX51-NOT:#define _AIX53 1
+// PPC-AIX51-NOT:#define _AIX61 1
+// PPC-AIX51-NOT:#define _AIX71 1
+// PPC-AIX51-NOT:#define _AIX72 1
+//
+//RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix5.0.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX50 %s
+// PPC-AIX50:#define _AIX32 1
+// PPC-AIX50:#define _AIX41 1
+// PPC-AIX50:#define _AIX43 1
+// PPC-AIX50:#define _AIX50 1
+// PPC-AIX50-NOT:#define _AIX51 1
+// PPC-AIX50-NOT:#define _AIX52 1
+// PPC-AIX50-NOT:#define _AIX53 1
+// PPC-AIX50-NOT:#define _AIX61 1
+// PPC-AIX50-NOT:#define _AIX71 1
+// PPC-AIX50-NOT:#define _AIX72 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix4.3.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX43 %s
+// PPC-AIX43:#define _AIX32 1
+// PPC-AIX43:#define _AIX41 1
+// PPC-AIX43:#define _AIX43 1
+// PPC-AIX43-NOT:#define _AIX50 1
+// PPC-AIX43-NOT:#define _AIX51 1
+// PPC-AIX43-NOT:#define _AIX52 1
+// PPC-AIX43-NOT:#define _AIX53 1
+// PPC-AIX43-NOT:#define _AIX61 1
+// PPC-AIX43-NOT:#define _AIX71 1
+// PPC-AIX43-NOT:#define _AIX72 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-ibm-aix4.1.0.0 < /dev/null | FileCheck -match-full-lines -check-prefix PPC-AIX41 %s
+// PPC-AIX41:#define _AIX32 1
+// PPC-AIX41:#define _AIX41 1
+// PPC-AIX41-NOT:#define _AIX43 1
+// PPC-AIX41-NOT:#define _AIX50 1
+// PPC-AIX41-NOT:#define _AIX51 1
+// PPC-AIX41-NOT:#define _AIX52 1
+// PPC-AIX41-NOT:#define _AIX53 1
+// PPC-AIX41-NOT:#define _AIX61 1
+// PPC-AIX41-NOT:#define _AIX71 1
+// PPC-AIX41-NOT:#define _AIX72 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding 

[PATCH] D59741: [lit] Set shlibpath_var on AIX

2019-03-27 Thread Xing Xue via Phabricator via cfe-commits
xingxue accepted this revision.
xingxue added a comment.
This revision is now accepted and ready to land.

LGTM.  Thanks!


Repository:
  rC Clang

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

https://reviews.llvm.org/D59741



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59233: libclang/CIndexer.cpp: Use loadquery() on AIX for path to library

2019-03-15 Thread Xing Xue via Phabricator via cfe-commits
xingxue accepted this revision.
xingxue added a comment.
This revision is now accepted and ready to land.

LGTM.  Thanks!


Repository:
  rC Clang

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

https://reviews.llvm.org/D59233



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59253: [AIX][libcxx] AIX system headers need stdint.h and inttypes.h to be re-enterable when macro _STD_TYPES_T is defined

2019-03-12 Thread Xing Xue via Phabricator via cfe-commits
xingxue created this revision.
xingxue added reviewers: hubert.reinterpretcast, jasonliu, mclow.lists.
xingxue added a project: LLVM.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, cfe-commits, christof.
Herald added projects: clang, libc++.

AIX system headers need stdint.h and inttypes.h to be re-enterable when macro 
_STD_TYPES_T is defined so that limit macro definitions such as UINT32_MAX can 
be found.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59253

Files:
  clang/lib/Headers/inttypes.h
  clang/lib/Headers/stdint.h
  libcxx/include/inttypes.h
  libcxx/include/stdint.h


Index: libcxx/include/stdint.h
===
--- libcxx/include/stdint.h
+++ libcxx/include/stdint.h
@@ -8,7 +8,11 @@
 
//===--===//
 
 #ifndef _LIBCPP_STDINT_H
+// AIX system headers need stdint.h to be re-enterable if _STD_TYPES_T
+// is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define _LIBCPP_STDINT_H
+#endif // _STD_TYPES_T
 
 /*
 stdint.h synopsis
Index: libcxx/include/inttypes.h
===
--- libcxx/include/inttypes.h
+++ libcxx/include/inttypes.h
@@ -8,7 +8,11 @@
 
//===--===//
 
 #ifndef _LIBCPP_INTTYPES_H
+// AIX system headers need inttypes.h to be re-enterable if _STD_TYPES_T
+// is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define _LIBCPP_INTTYPES_H
+#endif // _STD_TYPES_T
 
 /*
 inttypes.h synopsis
Index: clang/lib/Headers/stdint.h
===
--- clang/lib/Headers/stdint.h
+++ clang/lib/Headers/stdint.h
@@ -23,7 +23,11 @@
 
\*===--===*/
 
 #ifndef __CLANG_STDINT_H
+// AIX system headers need stdint.h to be re-enterable if _STD_TYPES_T
+// is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T) || !defined(__STDC_HOSTED__)
 #define __CLANG_STDINT_H
+#endif
 
 /* If we're hosted, fall back to the system's stdint.h, which might have
  * additional definitions.
Index: clang/lib/Headers/inttypes.h
===
--- clang/lib/Headers/inttypes.h
+++ clang/lib/Headers/inttypes.h
@@ -21,7 +21,11 @@
 
\*===--===*/
 
 #ifndef __CLANG_INTTYPES_H
+// AIX system headers need stdint.h to be re-enterable if _STD_TYPES_T
+// is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define __CLANG_INTTYPES_H
+#endif
 
 #if defined(_MSC_VER) && _MSC_VER < 1800
 #error MSVC does not have inttypes.h prior to Visual Studio 2013


Index: libcxx/include/stdint.h
===
--- libcxx/include/stdint.h
+++ libcxx/include/stdint.h
@@ -8,7 +8,11 @@
 //===--===//
 
 #ifndef _LIBCPP_STDINT_H
+// AIX system headers need stdint.h to be re-enterable if _STD_TYPES_T
+// is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define _LIBCPP_STDINT_H
+#endif // _STD_TYPES_T
 
 /*
 stdint.h synopsis
Index: libcxx/include/inttypes.h
===
--- libcxx/include/inttypes.h
+++ libcxx/include/inttypes.h
@@ -8,7 +8,11 @@
 //===--===//
 
 #ifndef _LIBCPP_INTTYPES_H
+// AIX system headers need inttypes.h to be re-enterable if _STD_TYPES_T
+// is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define _LIBCPP_INTTYPES_H
+#endif // _STD_TYPES_T
 
 /*
 inttypes.h synopsis
Index: clang/lib/Headers/stdint.h
===
--- clang/lib/Headers/stdint.h
+++ clang/lib/Headers/stdint.h
@@ -23,7 +23,11 @@
 \*===--===*/
 
 #ifndef __CLANG_STDINT_H
+// AIX system headers need stdint.h to be re-enterable if _STD_TYPES_T
+// is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T) || !defined(__STDC_HOSTED__)
 #define __CLANG_STDINT_H
+#endif
 
 /* If we're hosted, fall back to the system's stdint.h, which might have
  * additional definitions.
Index: clang/lib/Headers/inttypes.h
===
--- clang/lib/Headers/inttypes.h
+++ clang/lib/Headers/inttypes.h
@@ -21,7 +21,11 @@
 \*===--===*/
 
 #ifndef __CLANG_INTTYPES_H
+// AIX system headers need stdint.h to be re-enterable if _STD_TYPES_T
+// is defined.
+#if !defined(_AIX) || !defined(_STD_TYPES_T)
 #define __CLANG_INTTYPES_H
+#endif
 
 #if defined(_MSC_VER) && _MSC_VER < 1800
 #error MSVC does not have inttypes.h prior to Visual Studio