Skip to content

Commit 7679ba9

Browse files
shrikardongrelanza
authored andcommitted
[CIR][CIRGen][builtin] handle _mm_pause (#1493)
1 parent 4cf5576 commit 7679ba9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,14 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned BuiltinID,
113113
voidTy)
114114
.getResult();
115115
}
116+
117+
case X86::BI_mm_pause: {
118+
mlir::Type voidTy = cir::VoidType::get(&getMLIRContext());
119+
return builder
120+
.create<cir::LLVMIntrinsicCallOp>(
121+
getLoc(E->getExprLoc()), builder.getStringAttr("x86.sse2.pause"),
122+
voidTy)
123+
.getResult();
124+
}
116125
}
117126
}

clang/test/CIR/CodeGen/X86/builtins-x86.c

+8
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ void test_mm_lfence() {
2121
// CIR: {{%.*}} = cir.llvm.intrinsic "x86.sse2.lfence" : () -> !void
2222
// LLVM: call void @llvm.x86.sse2.lfence()
2323
}
24+
25+
void test_mm_pause() {
26+
// CIR-LABEL: test_mm_pause
27+
// LLVM-LABEL: test_mm_pause
28+
_mm_pause();
29+
// CIR: {{%.*}} = cir.llvm.intrinsic "x86.sse2.pause" : () -> !void
30+
// LLVM: call void @llvm.x86.sse2.pause()
31+
}

0 commit comments

Comments
 (0)