[clang] [CIR] Implement MSVC bitscan builtins (PR #208011)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 7 07:50:21 PDT 2026
https://github.com/acycl1c created https://github.com/llvm/llvm-project/pull/208011
Towards implementing X86 MSVC bitscan builtins for ClangIR CodeGen (part of #167765) to match those of `clang/lib/CodeGen/TargetBuiltins/X86.cpp`.
**Current Status**
- Early draft PR (work-in-progress) to get feedback on approach before implementation.
- Start by surveying `translateX86ToMsvcIntrin` in classic Clang CodeGen and assess how it might be implemented in CIR CodeGen.
- Identify any other unimplemented blockers as additional work items.
cc @andykaylor
>From 17c45a466d37c25d20b13dd2f3ad23395c655c5e Mon Sep 17 00:00:00 2001
From: Jason Wu <jason at Jasons-Mac-mini.local>
Date: Tue, 7 Jul 2026 09:19:06 -0500
Subject: [PATCH] [CIR] Identified CodeGen functions for MSVC X86 builtins
---
clang/lib/CodeGen/TargetBuiltins/X86.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/lib/CodeGen/TargetBuiltins/X86.cpp b/clang/lib/CodeGen/TargetBuiltins/X86.cpp
index 0e675421d4278..e479c30cf3749 100644
--- a/clang/lib/CodeGen/TargetBuiltins/X86.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/X86.cpp
@@ -20,6 +20,7 @@ using namespace clang;
using namespace CodeGen;
using namespace llvm;
+// TODO: Implement this for MSVC CIR support
static std::optional<CodeGenFunction::MSVCIntrin>
translateX86ToMsvcIntrin(unsigned BuiltinID) {
using MSVCIntrin = CodeGenFunction::MSVCIntrin;
@@ -780,7 +781,7 @@ Value *CodeGenFunction::EmitX86CpuInit() {
return Builder.CreateCall(Func);
}
-
+// TODO: Implement this for MSVC CIR codegen
Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
const CallExpr *E) {
if (BuiltinID == Builtin::BI__builtin_cpu_is)
More information about the cfe-commits
mailing list