[clang] [CIR][X86] Add MSVC bit scan builtins (PR #234304)

Nayan Modak via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 12:50:04 PST 2026


Nayan0112 wrote:

I have inverted the condition in cir::IfOp::create to match the behaviour of the existing codegen. Previously, the generated CIR used:
```bash
if (Mask != 0) {
  // calculate and store the bit index
}
It now uses:
if (Mask == 0) {
  // empty block
} else {
  // calculate and store the bit index
}
```
This matches the icmp eq condition as in the classic CodeGen which is also included as part of the common prefix. However the order of the `bitscan_end` and `bitscan_not_zero` labels is reversed in the two IR, hence separate OCGC and LLVM-CIR checks are used to verify the latter part.
I have updated the corresponding CIR, LLVM-CIR, and OGCG checks accordingly. All tests pass locally.

https://github.com/llvm/llvm-project/pull/234304


More information about the cfe-commits mailing list