|
1 | 1 | Auto generated patch. Do not edit or delete it, even if empty.
|
| 2 | +diff -ruN --strip-trailing-cr a/clang/include/clang/Basic/BuiltinsX86.td b/clang/include/clang/Basic/BuiltinsX86.td |
| 3 | +--- a/clang/include/clang/Basic/BuiltinsX86.td |
| 4 | ++++ b/clang/include/clang/Basic/BuiltinsX86.td |
| 5 | +@@ -130,10 +130,6 @@ |
| 6 | + } |
| 7 | + } |
| 8 | + |
| 9 | +-let Features = "sse", Header = "xmmintrin.h", Attributes = [NoThrow, Const] in { |
| 10 | +- def _mm_prefetch : X86LibBuiltin<"void(void const *, int)">; |
| 11 | +-} |
| 12 | +- |
| 13 | + // AVX |
| 14 | + let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in { |
| 15 | + foreach Op = ["addsub", "hadd", "hsub", "max", "min"] in { |
| 16 | +@@ -142,12 +138,6 @@ |
| 17 | + } |
| 18 | + } |
| 19 | + |
| 20 | +-// PRFCHW |
| 21 | +-let Features = "prfchw", Header = "intrin.h", Attributes = [NoThrow, Const] in { |
| 22 | +- def _m_prefetch : X86LibBuiltin<"void(void *)">; |
| 23 | +- def _m_prefetchw : X86LibBuiltin<"void(void volatile const *)">; |
| 24 | +-} |
| 25 | +- |
| 26 | + |
| 27 | + // Mechanically ported builtins from the original `.def` file. |
| 28 | + // |
| 29 | +@@ -156,6 +146,10 @@ |
| 30 | + // current formulation is based on what was easiest to recognize from the |
| 31 | + // pre-TableGen version. |
| 32 | + |
| 33 | ++let Features = "mmx", Attributes = [NoThrow, Const] in { |
| 34 | ++ def _mm_prefetch : X86NoPrefixBuiltin<"void(char const *, int)">; |
| 35 | ++} |
| 36 | ++ |
| 37 | + let Features = "sse", Attributes = [NoThrow] in { |
| 38 | + def ldmxcsr : X86Builtin<"void(unsigned int)">; |
| 39 | + } |
| 40 | +diff -ruN --strip-trailing-cr a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp |
| 41 | +--- a/clang/lib/CodeGen/CGBuiltin.cpp |
| 42 | ++++ b/clang/lib/CodeGen/CGBuiltin.cpp |
| 43 | +@@ -15374,17 +15374,6 @@ |
| 44 | + Function *F = CGM.getIntrinsic(Intrinsic::prefetch, Address->getType()); |
| 45 | + return Builder.CreateCall(F, {Address, RW, Locality, Data}); |
| 46 | + } |
| 47 | +- case X86::BI_m_prefetch: |
| 48 | +- case X86::BI_m_prefetchw: { |
| 49 | +- Value *Address = Ops[0]; |
| 50 | +- // The 'w' suffix implies write. |
| 51 | +- Value *RW = |
| 52 | +- ConstantInt::get(Int32Ty, BuiltinID == X86::BI_m_prefetchw ? 1 : 0); |
| 53 | +- Value *Locality = ConstantInt::get(Int32Ty, 0x3); |
| 54 | +- Value *Data = ConstantInt::get(Int32Ty, 1); |
| 55 | +- Function *F = CGM.getIntrinsic(Intrinsic::prefetch, Address->getType()); |
| 56 | +- return Builder.CreateCall(F, {Address, RW, Locality, Data}); |
| 57 | +- } |
| 58 | + case X86::BI_mm_clflush: { |
| 59 | + return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_sse2_clflush), |
| 60 | + Ops[0]); |
| 61 | +diff -ruN --strip-trailing-cr a/clang/lib/Headers/prfchwintrin.h b/clang/lib/Headers/prfchwintrin.h |
| 62 | +--- a/clang/lib/Headers/prfchwintrin.h |
| 63 | ++++ b/clang/lib/Headers/prfchwintrin.h |
| 64 | +@@ -14,10 +14,6 @@ |
| 65 | + #ifndef __PRFCHWINTRIN_H |
| 66 | + #define __PRFCHWINTRIN_H |
| 67 | + |
| 68 | +-#if defined(__cplusplus) |
| 69 | +-extern "C" { |
| 70 | +-#endif |
| 71 | +- |
| 72 | + /// Loads a memory sequence containing the specified memory address into |
| 73 | + /// all data cache levels. |
| 74 | + /// |
| 75 | +@@ -30,7 +26,11 @@ |
| 76 | + /// |
| 77 | + /// \param __P |
| 78 | + /// A pointer specifying the memory address to be prefetched. |
| 79 | +-void _m_prefetch(void *__P); |
| 80 | ++static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
| 81 | ++_m_prefetch(void *__P) |
| 82 | ++{ |
| 83 | ++ __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */); |
| 84 | ++} |
| 85 | + |
| 86 | + /// Loads a memory sequence containing the specified memory address into |
| 87 | + /// the L1 data cache and sets the cache-coherency state to modified. |
| 88 | +@@ -48,10 +48,13 @@ |
| 89 | + /// |
| 90 | + /// \param __P |
| 91 | + /// A pointer specifying the memory address to be prefetched. |
| 92 | +-void _m_prefetchw(volatile const void *__P); |
| 93 | +- |
| 94 | +-#if defined(__cplusplus) |
| 95 | +-} // extern "C" |
| 96 | +-#endif |
| 97 | ++static __inline__ void __attribute__((__always_inline__, __nodebug__)) |
| 98 | ++_m_prefetchw(volatile const void *__P) |
| 99 | ++{ |
| 100 | ++#pragma clang diagnostic push |
| 101 | ++#pragma clang diagnostic ignored "-Wcast-qual" |
| 102 | ++ __builtin_prefetch ((const void*)__P, 1, 3 /* _MM_HINT_T0 */); |
| 103 | ++#pragma clang diagnostic pop |
| 104 | ++} |
| 105 | + |
| 106 | + #endif /* __PRFCHWINTRIN_H */ |
| 107 | +diff -ruN --strip-trailing-cr a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h |
| 108 | +--- a/clang/lib/Headers/xmmintrin.h |
| 109 | ++++ b/clang/lib/Headers/xmmintrin.h |
| 110 | +@@ -2197,7 +2197,10 @@ |
| 111 | + #define _MM_HINT_T2 1 |
| 112 | + #define _MM_HINT_NTA 0 |
| 113 | + |
| 114 | +-#if 0 |
| 115 | ++#ifndef _MSC_VER |
| 116 | ++/* FIXME: We have to #define this because "sel" must be a constant integer, and |
| 117 | ++ Sema doesn't do any form of constant propagation yet. */ |
| 118 | ++ |
| 119 | + /// Loads one cache line of data from the specified address to a location |
| 120 | + /// closer to the processor. |
| 121 | + /// |
| 122 | +@@ -2222,10 +2225,6 @@ |
| 123 | + /// be generated. \n |
| 124 | + /// _MM_HINT_T2: Move data using the T2 hint. The PREFETCHT2 instruction will |
| 125 | + /// be generated. |
| 126 | +-/// |
| 127 | +-/// _mm_prefetch is implemented as a "library builtin" directly in Clang, |
| 128 | +-/// similar to how it is done in MSVC. Clang will warn if the user doesn't |
| 129 | +-/// include xmmintrin.h or immintrin.h. |
| 130 | + #define _mm_prefetch(a, sel) (__builtin_prefetch((const void *)(a), \ |
| 131 | + ((sel) >> 2) & 1, (sel) & 0x3)) |
| 132 | + #endif |
0 commit comments