提交 fd2d2b07 编写于 作者: S Sinan Kaya

Unify clang with GNUC

Enable SSE for GCC


Commit migrated from https://github.com/dotnet/coreclr/commit/446393da44258d60aaa9c660602fb826c79fe6b3
上级 e5a94ff5
...@@ -58,7 +58,7 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz ...@@ -58,7 +58,7 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz
++dptr; ++dptr;
} }
#if defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__)) #if defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__))
if ((len & (2 * sizeof(SIZE_T))) != 0) if ((len & (2 * sizeof(SIZE_T))) != 0)
{ {
__m128 v = _mm_loadu_ps((float *)sptr); __m128 v = _mm_loadu_ps((float *)sptr);
...@@ -104,7 +104,7 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz ...@@ -104,7 +104,7 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz
{ {
return; return;
} }
#else // !(defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__))) #else // !(defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__)))
if ((len & (2 * sizeof(SIZE_T))) != 0) if ((len & (2 * sizeof(SIZE_T))) != 0)
{ {
// Read two values and write two values to hint the use of wide loads and stores // 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 ...@@ -144,7 +144,7 @@ FORCEINLINE void InlinedForwardGCSafeCopyHelper(void *dest, const void *src, siz
sptr += 4; sptr += 4;
dptr += 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 ...@@ -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) if ((len & (2 * sizeof(SIZE_T))) != 0)
{ {
sptr -= 2; sptr -= 2;
...@@ -242,7 +242,7 @@ FORCEINLINE void InlinedBackwardGCSafeCopyHelper(void *dest, const void *src, si ...@@ -242,7 +242,7 @@ FORCEINLINE void InlinedBackwardGCSafeCopyHelper(void *dest, const void *src, si
{ {
return; return;
} }
#else // !(defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__))) #else // !(defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__)))
if ((len & (2 * sizeof(SIZE_T))) != 0) if ((len & (2 * sizeof(SIZE_T))) != 0)
{ {
sptr -= 2; sptr -= 2;
...@@ -281,7 +281,7 @@ FORCEINLINE void InlinedBackwardGCSafeCopyHelper(void *dest, const void *src, si ...@@ -281,7 +281,7 @@ FORCEINLINE void InlinedBackwardGCSafeCopyHelper(void *dest, const void *src, si
len -= 4 * sizeof(SIZE_T); len -= 4 * sizeof(SIZE_T);
} while (len != 0); } while (len != 0);
return; return;
#endif // defined(_AMD64_) && (defined(_MSC_VER) || defined(__clang__)) #endif // defined(_AMD64_) && (defined(_MSC_VER) || defined(__GNUC__))
} }
} }
......
...@@ -192,11 +192,19 @@ typedef PVOID NATIVE_LIBRARY_HANDLE; ...@@ -192,11 +192,19 @@ typedef PVOID NATIVE_LIBRARY_HANDLE;
#ifndef NOOPT_ATTRIBUTE #ifndef NOOPT_ATTRIBUTE
#if defined(__llvm__) #if defined(__llvm__)
#define NOOPT_ATTRIBUTE optnone #define NOOPT_ATTRIBUTE optnone
#else #elif defined(__GNUC__)
#define NOOPT_ATTRIBUTE optimize("O0") #define NOOPT_ATTRIBUTE optimize("O0")
#endif #endif
#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 #ifndef PAL_STDCPP_COMPAT
#if __GNUC__ #if __GNUC__
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
*===-----------------------------------------------------------------------=== *===-----------------------------------------------------------------------===
*/ */
#ifdef __clang__ #ifdef __GNUC__
typedef float __m128 __attribute__((__vector_size__(16))); typedef float __m128 __attribute__((__vector_size__(16)));
/* Define the default attributes for the functions in this file. */ /* 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 /// \brief Loads a 128-bit floating-point vector of [4 x float] from an aligned
/// memory location. /// memory location.
...@@ -113,4 +113,4 @@ _mm_store_ps(float *__p, __m128 __a) ...@@ -113,4 +113,4 @@ _mm_store_ps(float *__p, __m128 __a)
*(__m128*)__p = __a; *(__m128*)__p = __a;
} }
#endif // __clang__ #endif // __GNUC__
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册