Skip to content

[CIR][CIRGen][builtin] handle _mm_pause #1493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinX86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,14 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned BuiltinID,
voidTy)
.getResult();
}

case X86::BI_mm_pause: {
mlir::Type voidTy = cir::VoidType::get(&getMLIRContext());
return builder
.create<cir::LLVMIntrinsicCallOp>(
getLoc(E->getExprLoc()), builder.getStringAttr("x86.sse2.pause"),
voidTy)
.getResult();
}
}
}
8 changes: 8 additions & 0 deletions clang/test/CIR/CodeGen/X86/builtins-x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ void test_mm_lfence() {
// CIR: {{%.*}} = cir.llvm.intrinsic "x86.sse2.lfence" : () -> !void
// LLVM: call void @llvm.x86.sse2.lfence()
}

void test_mm_pause() {
// CIR-LABEL: test_mm_pause
// LLVM-LABEL: test_mm_pause
_mm_pause();
// CIR: {{%.*}} = cir.llvm.intrinsic "x86.sse2.pause" : () -> !void
// LLVM: call void @llvm.x86.sse2.pause()
}
Loading