]> granicus.if.org Git - clang/commitdiff
X86 Intrinsics: _bit_scan_forward should not be under #ifdef __RDRND__
authorZvi Rackover <zvi.rackover@intel.com>
Mon, 10 Jul 2017 07:13:56 +0000 (07:13 +0000)
committerZvi Rackover <zvi.rackover@intel.com>
Mon, 10 Jul 2017 07:13:56 +0000 (07:13 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307524 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/immintrin.h
test/CodeGen/bitscan-builtins.c

index e22dd231427dfc2032981fa464bed2470865edcb..c5f25bfcb5c140824d4abfabe5367421d679e964 100644 (file)
@@ -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")))
index 71e49845f896c150df3804c6b5704cea967c8473..5fd3f13fbc7301f9de1fad68fa33f903a57a8abd 100644 (file)
@@ -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 <immintrin.h>
 
 int test_bit_scan_forward(int a) {