Unify clang with GNUC
authorSinan Kaya <sinan.kaya@microsoft.com>
Sun, 24 Mar 2019 23:45:43 +0000 (23:45 +0000)
committerSinan Kaya <sinan.kaya@microsoft.com>
Fri, 29 Mar 2019 14:09:04 +0000 (14:09 +0000)
Enable SSE for GCC

src/classlibnative/bcltype/arraynative.inl
src/pal/inc/pal.h
src/pal/inc/rt/xmmintrin.h

index 492d4fb..5928f9d 100644 (file)
@@ -58,7 +58,7 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz
             ++dptr;
         }
 
-#if defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__))
+#if defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__))
         if ((len & (2 * sizeof(SIZE_T))) != 0)
         {
             __m128 v = _mm_loadu_ps((float *)sptr);
@@ -104,7 +104,7 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz
         {
             return;
         }
-#else // !(defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__)))
+#else // !(defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__)))
         if ((len & (2 * sizeof(SIZE_T))) != 0)
         {
             // Read two values and write two values to hint the use of wide loads and stores
@@ -144,7 +144,7 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz
             sptr += 4;
             dptr += 4;
         }
-#endif // defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__))
+#endif // defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__))
     }
 }
 
@@ -193,7 +193,7 @@ FORCEINLINE void InlinedBackwardGCSafeCopyHelper(void *dest, const void *src, si
             }
         }
 
-#if defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__))
+#if defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__))
         if ((len & (2 * sizeof(SIZE_T))) != 0)
         {
             sptr -= 2;
@@ -242,7 +242,7 @@ FORCEINLINE void InlinedBackwardGCSafeCopyHelper(void *dest, const void *src, si
         {
             return;
         }
-#else // !(defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__)))
+#else // !(defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__)))
         if ((len & (2 * sizeof(SIZE_T))) != 0)
         {
             sptr -= 2;
@@ -281,7 +281,7 @@ FORCEINLINE void InlinedBackwardGCSafeCopyHelper(void *dest, const void *src, si
             len -= 4 * sizeof(SIZE_T);
         } while (len != 0);
         return;
-#endif // defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__))
+#endif // defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__))
     }
 }
 
index 38ef778..66d83f1 100644 (file)
@@ -192,11 +192,19 @@ typedef PVOID NATIVE_LIBRARY_HANDLE;
 #ifndef NOOPT_ATTRIBUTE
 #if defined(__llvm__)
 #define NOOPT_ATTRIBUTE optnone
-#else
+#elif defined(__GNUC__)
 #define NOOPT_ATTRIBUTE optimize("O0")
 #endif
 #endif
 
+#ifndef NODEBUG_ATTRIBUTE
+#if defined(__llvm__)
+#define NODEBUG_ATTRIBUTE __nodebug__
+#elif defined(__GNUC__)
+#define NODEBUG_ATTRIBUTE __artificial__
+#endif
+#endif
+
 #ifndef PAL_STDCPP_COMPAT
 
 #if __GNUC__
index 1a670bd..33bc8b4 100644 (file)
 *===-----------------------------------------------------------------------===
 */
 
-#ifdef __clang__
+#ifdef __GNUC__
 
 typedef float __m128 __attribute__((__vector_size__(16)));
 
 /* Define the default attributes for the functions in this file. */
-#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
+#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, NODEBUG_ATTRIBUTE))
 
 /// \brief Loads a 128-bit floating-point vector of [4 x float] from an aligned
 ///    memory location.
@@ -113,4 +113,4 @@ _mm_store_ps(float *__p, __m128 __a)
     *(__m128*)__p = __a;
 }
 
-#endif // __clang__
+#endif // __GNUC__