diff options
author | Craig Topper <craig.topper@intel.com> | 2017-12-21 23:50:22 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-12-21 23:50:22 +0000 |
commit | 56e4bd682d770af29eb698d1f9f700cc1fe27930 (patch) | |
tree | 0b132d52162265651563ee5b822642f392ceb9a5 /lib | |
parent | 05a54a3ef8af7878dda2e804b75b4424c2c8944f (diff) |
[X86] Allow _mm_prefetch (both the header implementation and the builtin) to accept bit 2 which is supposed to indicate the prefetched addresses will be written to
Add the appropriate _MM_HINT_ET0/ET1 defines to match gcc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321325 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/CGBuiltin.cpp | 5 | ||||
-rw-r--r-- | lib/Headers/xmmintrin.h | 11 | ||||
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 2 |
3 files changed, 11 insertions, 7 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index 4294a579de..609987c4fa 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -8022,8 +8022,9 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, default: return nullptr; case X86::BI_mm_prefetch: { Value *Address = Ops[0]; - Value *RW = ConstantInt::get(Int32Ty, 0); - Value *Locality = Ops[1]; + ConstantInt *C = cast<ConstantInt>(Ops[1]); + Value *RW = ConstantInt::get(Int32Ty, (C->getZExtValue() >> 2) & 0x1); + Value *Locality = ConstantInt::get(Int32Ty, C->getZExtValue() & 0x3); Value *Data = ConstantInt::get(Int32Ty, 1); Value *F = CGM.getIntrinsic(Intrinsic::prefetch); return Builder.CreateCall(F, {Address, RW, Locality, Data}); diff --git a/lib/Headers/xmmintrin.h b/lib/Headers/xmmintrin.h index bbc2117b4e..279c0275d9 100644 --- a/lib/Headers/xmmintrin.h +++ b/lib/Headers/xmmintrin.h @@ -2035,9 +2035,11 @@ _mm_storer_ps(float *__p, __m128 __a) _mm_store_ps(__p, __a); } -#define _MM_HINT_T0 3 -#define _MM_HINT_T1 2 -#define _MM_HINT_T2 1 +#define _MM_HINT_ET0 7 +#define _MM_HINT_ET1 6 +#define _MM_HINT_T0 3 +#define _MM_HINT_T1 2 +#define _MM_HINT_T2 1 #define _MM_HINT_NTA 0 #ifndef _MSC_VER @@ -2068,7 +2070,8 @@ _mm_storer_ps(float *__p, __m128 __a) /// be generated. \n /// _MM_HINT_T2: Move data using the T2 hint. The PREFETCHT2 instruction will /// be generated. -#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel))) +#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), \ + ((sel) >> 2) & 1, (sel) & 0x3)) #endif /// \brief Stores a 64-bit integer in the specified aligned memory location. To diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 122ceab70e..803f87b3c5 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -2278,7 +2278,7 @@ bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { default: return false; case X86::BI_mm_prefetch: - i = 1; l = 0; u = 3; + i = 1; l = 0; u = 7; break; case X86::BI__builtin_ia32_sha1rnds4: case X86::BI__builtin_ia32_shuf_f32x4_256_mask: |