r307524 - X86 Intrinsics: _bit_scan_forward should not be under #ifdef __RDRND__
Author: zvi Date: Mon Jul 10 00:13:56 2017 New Revision: 307524 URL: http://llvm.org/viewvc/llvm-project?rev=307524&view=rev Log: X86 Intrinsics: _bit_scan_forward should not be under #ifdef __RDRND__ Summary: The _bit_scan_forward and _bit_scan_reverse intrinsics were accidentally masked under the preprocessor checks that prune intrinsics definitions for the benefit of faster compile-time on Windows. This patch moves the definitons out of that region. Fixes pr33722 Reviewers: craig.topper, aaboud, thakis Reviewed By: craig.topper Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D35184 Modified: cfe/trunk/lib/Headers/immintrin.h cfe/trunk/test/CodeGen/bitscan-builtins.c Modified: cfe/trunk/lib/Headers/immintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/immintrin.h?rev=307524&r1=307523&r2=307524&view=diff == --- cfe/trunk/lib/Headers/immintrin.h (original) +++ cfe/trunk/lib/Headers/immintrin.h Mon Jul 10 00:13:56 2017 @@ -212,6 +212,15 @@ _rdrand32_step(unsigned int *__p) return __builtin_ia32_rdrand32_step(__p); } +#ifdef __x86_64__ +static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) +_rdrand64_step(unsigned long long *__p) +{ + return __builtin_ia32_rdrand64_step(__p); +} +#endif +#endif /* __RDRND__ */ + /* __bit_scan_forward */ static __inline__ int __attribute__((__always_inline__, __nodebug__)) _bit_scan_forward(int __A) { @@ -224,15 +233,6 @@ _bit_scan_reverse(int __A) { return 31 - __builtin_clz(__A); } -#ifdef __x86_64__ -static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) -_rdrand64_step(unsigned long long *__p) -{ - return __builtin_ia32_rdrand64_step(__p); -} -#endif -#endif /* __RDRND__ */ - #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__) #ifdef __x86_64__ static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) Modified: cfe/trunk/test/CodeGen/bitscan-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/bitscan-builtins.c?rev=307524&r1=307523&r2=307524&view=diff == --- cfe/trunk/test/CodeGen/bitscan-builtins.c (original) +++ cfe/trunk/test/CodeGen/bitscan-builtins.c Mon Jul 10 00:13:56 2017 @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s +// PR33722 +// RUN: %clang_cc1 -ffreestanding -triple x86_64-unknown-unknown -D_MSC_VER -emit-llvm -o - %s | FileCheck %s + #include int test_bit_scan_forward(int a) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26306: [AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is also enabled.
zvi accepted this revision. zvi added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D26306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26306: [AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is also enabled.
zvi added inline comments. Comment at: lib/Basic/Targets.cpp:3353 setSSELevel(Features, AVX512F, Enabled); +// Enable BWI instruction is VBMI is being enabled. +if (Name == "avx512vbmi" && Enabled) is -> if Comment at: test/Preprocessor/x86_target_features.c:212 +// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -mno-avx512vbmi -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMINOAVX512BW %s + Test is turning on and then off the same feature. Did you mean -mavx512bw -mno-avx512vbmi ? If the latter, I would prefer the compiler shout at me for providing contradicting flags than let the last flag win. Consider enforcing this in handleTargetFeatures(). https://reviews.llvm.org/D26306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21173: [X86] _MM_ALIGN16 attribute support for non-windows targets
zvi created this revision. zvi added reviewers: aaboud, mkuper, echristo, cfe-commits. zvi set the repository for this revision to rL LLVM. zvi added a project: clang-c. Herald added a subscriber: mehdi_amini. This patch adds support for the _MM_ALIGN16 attribute on non-windows targets. This aligns Clang with ICC which supports the attribute on all targets. Fixes PR28056 Repository: rL LLVM http://reviews.llvm.org/D21173 Files: lib/Headers/xmmintrin.h test/Headers/xmmintrin.c Index: test/Headers/xmmintrin.c === --- test/Headers/xmmintrin.c +++ test/Headers/xmmintrin.c @@ -7,6 +7,9 @@ // REQUIRES: x86-registered-target #include +// CHECK: @c = common global i8 0, align 16 +_MM_ALIGN16 char c; + // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by // checking that clang emits PACKSSDW instead of PACKSSWB. Index: lib/Headers/xmmintrin.h === --- lib/Headers/xmmintrin.h +++ lib/Headers/xmmintrin.h @@ -2823,6 +2823,8 @@ #ifdef _MSC_VER #define _MM_ALIGN16 __declspec(align(16)) +#else +#define _MM_ALIGN16 __attribute__((aligned(16))) #endif #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) Index: test/Headers/xmmintrin.c === --- test/Headers/xmmintrin.c +++ test/Headers/xmmintrin.c @@ -7,6 +7,9 @@ // REQUIRES: x86-registered-target #include +// CHECK: @c = common global i8 0, align 16 +_MM_ALIGN16 char c; + // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by // checking that clang emits PACKSSDW instead of PACKSSWB. Index: lib/Headers/xmmintrin.h === --- lib/Headers/xmmintrin.h +++ lib/Headers/xmmintrin.h @@ -2823,6 +2823,8 @@ #ifdef _MSC_VER #define _MM_ALIGN16 __declspec(align(16)) +#else +#define _MM_ALIGN16 __attribute__((aligned(16))) #endif #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21173: [X86] _MM_ALIGN16 attribute support for non-windows targets
zvi updated this revision to Diff 60217. zvi added a comment. Following David Majnemer's suggestion on cfe-commits: I would just use the __attribute__ spelling, no need for two definitions Repository: rL LLVM http://reviews.llvm.org/D21173 Files: lib/Headers/xmmintrin.h test/Headers/xmmintrin.c Index: test/Headers/xmmintrin.c === --- test/Headers/xmmintrin.c +++ test/Headers/xmmintrin.c @@ -7,6 +7,9 @@ // REQUIRES: x86-registered-target #include +// CHECK: @c = common global i8 0, align 16 +_MM_ALIGN16 char c; + // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by // checking that clang emits PACKSSDW instead of PACKSSWB. Index: lib/Headers/xmmintrin.h === --- lib/Headers/xmmintrin.h +++ lib/Headers/xmmintrin.h @@ -2821,9 +2821,7 @@ } -#ifdef _MSC_VER -#define _MM_ALIGN16 __declspec(align(16)) -#endif +#define _MM_ALIGN16 __attribute__((aligned(16))) #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) Index: test/Headers/xmmintrin.c === --- test/Headers/xmmintrin.c +++ test/Headers/xmmintrin.c @@ -7,6 +7,9 @@ // REQUIRES: x86-registered-target #include +// CHECK: @c = common global i8 0, align 16 +_MM_ALIGN16 char c; + // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by // checking that clang emits PACKSSDW instead of PACKSSWB. Index: lib/Headers/xmmintrin.h === --- lib/Headers/xmmintrin.h +++ lib/Headers/xmmintrin.h @@ -2821,9 +2821,7 @@ } -#ifdef _MSC_VER -#define _MM_ALIGN16 __declspec(align(16)) -#endif +#define _MM_ALIGN16 __attribute__((aligned(16))) #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r273095 - [X86] _MM_ALIGN16 attribute support for non-windows targets
Author: zvi Date: Sat Jun 18 15:01:07 2016 New Revision: 273095 URL: http://llvm.org/viewvc/llvm-project?rev=273095&view=rev Log: [X86] _MM_ALIGN16 attribute support for non-windows targets Summary: This patch adds support for the _MM_ALIGN16 attribute on non-windows targets. This aligns Clang with ICC which supports the attribute on all targets. Fixes PR28056 Reviewers: aaboud, echristo, cfe-commits, mkuper Subscribers: zvi, mehdi_amini Projects: #clang-c Differential Revision: http://reviews.llvm.org/D21173 Modified: cfe/trunk/lib/Headers/xmmintrin.h cfe/trunk/test/Headers/xmmintrin.c Modified: cfe/trunk/lib/Headers/xmmintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xmmintrin.h?rev=273095&r1=273094&r2=273095&view=diff == --- cfe/trunk/lib/Headers/xmmintrin.h (original) +++ cfe/trunk/lib/Headers/xmmintrin.h Sat Jun 18 15:01:07 2016 @@ -2821,9 +2821,7 @@ _mm_movemask_ps(__m128 __a) } -#ifdef _MSC_VER -#define _MM_ALIGN16 __declspec(align(16)) -#endif +#define _MM_ALIGN16 __attribute__((aligned(16))) #define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w)) Modified: cfe/trunk/test/Headers/xmmintrin.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/xmmintrin.c?rev=273095&r1=273094&r2=273095&view=diff == --- cfe/trunk/test/Headers/xmmintrin.c (original) +++ cfe/trunk/test/Headers/xmmintrin.c Sat Jun 18 15:01:07 2016 @@ -7,6 +7,9 @@ // REQUIRES: x86-registered-target #include +// CHECK: @c = common global i8 0, align 16 +_MM_ALIGN16 char c; + // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by // checking that clang emits PACKSSDW instead of PACKSSWB. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits