88// RUN: %clang_cc1 -x c++ -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-unknown-linux -target-feature +sse2 -fno-signed-char -fclangir -emit-llvm -o %t.ll -Wall -Werror
99// RUN: FileCheck --check-prefixes=LLVM-CHECK --input-file=%t.ll %s
1010
11+ // This test mimics clang/test/CodeGen/X86/sse2-builtins.c, which eventually
12+ // CIR shall be able to support fully.
13+
1114#include <immintrin.h>
1215
16+ void test_mm_clflush (void * A ) {
17+ // CIR-LABEL: test_mm_clflush
18+ // LLVM-LABEL: test_mm_clflush
19+ _mm_clflush (A );
20+ // CIR-CHECK: {{%.*}} = cir.llvm.intrinsic "x86.sse2.clflush" {{%.*}} : (!cir.ptr<!void>) -> !void
21+ // LLVM-CHECK: call void @llvm.x86.sse2.clflush(ptr {{%.*}})
22+ }
23+
1324// Lowering to pextrw requires optimization.
1425int test_mm_extract_epi16 (__m128i A ) {
1526
@@ -22,3 +33,19 @@ int test_mm_extract_epi16(__m128i A) {
2233 // LLVM-CHECK: zext i16 %{{.*}} to i32
2334 return _mm_extract_epi16 (A , 1 );
2435}
36+
37+ void test_mm_lfence (void ) {
38+ // CIR-CHECK-LABEL: test_mm_lfence
39+ // LLVM-CHECK-LABEL: test_mm_lfence
40+ _mm_lfence ();
41+ // CIR-CHECK: {{%.*}} = cir.llvm.intrinsic "x86.sse2.lfence" : () -> !void
42+ // LLVM-CHECK: call void @llvm.x86.sse2.lfence()
43+ }
44+
45+ void test_mm_mfence (void ) {
46+ // CIR-CHECK-LABEL: test_mm_mfence
47+ // LLVM-CHECK-LABEL: test_mm_mfence
48+ _mm_mfence ();
49+ // CIR-CHECK: {{%.*}} = cir.llvm.intrinsic "x86.sse2.mfence" : () -> !void
50+ // LLVM-CHECK: call void @llvm.x86.sse2.mfence()
51+ }
0 commit comments