llvm-project
5dd3aaf4 - [CIR][X86] Add MSVC bit scan builtins (#234304)

Commit
2 days ago
[CIR][X86] Add MSVC bit scan builtins (#234304) ## Summary Add CIR code generation support for the MSVC X86 bit-scan intrinsics: - `_BitScanForward` - `_BitScanReverse` - `_BitScanForward64` - `_BitScanReverse64` The implementation: - Uses `cir.ctz` for forward scans. - Uses `cir.clz` to calculate the highest set-bit index for reverse scans. - Writes the result index only when the input mask is non-zero. - Returns the expected boolean success value. - Supports both 32-bit and 64-bit masks. ## Tests Add CIR FileCheck tests covering all four intrinsics and verifying the generated zero checks, scan operations, conditional stores, casts, and return values. --------- Co-authored-by: Nayan112 <nayan.modak.2006@gmail.com> Co-authored-by: dwbh21 <anant.maheshwary@gmail.com>
Parents
Loading