zvi created this revision.

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


https://reviews.llvm.org/D35184

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


Index: test/CodeGen/bitscan-builtins.c
===================================================================
--- test/CodeGen/bitscan-builtins.c
+++ test/CodeGen/bitscan-builtins.c
@@ -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) {
Index: lib/Headers/immintrin.h
===================================================================
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -211,6 +211,7 @@
 {
   return __builtin_ia32_rdrand32_step(__p);
 }
+#endif /* __RDRND__ */
 
 /* __bit_scan_forward */
 static __inline__ int __attribute__((__always_inline__, __nodebug__))
@@ -231,7 +232,6 @@
   return __builtin_ia32_rdrand64_step(__p);
 }
 #endif
-#endif /* __RDRND__ */
 
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__)
 #ifdef __x86_64__


Index: test/CodeGen/bitscan-builtins.c
===================================================================
--- test/CodeGen/bitscan-builtins.c
+++ test/CodeGen/bitscan-builtins.c
@@ -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) {
Index: lib/Headers/immintrin.h
===================================================================
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -211,6 +211,7 @@
 {
   return __builtin_ia32_rdrand32_step(__p);
 }
+#endif /* __RDRND__ */
 
 /* __bit_scan_forward */
 static __inline__ int __attribute__((__always_inline__, __nodebug__))
@@ -231,7 +232,6 @@
   return __builtin_ia32_rdrand64_step(__p);
 }
 #endif
-#endif /* __RDRND__ */
 
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__)
 #ifdef __x86_64__
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to