Skip to content

Commit 6f05b94

Browse files
KanRobertmemfrob
authored andcommitted
[X86] Support intrinsic _mm_cldemote
Reviewers: LuoYuanke, craig.topper, RKSimon, pengfei Reviewed By: craig.topper Subscribers: cfe-commits, llvm-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D75896
1 parent 7368d40 commit 6f05b94

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/lib/Headers/cldemoteintrin.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,19 @@
1818
#define __DEFAULT_FN_ATTRS \
1919
__attribute__((__always_inline__, __nodebug__, __target__("cldemote")))
2020

21+
/// Hint to hardware that the cache line that contains \p __P should be demoted
22+
/// from the cache closest to the processor core to a level more distant from
23+
/// the processor core.
24+
///
25+
/// \headerfile <x86intrin.h>
26+
///
27+
/// This intrinsic corresponds to the <c> CLDEMOTE </c> instruction.
2128
static __inline__ void __DEFAULT_FN_ATTRS
2229
_cldemote(const void * __P) {
2330
__builtin_ia32_cldemote(__P);
2431
}
2532

33+
#define _mm_cldemote(p) _cldemote(p)
2634
#undef __DEFAULT_FN_ATTRS
2735

2836
#endif

clang/test/CodeGen/cldemote.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ void test_cldemote(const void *p) {
77
//CHECK-LABEL: @test_cldemote
88
//CHECK: call void @llvm.x86.cldemote(i8* %{{.*}})
99
_cldemote(p);
10+
//CHECK: call void @llvm.x86.cldemote(i8* %{{.*}})
11+
_mm_cldemote(p);
1012
}

0 commit comments

Comments
 (0)