[clang] [CIR][X86] Implement generic fallback for x86 builtins (PR #177639)
Priyanshu Kumar via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 27 05:30:22 PST 2026
Priyanshu3820 wrote:
> @Priyanshu3820 I see what's going on now. There is a tablegen-based mechanism for handling certain target-specific builtins that always get lowered to target-specific intrinsic calls. This is implemented in the incubator here: https://github.com/llvm/clangir/blob/d4ebb05f347d8d9d62968676d5b2bbc1338de499/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp#L2885 and in classic codegen here:
>
> https://github.com/llvm/llvm-project/blob/674b020196060f8f5fdce5961fe3b69d7009a11d/clang/lib/CodeGen/CGBuiltin.cpp#L6462
>
> A very important part of this is that it calls `Intrinsic::getIntrinsicForClangBuiltin(Prefix.data(), Name);` to get the ID of the intrinsic to call. The implementation of this function is provided by table-generated code based on definitions in `llvm/include/llvm/IR/Intrinsics*/td`.
>
I see the implementation now. And also, compiler explorer uses the incubator, am I right? I didn't know that. I thought it just uses clang with CIR enabled.
> We do need this to be upstreamed for CIR, but it should be based closely on the existing implementation.
>
I'll keep that in mind.
https://github.com/llvm/llvm-project/pull/177639
More information about the cfe-commits
mailing list