[PATCH] D103386: [PowerPC] Fix x86 vector intrinsics wrapper compilation under C++

Qiu Chaofan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 7 01:50:16 PDT 2021


qiucf added inline comments.


================
Comment at: clang/test/CodeGen/ppc-xmmintrin.c:10
 // RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
+// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
+// RUN:   -fno-discard-value-names -mllvm -disable-llvm-optzns
----------------
bjope wrote:
> qiucf wrote:
> > bjope wrote:
> > > Unfortunately I get some failures with this. Maybe because of an unstandard build setup.
> > > 
> > > We've started to use `-DCLANG_DEFAULT_RTLIB=compiler-rt -DCLANG_DEFAULT_CXX_STDLIB=libc++` when building clang. And we also use `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON`. Not sure if that is a setup that is asking for trouble. Anyway, when running this test case we end up with
> > > 
> > > ```
> > > : 'RUN: at line 10';   /workspace/llvm/build/bin/clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS /workspace/clang/test/CodeGen/ppc-xmmintrin.c    -fno-discard-value-names -mllvm -disable-llvm-optzns
> > > --
> > > Exit Code: 1
> > > 
> > > Command Output (stderr):
> > > --
> > > In file included from /workspace/clang/test/CodeGen/ppc-xmmintrin.c:13:
> > > In file included from /workspace/llvm/build/lib/clang/13.0.0/include/ppc_wrappers/xmmintrin.h:42:
> > > In file included from /workspace/llvm/build/lib/clang/13.0.0/include/altivec.h:44:
> > > In file included from /workspace/llvm/build/bin/../include/c++/v1/stddef.h:39:
> > > /workspace/llvm/build/bin/../include/c++/v1/__config:13:10: fatal error: '__config_site' file not found
> > > #include <__config_site>
> > >          ^~~~~~~~~~~~~~~
> > > 1 error generated.
> > > ```
> > > 
> > > Not sure really how to solve that.
> > > 
> > > Maybe we should stop building like that?
> > > 
> > > Or there is a bug somewhere (such as that we only get the __config_site headers in target specific dirs for targets that we actually build runtimes for, maybe something that was missing in https://reviews.llvm.org/D97572)?
> > > (Maybe @phosek  could comment on that?)
> > > 
> > > Or this test case is missing some options to make it a bit more independent on the runtimes build setup?
> > > 
> > The tests relies on some system stuff. Is the failure related to this change? (or exposed by `-x c++` option?)
> Well, i guess it was exposed by `-x c++` (in combination with D975729).
> 
> I don't really understand how things are supposed to work given the pre-target specific `__config_site`.
> 
> Since I only build libcxx for `x86_64-unknown-linux-gnu`, I only get a `__config_site` file for that specific triple inside `bin/../include/x86_64-unknown-linux-gnu/c++/v1/__config_site` in the build result. But a test case like this one, using a different triple, ends up including `bin/../include/c++/v1/stddef.h`, that wants wants to include `<__config_site>`, but it won't find any such include for the powerpc64le-unknown-linux-gnu triple.
Hi, I tried a build with `libcxx` enabled on ppc64le, by default it still looks for `stddef.h` inside `lib/clang/13.0.0/include`. If I specify `-isystem include/c++/v1`, the error won't happen because `__config_site` is there.

I didn't try `-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON` since that makes build complaining `bin/clang-tblgen: error while loading shared libraries: libc++.so.1: cannot open shared object file`.

The revision is going to LLVM 12.0.1. And this failure doesn't look like a blocker, since (if I understand correctly) even without this patch, a simple test also triggers that in the condition you provided.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103386



More information about the cfe-commits mailing list