swr: fix build with mingw
[mesa.git] / src / gallium / drivers / swr / rasterizer / common / os.h
index e812da39851b445a773409ea55aa5d31ee6e3c2a..f48ed6443c69c2479822f8d6b8626f691df569fd 100644 (file)
 #define SWR_VISIBLE __declspec(dllexport)
 
 #ifndef NOMINMAX
+#undef UNICODE
 #define NOMINMAX
 #include <windows.h>
 #undef NOMINMAX
+#define UNICODE
 #else
 #include <windows.h>
 #endif
 #undef MemoryFence
 #endif
 
+#if defined(_MSC_VER)
 #define OSALIGN(RWORD, WIDTH) __declspec(align(WIDTH)) RWORD
+#elif defined(__GNUC__)
+#define OSALIGN(RWORD, WIDTH) RWORD __attribute__((aligned(WIDTH)))
+#endif
 
 #if defined(_DEBUG)
 // We compile Debug builds with inline function expansion enabled.  This allows
@@ -174,15 +180,17 @@ inline uint64_t      __rdtsc()
 #endif
 
 #if !defined(__clang__) && !defined(__INTEL_COMPILER)
-// Intrinsic not defined in gcc
+// Intrinsic not defined in gcc < 10
+#if (__GNUC__) && (GCC_VERSION < 100000)
 static INLINE void _mm256_storeu2_m128i(__m128i* hi, __m128i* lo, __m256i a)
 {
     _mm_storeu_si128((__m128i*)lo, _mm256_castsi256_si128(a));
     _mm_storeu_si128((__m128i*)hi, _mm256_extractf128_si256(a, 0x1));
 }
+#endif
 
 // gcc prior to 4.9 doesn't have _mm*_undefined_*
-#if (__GNUC__) && (GCC_VERSION < 409000)
+#if (__GNUC__) && (GCC_VERSION < 40900)
 #define _mm_undefined_si128 _mm_setzero_si128
 #define _mm256_undefined_ps _mm256_setzero_ps
 #endif