From: Qiu Chaofan Date: Tue, 30 Jul 2019 02:18:11 +0000 (+0000) Subject: [PowerPC] [Clang] Add platform guards to PPC vector intrinsics headers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b02332247149a7cfaec24d9e3c72ddbbfd93b0d;p=clang [PowerPC] [Clang] Add platform guards to PPC vector intrinsics headers Move the platform check out of PPC Linux toolchain code and add platform guards to the intrinsic headers, since they are supported currently only on 64-bit PowerPC targets. Reviewed By: Jinsong Ji Differential Revision: https://reviews.llvm.org/D64849 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367281 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains/PPCLinux.cpp b/lib/Driver/ToolChains/PPCLinux.cpp index 5221e5d0e2..af2e3a21a0 100644 --- a/lib/Driver/ToolChains/PPCLinux.cpp +++ b/lib/Driver/ToolChains/PPCLinux.cpp @@ -16,10 +16,7 @@ using namespace llvm::opt; void PPCLinuxToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs, ArgStringList &CC1Args) const { - // PPC wrapper headers are implementation of x86 intrinsics on PowerPC, which - // is not supported on PPC32 platform. - if (getArch() != llvm::Triple::ppc && - !DriverArgs.hasArg(clang::driver::options::OPT_nostdinc) && + if (!DriverArgs.hasArg(clang::driver::options::OPT_nostdinc) && !DriverArgs.hasArg(options::OPT_nobuiltininc)) { const Driver &D = getDriver(); SmallString<128> P(D.ResourceDir); diff --git a/lib/Headers/ppc_wrappers/emmintrin.h b/lib/Headers/ppc_wrappers/emmintrin.h index 617ce24acd..293276cc9b 100644 --- a/lib/Headers/ppc_wrappers/emmintrin.h +++ b/lib/Headers/ppc_wrappers/emmintrin.h @@ -35,6 +35,8 @@ #ifndef EMMINTRIN_H_ #define EMMINTRIN_H_ +#if defined(__linux__) && defined(__ppc64__) + #include /* We need definitions from the SSE header files. */ @@ -2315,4 +2317,8 @@ _mm_castsi128_pd(__m128i __A) return (__m128d) __A; } +#else +#include_next +#endif /* defined(__linux__) && defined(__ppc64__) */ + #endif /* EMMINTRIN_H_ */ diff --git a/lib/Headers/ppc_wrappers/mm_malloc.h b/lib/Headers/ppc_wrappers/mm_malloc.h index d91d7865c8..24b14c8e07 100644 --- a/lib/Headers/ppc_wrappers/mm_malloc.h +++ b/lib/Headers/ppc_wrappers/mm_malloc.h @@ -10,6 +10,8 @@ #ifndef _MM_MALLOC_H_INCLUDED #define _MM_MALLOC_H_INCLUDED +#if defined(__linux__) && defined(__ppc64__) + #include /* We can't depend on since the prototype of posix_memalign @@ -41,4 +43,8 @@ _mm_free (void * ptr) free (ptr); } +#else +#include_next +#endif + #endif /* _MM_MALLOC_H_INCLUDED */ diff --git a/lib/Headers/ppc_wrappers/mmintrin.h b/lib/Headers/ppc_wrappers/mmintrin.h index b949653adf..c55c44726f 100644 --- a/lib/Headers/ppc_wrappers/mmintrin.h +++ b/lib/Headers/ppc_wrappers/mmintrin.h @@ -35,6 +35,8 @@ #ifndef _MMINTRIN_H_INCLUDED #define _MMINTRIN_H_INCLUDED +#if defined(__linux__) && defined(__ppc64__) + #include /* The Intel API is flexible enough that we must allow aliasing with other vector types, and their scalar components. */ @@ -1440,4 +1442,9 @@ extern __inline __m64 return (res.as_m64); #endif } + +#else +#include_next +#endif /* defined(__linux__) && defined(__ppc64__) */ + #endif /* _MMINTRIN_H_INCLUDED */ diff --git a/lib/Headers/ppc_wrappers/xmmintrin.h b/lib/Headers/ppc_wrappers/xmmintrin.h index 1b322b6651..0f429fa040 100644 --- a/lib/Headers/ppc_wrappers/xmmintrin.h +++ b/lib/Headers/ppc_wrappers/xmmintrin.h @@ -34,6 +34,8 @@ #ifndef _XMMINTRIN_H_INCLUDED #define _XMMINTRIN_H_INCLUDED +#if defined(__linux__) && defined(__ppc64__) + /* Define four value permute mask */ #define _MM_SHUFFLE(w,x,y,z) (((w) << 6) | ((x) << 4) | ((y) << 2) | (z)) @@ -1835,4 +1837,8 @@ do { \ /* For backward source compatibility. */ //# include +#else +#include_next +#endif /* defined(__linux__) && defined(__ppc64__) */ + #endif /* _XMMINTRIN_H_INCLUDED */