summaryrefslogtreecommitdiff
path: root/src/vendorcode
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2017-06-25 03:39:18 +0200
committerStefan Reinauer <stefan.reinauer@coreboot.org>2017-06-27 17:00:14 +0000
commitc02b5e22a38dba429b1f058b305b6ddfdd7246b0 (patch)
tree16f42d2282ef5fc34409813d772d56bfd8ac6647 /src/vendorcode
parentb09822cf82798f78554971b62f236acc3ba3a28d (diff)
downloadcoreboot-c02b5e22a38dba429b1f058b305b6ddfdd7246b0.tar.xz
vendorcode/amd: Make compiler intrinsics clang friendly
Change-Id: Ibff31a9960a23f03facbb09e76d6a5d6fbfb5e94 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-on: https://review.coreboot.org/20381 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/vendorcode')
-rw-r--r--src/vendorcode/amd/include/gcc-intrin.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vendorcode/amd/include/gcc-intrin.h b/src/vendorcode/amd/include/gcc-intrin.h
index 5d77c4de4d..8b31530a8a 100644
--- a/src/vendorcode/amd/include/gcc-intrin.h
+++ b/src/vendorcode/amd/include/gcc-intrin.h
@@ -467,6 +467,7 @@ static __inline__ __attribute__((always_inline)) void __writemsr (UINT32 msr, UI
);
}
+#if !defined(__clang__)
static __inline__ __attribute__((always_inline)) UINT64 __rdtsc(void)
{
UINT64 retval;
@@ -475,6 +476,7 @@ static __inline__ __attribute__((always_inline)) UINT64 __rdtsc(void)
: "=A" (retval));
return retval;
}
+#endif
static __inline__ __attribute__((always_inline)) void __cpuid(int CPUInfo[], const int InfoType)
{
@@ -585,7 +587,11 @@ typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
static __inline__ __attribute__((always_inline)) void _mm_stream_si128_fs2 (void *__A, __m128i __B)
{
__asm__(".byte 0x64"); // fs prefix
+#if defined(__clang__)
+ __builtin_nontemporal_store((__v2di)__B, (__v2di *)__A);
+#else
__builtin_ia32_movntdq ((__v2di *)__A, (__v2di)__B);
+#endif
}
static __inline__ __attribute__((always_inline)) void _mm_stream_si128_fs (void *__A, void *__B)
@@ -601,15 +607,23 @@ static __inline__ __attribute__((always_inline)) void _mm_clflush_fs (void *__A)
__builtin_ia32_clflush (__A);
}
+#if !defined(__clang__)
static __inline __attribute__(( __always_inline__)) void _mm_mfence (void)
{
__builtin_ia32_mfence ();
}
+#else
+void _mm_mfence(void);
+#endif
+#if !defined(__clang__)
static __inline __attribute__(( __always_inline__)) void _mm_sfence (void)
{
__builtin_ia32_sfence ();
}
+#else
+void _mm_sfence(void);
+#endif
#endif /* __SSE3__ */
#endif /* defined (__GNUC__) */