[PATCH] D155192: [clang] scan-view: Remove unused python import

2023-07-18 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1be4db73642f: [clang] scan-view: Remove unused python import 
(authored by tuliom).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155192

Files:
  clang/tools/scan-view/bin/scan-view


Index: clang/tools/scan-view/bin/scan-view
===
--- clang/tools/scan-view/bin/scan-view
+++ clang/tools/scan-view/bin/scan-view
@@ -6,7 +6,6 @@
 """
 
 import sys
-import imp
 import os
 import posixpath
 import threading


Index: clang/tools/scan-view/bin/scan-view
===
--- clang/tools/scan-view/bin/scan-view
+++ clang/tools/scan-view/bin/scan-view
@@ -6,7 +6,6 @@
 """
 
 import sys
-import imp
 import os
 import posixpath
 import threading
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D158065: [PowerPC] Implement builtin for mffsl

2023-08-16 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom accepted this revision.
tuliom added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158065

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


[PATCH] D158066: [PowerPC] Fix use of FPSCR builtins in smmintrin.h

2023-08-16 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom added a comment.

Are there any plans to align the names of these built-ins with GCC? Their 
built-ins do not have the `_ppc` part.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158066

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


[PATCH] D159115: [clang-repl] Adapt to the recent dylib-related changes in ORC.

2023-09-08 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom added a comment.

In D159115#4640388 , @mgorny wrote:

> I'm sorry, by "new" you mean the version with `uintptr_t` or the original as 
> well?

Both with `uintptr_t` as well as `unsigned long long`.

In D159115#4641721 , @mgorny wrote:

> I've tested right now (as of 3398744a6106c83993611bd3c5e79ec6b94417dc 
> ) and 
> all clang tests passed for me on Gentoo/ppc64le.

Did Gentoo switch the default long double to IEEE 128-bit floating point?
If not, that could explain why this new code is broken on ppc64le.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159115

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


[PATCH] D159115: [clang-repl] Adapt to the recent dylib-related changes in ORC.

2023-09-08 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom added a comment.

Let me elaborate my previous comment...
I'm using Fedora, which has switched the default long double on ppc64le to IEEE 
128-bit floating point.
glibc provides 2 printf implementations on ppc64le (different symbols). The 
headers control which implementation is used.

I wonder if the Jit is taking the right symbol.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159115

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


[PATCH] D159115: [clang-repl] Adapt to the recent dylib-related changes in ORC.

2023-09-08 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom added a comment.

In D159115#4641834 , @mgorny wrote:

> Is that actually a regression, or merely the test wasn't checking it before?

I can't tell because the test didn't exist before.

> My educated guess would be that the code in the test redefines `printf` 
> without the header mangling, so it finds and compares the "non-IEEE" symbol 
> against the "IEEE" symbol that's exposed to the test case via the headers.

I agree with you.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159115

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


[PATCH] D155192: [clang] scan-view: Remove unused python import

2023-07-13 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom created this revision.
tuliom added a reviewer: clang.
tuliom added a project: clang.
Herald added a project: All.
tuliom requested review of this revision.
Herald added a subscriber: cfe-commits.

[clang] scan-view: Remove unused python import

Python's module imp is not being used and is not available on Python
3.12 anymore.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155192

Files:
  clang/tools/scan-view/bin/scan-view


Index: clang/tools/scan-view/bin/scan-view
===
--- clang/tools/scan-view/bin/scan-view
+++ clang/tools/scan-view/bin/scan-view
@@ -6,7 +6,6 @@
 """
 
 import sys
-import imp
 import os
 import posixpath
 import threading


Index: clang/tools/scan-view/bin/scan-view
===
--- clang/tools/scan-view/bin/scan-view
+++ clang/tools/scan-view/bin/scan-view
@@ -6,7 +6,6 @@
 """
 
 import sys
-import imp
 import os
 import posixpath
 import threading
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D159115: [clang-repl] Adapt to the recent dylib-related changes in ORC.

2023-09-06 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom added a comment.

This new test does not work on ppc64le.
The returned addresses are different:

  Expected equality of these values:
(uintptr_t)&printf
  Which is: 140735424286016
Addr->getValue()
  Which is: 140735424167152


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159115

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


[PATCH] D152570: [clang] Apply -fmacro-prefix-map to anonymous tags in template arguments

2023-06-19 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom added inline comments.



Comment at: clang/test/CodeGenCXX/macro-prefix-map-lambda.cpp:11
+  auto *s = lambdatest([](){});
+// CHECK: @"__PRETTY_FUNCTION__._Z10lambdatestIZ4mainE3$_0EDaOT_" = private 
unnamed_addr constant [{{[0-9]+}} x i8] c"auto lambdatest(f &&) [f = (lambda at 
./UNLIKELY_PATH/empty{{/|}}{{.*}}.cpp:[[#@LINE-1]]:24)]\00", align 1
+

zixuan-wu wrote:
> Hi, it's weird that the align in CSKY target is not 1, instead it's 4. 
> Anybody know the key point?
And on SystemZ it's 2.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152570

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


[PATCH] D143736: [PowerPC] Specify the dynamic loader prefix in ppc-float-abi-warning

2023-02-10 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom created this revision.
tuliom added a reviewer: qiucf.
Herald added subscribers: shchenz, kbarton, nemanjai.
Herald added a project: All.
tuliom requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Ensure the tests do not fail during cross compilation by specifying
the dynamic loader prefix for a GNU installation that is expected to
support IEEE 128-bit long double.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143736

Files:
  clang/test/Driver/ppc-float-abi-warning.cpp


Index: clang/test/Driver/ppc-float-abi-warning.cpp
===
--- clang/test/Driver/ppc-float-abi-warning.cpp
+++ clang/test/Driver/ppc-float-abi-warning.cpp
@@ -17,10 +17,12 @@
 // RUN:  -mabi=ieeelongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
 // RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  --dyld-prefix=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-12 \
 // RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ieeelongdouble%} \
 // RUN:  %else %{ibmlongdouble%} -stdlib=libc++ 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
 // RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  --dyld-prefix=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-12 \
 // RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ibmlongdouble%} \
 // RUN:  %else %{ieeelongdouble%} -stdlib=libc++ 2>&1 | FileCheck %s
 


Index: clang/test/Driver/ppc-float-abi-warning.cpp
===
--- clang/test/Driver/ppc-float-abi-warning.cpp
+++ clang/test/Driver/ppc-float-abi-warning.cpp
@@ -17,10 +17,12 @@
 // RUN:  -mabi=ieeelongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
 // RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  --dyld-prefix=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-12 \
 // RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ieeelongdouble%} \
 // RUN:  %else %{ibmlongdouble%} -stdlib=libc++ 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
 // RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  --dyld-prefix=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-12 \
 // RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ibmlongdouble%} \
 // RUN:  %else %{ieeelongdouble%} -stdlib=libc++ 2>&1 | FileCheck %s
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143736: [PowerPC] Specify the dynamic loader prefix in ppc-float-abi-warning

2023-02-13 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom added a comment.

@qiucf Thanks! I still don't have commit access yet. Could you land this patch 
for me, please?
Please use “Tulio Magno Quites Machado Filho tul...@redhat.com” to commit the 
change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143736

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


[PATCH] D150087: [Clang] Support more stdio builtins

2023-05-08 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom requested changes to this revision.
tuliom added inline comments.
This revision now requires changes to proceed.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:109
+  {Builtin::BI__builtin___vsnprintf_chk, "__vsnprintfieee128"},
+  {Builtin::BI__builtin___vsprintf_chk, "__vsprintfieee128"},
+  {Builtin::BI__builtin_fprintf, "__fprintfieee128"},

Any reasons to not map these built-ins to their respective `_chkieee128` 
counterparts? e.g. `__fprintf_chkieee128`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150087

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


[PATCH] D150087: [Clang] Support more stdio builtins

2023-05-18 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom accepted this revision.
tuliom added a comment.
This revision is now accepted and ready to land.

LGTM.
Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150087

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


[PATCH] D149633: [clang][codegen] Add F128 vsnprintf_chk builtin

2023-05-02 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom requested changes to this revision.
tuliom added a comment.
This revision now requires changes to proceed.

@tbaeder Keep in mind that I don't think this will completely fix issue 61913 
because there are other 2 functions affected.
Otherwise, I believe this patch is in the right direction.




Comment at: clang/lib/CodeGen/CGBuiltin.cpp:104
   {Builtin::BI__builtin_printf, "__printfieee128"},
+  {Builtin::BI__builtin___vsnprintf_chk, "__vsnprintfieee128"},
   {Builtin::BI__builtin_vsnprintf, "__vsnprintfieee128"},

I believe this should be redirected to `__vsnprintf_chkieee128`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149633

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


[PATCH] D139450: Warn about unsupported ibmlongdouble

2022-12-06 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom created this revision.
tuliom added projects: clang, PowerPC.
Herald added a subscriber: kbarton.
Herald added a project: All.
tuliom requested review of this revision.
Herald added a subscriber: MaskRay.

When -mabi=ieeelongdouble is enabled by default, libc++ does not support
-mabi=ibmlongdouble.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139450

Files:
  clang/lib/Driver/ToolChains/PPCLinux.cpp
  clang/lib/Driver/ToolChains/PPCLinux.h
  clang/test/Driver/lit.local.cfg
  clang/test/Driver/ppc-float-abi-warning.cpp
  clang/test/lit.site.cfg.py.in

Index: clang/test/lit.site.cfg.py.in
===
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -38,6 +38,7 @@
 config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
 config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
 config.standalone_build = @CLANG_BUILT_STANDALONE@
+config.ppc_linux_default_ieeelongdouble = "@PPC_LINUX_DEFAULT_IEEELONGDOUBLE@"
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)
Index: clang/test/Driver/ppc-float-abi-warning.cpp
===
--- clang/test/Driver/ppc-float-abi-warning.cpp
+++ clang/test/Driver/ppc-float-abi-warning.cpp
@@ -7,12 +7,23 @@
 // RUN:  --dyld-prefix=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-12 \
 // RUN:  -mabi=ieeelongdouble -stdlib=libstdc++ 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
-// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s \
-// RUN:  -mabi=ieeelongdouble -stdlib=libc++ 2>&1 | FileCheck %s
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -stdlib=libc++ 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=ibmlongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
 // RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
 // RUN:  -mabi=ieeelongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ieeelongdouble%} \
+// RUN:  %else %{ibmlongdouble%} -stdlib=libc++ 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ibmlongdouble%} \
+// RUN:  %else %{ieeelongdouble%} -stdlib=libc++ 2>&1 | FileCheck %s
 
-// CHECK: warning: float ABI 'ieeelongdouble' is not supported by current library
-// NOWARN-NOT: warning: float ABI 'ieeelongdouble' is not supported by current library
+// CHECK: warning: float ABI '{{.*}}' is not supported by current library
+// NOWARN-NOT: warning: float ABI '{{.*}}' is not supported by current library
 long double foo(long double x) { return x; }
Index: clang/test/Driver/lit.local.cfg
===
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -21,3 +21,6 @@
 
 if llvm_config.use_lld(required=False):
 config.available_features.add('lld')
+
+if config.ppc_linux_default_ieeelongdouble == "ON":
+  config.available_features.add('ppc_linux_default_ieeelongdouble')
Index: clang/lib/Driver/ToolChains/PPCLinux.h
===
--- clang/lib/Driver/ToolChains/PPCLinux.h
+++ clang/lib/Driver/ToolChains/PPCLinux.h
@@ -27,6 +27,8 @@
 private:
   bool SupportIEEEFloat128(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args) const;
+  bool SupportIBMLongDouble(const Driver &D,
+const llvm::opt::ArgList &Args) const;
 };
 
 } // end namespace toolchains
Index: clang/lib/Driver/ToolChains/PPCLinux.cpp
===
--- clang/lib/Driver/ToolChains/PPCLinux.cpp
+++ clang/lib/Driver/ToolChains/PPCLinux.cpp
@@ -49,7 +49,9 @@
 : Linux(D, Triple, Args) {
   if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
 StringRef ABIName = A->getValue();
-if (ABIName == "ieeelongdouble" && !SupportIEEEFloat128(D, Triple, Args))
+
+if ((ABIName == "ieeelongdouble" && !SupportIEEEFloat128(D, Triple, Args)) ||
+(ABIName == "ibmlongdouble" && !SupportIBMLongDouble(D, Args)))
   D.Diag(diag::warn_drv_unsupported_float_abi_by_lib) << ABIName;
   }
 }
@@ -67,6 +69,19 @@
   Linux::AddClangSystemIncludeArgs(DriverArgs, CC1Args);
 }
 
+bool PPCLinuxToolChain::SupportIBMLongDouble(
+const Driver &D,
+const llvm::opt::ArgList &Args) const {
+  if (Args.hasArg(options::OPT_nostdlib, options::OPT_nostdlibxx))
+return true;
+
+  CXXStdlibType StdLib = ToolChain::GetCXXStdlibType(Args);
+  if (StdLib == CST_Libstdcxx)
+return true;
+
+  return

[PATCH] D139450: Warn about unsupported ibmlongdouble

2022-12-07 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom updated this revision to Diff 480858.
tuliom added a comment.

I'm attaching a new version of the patch.

> Can you please upload the patch with full context (-U9)?

@nikic Done!

> The assumption here is that libc++ is being compiled with a compiler that has 
> the same ieeelongdouble default as the clang that is being built, right?

@nikic Right.

> New functions should use camelCase

@MaskRay Fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139450

Files:
  clang/lib/Driver/ToolChains/PPCLinux.cpp
  clang/lib/Driver/ToolChains/PPCLinux.h
  clang/test/Driver/lit.local.cfg
  clang/test/Driver/ppc-float-abi-warning.cpp
  clang/test/lit.site.cfg.py.in

Index: clang/test/lit.site.cfg.py.in
===
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -38,6 +38,7 @@
 config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
 config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
 config.standalone_build = @CLANG_BUILT_STANDALONE@
+config.ppc_linux_default_ieeelongdouble = "@PPC_LINUX_DEFAULT_IEEELONGDOUBLE@"
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)
Index: clang/test/Driver/ppc-float-abi-warning.cpp
===
--- clang/test/Driver/ppc-float-abi-warning.cpp
+++ clang/test/Driver/ppc-float-abi-warning.cpp
@@ -7,12 +7,23 @@
 // RUN:  --dyld-prefix=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-12 \
 // RUN:  -mabi=ieeelongdouble -stdlib=libstdc++ 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
-// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s \
-// RUN:  -mabi=ieeelongdouble -stdlib=libc++ 2>&1 | FileCheck %s
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -stdlib=libc++ 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=ibmlongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
 // RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
 // RUN:  -mabi=ieeelongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ieeelongdouble%} \
+// RUN:  %else %{ibmlongdouble%} -stdlib=libc++ 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ibmlongdouble%} \
+// RUN:  %else %{ieeelongdouble%} -stdlib=libc++ 2>&1 | FileCheck %s
 
-// CHECK: warning: float ABI 'ieeelongdouble' is not supported by current library
-// NOWARN-NOT: warning: float ABI 'ieeelongdouble' is not supported by current library
+// CHECK: warning: float ABI '{{.*}}' is not supported by current library
+// NOWARN-NOT: warning: float ABI '{{.*}}' is not supported by current library
 long double foo(long double x) { return x; }
Index: clang/test/Driver/lit.local.cfg
===
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -21,3 +21,6 @@
 
 if llvm_config.use_lld(required=False):
 config.available_features.add('lld')
+
+if config.ppc_linux_default_ieeelongdouble == "ON":
+  config.available_features.add('ppc_linux_default_ieeelongdouble')
Index: clang/lib/Driver/ToolChains/PPCLinux.h
===
--- clang/lib/Driver/ToolChains/PPCLinux.h
+++ clang/lib/Driver/ToolChains/PPCLinux.h
@@ -27,6 +27,8 @@
 private:
   bool SupportIEEEFloat128(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args) const;
+  bool supportIBMLongDouble(const Driver &D,
+const llvm::opt::ArgList &Args) const;
 };
 
 } // end namespace toolchains
Index: clang/lib/Driver/ToolChains/PPCLinux.cpp
===
--- clang/lib/Driver/ToolChains/PPCLinux.cpp
+++ clang/lib/Driver/ToolChains/PPCLinux.cpp
@@ -49,7 +49,9 @@
 : Linux(D, Triple, Args) {
   if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
 StringRef ABIName = A->getValue();
-if (ABIName == "ieeelongdouble" && !SupportIEEEFloat128(D, Triple, Args))
+
+if ((ABIName == "ieeelongdouble" && !SupportIEEEFloat128(D, Triple, Args)) ||
+(ABIName == "ibmlongdouble" && !supportIBMLongDouble(D, Args)))
   D.Diag(diag::warn_drv_unsupported_float_abi_by_lib) << ABIName;
   }
 }
@@ -67,6 +69,19 @@
   Linux::AddClangSystemIncludeArgs(DriverArgs, CC1Args);
 }
 
+bool PPCLinuxToolChain::supportIBMLongDouble(
+const Driver &D,
+const llvm::opt::ArgList &Args) const {
+  if (Args.hasArg(options::OPT_n

[PATCH] D139450: Warn about unsupported ibmlongdouble

2022-12-08 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom added a comment.

In D139450#3981486 , @qiucf wrote:

> Thanks for the patch! But does libc++ support to be built with 
> `-mabi=ieeelongdouble` now?

@qiucf libc++ can be built with `-mabi=ieeelongdouble`, but it supports only a 
single long double format, i.e. if it's built with `-mabi=ieeelongdouble`, it 
won't support IBM double-double and vice versa.
This is already being used in Fedora Rawhide at the moment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139450

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


[PATCH] D139450: Warn about unsupported ibmlongdouble

2022-12-09 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom updated this revision to Diff 481730.
tuliom added a comment.

Fix the issues pointed by @nikic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139450

Files:
  clang/lib/Driver/ToolChains/PPCLinux.cpp
  clang/lib/Driver/ToolChains/PPCLinux.h
  clang/test/CMakeLists.txt
  clang/test/Driver/lit.local.cfg
  clang/test/Driver/ppc-float-abi-warning.cpp
  clang/test/lit.site.cfg.py.in

Index: clang/test/lit.site.cfg.py.in
===
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -38,6 +38,7 @@
 config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
 config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
 config.standalone_build = @CLANG_BUILT_STANDALONE@
+config.ppc_linux_default_ieeelongdouble = @PPC_LINUX_DEFAULT_IEEELONGDOUBLE@
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)
Index: clang/test/Driver/ppc-float-abi-warning.cpp
===
--- clang/test/Driver/ppc-float-abi-warning.cpp
+++ clang/test/Driver/ppc-float-abi-warning.cpp
@@ -7,12 +7,23 @@
 // RUN:  --dyld-prefix=%S/Inputs/powerpc64le-linux-gnu-tree/gcc-12 \
 // RUN:  -mabi=ieeelongdouble -stdlib=libstdc++ 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
-// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s \
-// RUN:  -mabi=ieeelongdouble -stdlib=libc++ 2>&1 | FileCheck %s
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -stdlib=libc++ 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=ibmlongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
 // RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
 // RUN:  -mabi=ieeelongdouble -stdlib=libc++ -Wno-unsupported-abi 2>&1 | \
 // RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ieeelongdouble%} \
+// RUN:  %else %{ibmlongdouble%} -stdlib=libc++ 2>&1 | \
+// RUN:  FileCheck %s --check-prefix=NOWARN
+// RUN: %clang -### --driver-mode=g++ -target powerpc64le-linux-gnu %s\
+// RUN:  -mabi=%if ppc_linux_default_ieeelongdouble %{ibmlongdouble%} \
+// RUN:  %else %{ieeelongdouble%} -stdlib=libc++ 2>&1 | FileCheck %s
 
-// CHECK: warning: float ABI 'ieeelongdouble' is not supported by current library
-// NOWARN-NOT: warning: float ABI 'ieeelongdouble' is not supported by current library
+// CHECK: warning: float ABI '{{.*}}' is not supported by current library
+// NOWARN-NOT: warning: float ABI '{{.*}}' is not supported by current library
 long double foo(long double x) { return x; }
Index: clang/test/Driver/lit.local.cfg
===
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -21,3 +21,6 @@
 
 if llvm_config.use_lld(required=False):
 config.available_features.add('lld')
+
+if config.ppc_linux_default_ieeelongdouble:
+  config.available_features.add('ppc_linux_default_ieeelongdouble')
Index: clang/test/CMakeLists.txt
===
--- clang/test/CMakeLists.txt
+++ clang/test/CMakeLists.txt
@@ -15,6 +15,7 @@
   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
   LLVM_ENABLE_THREADS
   LLVM_WITH_Z3
+  PPC_LINUX_DEFAULT_IEEELONGDOUBLE
   )
 
 configure_lit_site_cfg(
Index: clang/lib/Driver/ToolChains/PPCLinux.h
===
--- clang/lib/Driver/ToolChains/PPCLinux.h
+++ clang/lib/Driver/ToolChains/PPCLinux.h
@@ -27,6 +27,8 @@
 private:
   bool SupportIEEEFloat128(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args) const;
+  bool supportIBMLongDouble(const Driver &D,
+const llvm::opt::ArgList &Args) const;
 };
 
 } // end namespace toolchains
Index: clang/lib/Driver/ToolChains/PPCLinux.cpp
===
--- clang/lib/Driver/ToolChains/PPCLinux.cpp
+++ clang/lib/Driver/ToolChains/PPCLinux.cpp
@@ -49,7 +49,10 @@
 : Linux(D, Triple, Args) {
   if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
 StringRef ABIName = A->getValue();
-if (ABIName == "ieeelongdouble" && !SupportIEEEFloat128(D, Triple, Args))
+
+if ((ABIName == "ieeelongdouble" &&
+ !SupportIEEEFloat128(D, Triple, Args)) ||
+(ABIName == "ibmlongdouble" && !supportIBMLongDouble(D, Args)))
   D.Diag(diag::warn_drv_unsupported_float_abi_by_lib) << ABIName;
   }
 }
@@ -67,6 +70,18 @@
   Linux::AddClangSystemIncludeArgs(DriverArgs, CC1Args);
 }
 
+bool PPCLinuxToolChain::supportIBMLongDouble(
+const Driver &D, const llvm::opt::ArgList &Args) const 

[PATCH] D139450: Warn about unsupported ibmlongdouble

2022-12-09 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom marked 3 inline comments as done.
tuliom added inline comments.



Comment at: clang/lib/Driver/ToolChains/PPCLinux.cpp:74
+const Driver &D,
+const llvm::opt::ArgList &Args) const {
+  if (Args.hasArg(options::OPT_nostdlib, options::OPT_nostdlibxx))

nikic wrote:
> I don't think this formatting is right. You may find 
> clang/tools/clang-format/clang-format-diff.py helpful.
> 
> I use this script locally:
> ```
> #!/bin/sh
> git diff -U ${1:-HEAD} | clang/tools/clang-format/clang-format-diff.py -p1
> ```
> And then do something like `./clang_format_diff.sh | patch -p0` after 
> checking that it did not reformat too much.
Thanks, this pointed out 2 errors.



Comment at: clang/lib/Driver/ToolChains/PPCLinux.cpp:96
   bool HasUnsupportedCXXLib =
-  StdLib == CST_Libcxx ||
+  (StdLib == CST_Libcxx && !defaultToIEEELongDouble()) ||
   (StdLib == CST_Libstdcxx &&

qiucf wrote:
> `SupportIEEEFloat128` checks the library version:
> 
> * If using libstdc++, then libstdc++ (GCC) >= 12.1.0 is okay.
> * If using libc++, then sorry, no libc++ supports `-mabi=ieeelongdouble` now.
> * Glibc should >= 2.32
> 
> If the assumptions are still right, this changes its meaning (and 
> `supportIBMLongDouble` has different meaning from it).
@qiucf In operating systems that switched to IEEE long double by default, all 
libraries (and programs) are built with IEEE long double, including libc++.



Comment at: clang/test/Driver/lit.local.cfg:25
+
+if config.ppc_linux_default_ieeelongdouble == "ON":
+  config.available_features.add('ppc_linux_default_ieeelongdouble')

nikic wrote:
> I believe this isn't robust, because ON is not the only possible value. 
> Instead, you'll want to canonicalize the variable: 
> https://github.com/llvm/llvm-project/blob/03e6d9d9d1d48e43f3efc35eb75369b90d4510d5/clang/test/CMakeLists.txt#L4
Changed. This caused a few other modifications in the latest revision.



Comment at: clang/test/Driver/lit.local.cfg:26
+if config.ppc_linux_default_ieeelongdouble == "ON":
+  config.available_features.add('ppc_linux_default_ieeelongdouble')

qiucf wrote:
> Can we assume if we are compiling with `-mabi=ieeelongdouble`, then libc++ 
> 'must' be built with the same long double ABI? If I understand correctly, 
> they're unrelated.
@qiucf I didn't understand this part. Are you suggesting to remove the long 
double warnings because the way the compiler was built is unrelated to the way 
libc++ was built?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139450

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


[PATCH] D139450: Warn about unsupported ibmlongdouble

2022-12-13 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom marked 2 inline comments as done.
tuliom added inline comments.



Comment at: clang/test/Driver/lit.local.cfg:26
+if config.ppc_linux_default_ieeelongdouble == "ON":
+  config.available_features.add('ppc_linux_default_ieeelongdouble')

qiucf wrote:
> tuliom wrote:
> > qiucf wrote:
> > > Can we assume if we are compiling with `-mabi=ieeelongdouble`, then 
> > > libc++ 'must' be built with the same long double ABI? If I understand 
> > > correctly, they're unrelated.
> > @qiucf I didn't understand this part. Are you suggesting to remove the long 
> > double warnings because the way the compiler was built is unrelated to the 
> > way libc++ was built?
> Ah, I misunderstood meaning of 'defaults to IEEE long double' in last review. 
> We can assume 'how the compiler was built' is the same as 'how the libc++ was 
> built'.
> 
> But when 'how the libc++ was built' conflicts with 'how the compiler compiles 
> current program', we expect a warning, right? If so, this looks reasonable.
Yes, exactly.
Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139450

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


[PATCH] D139450: Warn about unsupported ibmlongdouble

2022-12-13 Thread Tulio Magno Quites Machado Filho via Phabricator via cfe-commits
tuliom marked an inline comment as done.
tuliom added a comment.

Thanks @qiucf ! I don't have commit access yet. Could you land this patch for 
me, please?
Please use “Tulio Magno Quites Machado Filho tul...@redhat.com” to commit the 
change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139450

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