fallback: translate: call llvm.ctlz.i32

Run:explore-db12fc36f6-20261127-115111
Kind:fallback
Category:translate: call llvm.ctlz.i32 M
Occurrences:3 in 2 configs, 3 test files, 4 more counted only
Snippet from:rv64zbb.d8d761a3fc.ll (mutant of rv64zbb.ll) @log2_i32 via llvm-extract
Config:-mtriple=riscv64 -verify-machineinstrs -mattr=+zbb,+zfinx -O0
Local check:reproduces at db12fc36f6
Compiler Explorer:not uploaded (over --godbolt-limit or disabled)

Snippet:

; Function Attrs: nounwind
define signext i32 @log2_i32(i32 signext %a) #0 {
  %1 = call i32 @llvm.ctlz.i32(i32 %a, i1 false)
  %B = sub i32 0, %1
  %2 = sub i32 31, %B
  ret i32 %2
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctlz.i32(i32, i1 immarg) #1

attributes #0 = { nounwind }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

Reproduce:

llc -mtriple=riscv64 -verify-machineinstrs -mattr=+zbb,+zfinx -O0 -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* snippet.ll -o -
llc -mtriple=riscv64 -verify-machineinstrs -mattr=+zbb,+zfinx -O0 -global-isel=0 snippet.ll -o -

Local llc output:

remark: <unknown>:0:0: unable to translate instruction: call llvm.ctlz.i32: '  %1 = call i32 @llvm.ctlz.i32(i32 %a, i1 false)' (in function: log2_i32)
warning: Instruction selection used fallback path for log2_i32

Occurrences (3):

InputFunctionConfig
ctlz-cttz-ctpop.0d63989f6b.ll (mutant of ctlz-cttz-ctpop.ll)test_ctlz_i32_zero_poison-mtriple=riscv64 -verify-machineinstrs -mattr=+xtheadbb,+zfinx -O2
rv64xtheadbb.ff0b2827b0.ll (mutant of rv64xtheadbb.ll)findLastSet_i32-mtriple=riscv64 -verify-machineinstrs -mattr=+xtheadbb,+zfinx -O2
rv64zbb.d8d761a3fc.ll (mutant of rv64zbb.ll)log2_i32-mtriple=riscv64 -verify-machineinstrs -mattr=+zbb,+zfinx -O0

Generated 2026-11-29 14:49 UTC.