gallium: Include intrin.h instead of defining ourselves.
authorJose Fonseca <jfonseca@vmware.com>
Mon, 18 Apr 2016 11:08:35 +0000 (12:08 +0100)
committerJose Fonseca <jfonseca@vmware.com>
Tue, 26 Apr 2016 16:17:00 +0000 (17:17 +0100)
More portable, particularly when building with Clang, which implements
all MSVC intrisincs in its own intrin.h, but doesn't actually support
`#pragma instrinsic`.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/util/u_math.h
src/gallium/drivers/llvmpipe/lp_test.h
src/gallium/include/pipe/p_compiler.h

index 10f158b708629b40df34011edaf073081f968d85..4e58e505572e6d9280d3993d4225c373b6ab7cbf 100644 (file)
 #include <strings.h> /* for ffs */
 #endif
 
+#if defined(_MSC_VER)
+#include <intrin.h>
+#endif
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -357,8 +361,6 @@ util_half_inf_sign(int16_t x)
 #define FFS_DEFINED 1
 
 #if defined(_MSC_VER) && (_M_IX86 || _M_AMD64 || _M_IA64)
-unsigned char _BitScanForward(unsigned long* Index, unsigned long Mask);
-#pragma intrinsic(_BitScanForward)
 static inline
 unsigned long ffs( unsigned long u )
 {
index e1b51c9c9a6e5761f066f28148b7e0c4847b61c2..3d00b01253cae6d948d4b659b88acd21895bcd2d 100644 (file)
@@ -71,8 +71,7 @@ test_all(unsigned verbose, FILE *fp);
 
 #if defined(PIPE_CC_MSVC)
 
-unsigned __int64 __rdtsc();
-#pragma intrinsic(__rdtsc)
+#include <intrin.h>
 #define rdtsc() __rdtsc()
 
 #elif defined(PIPE_CC_GCC) && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64))
index c48a55e22fc4343462d939290afcfb85a0faae44..832dd659d559c58463c6f998356c152623f99510 100644 (file)
@@ -48,6 +48,8 @@
 
 #if defined(_MSC_VER)
 
+#include <intrin.h>
+
 /* Avoid 'expression is always true' warning */
 #pragma warning(disable: 4296)
 
@@ -174,8 +176,6 @@ typedef unsigned char boolean;
 
 #elif defined(_MSC_VER)
 
-void _ReadWriteBarrier(void);
-#pragma intrinsic(_ReadWriteBarrier)
 #define PIPE_READ_WRITE_BARRIER() _ReadWriteBarrier()
 
 #else