fallback: translate: call llvm.ctpop.i32

Run:explore-d9924131a4-20261128-105811
Kind:fallback
Category:translate: call llvm.ctpop.i32 M
Occurrences:6 in 5 configs, 3 test files, 1 more counted only
Snippet from:ctlz-cttz-ctpop.485ffa379d.ll (mutant of ctlz-cttz-ctpop.ll) @test_parity_i32 via llvm-extract
Config:-mtriple=riscv32 -verify-machineinstrs -mattr=+zhinx,+zfinx -O2
Local check:reproduces at d9924131a4
Compiler Explorer:not uploaded (over --godbolt-limit or disabled)

Snippet:

define i32 @test_parity_i32(i32 %a) {
  %1 = call i32 @llvm.ctpop.i32(i32 %a)
  %2 = and i32 %1, 1
  %B1 = sub i32 %1, %a
  store i32 %B1, ptr poison, align 4
  ret i32 %2
}

; Function Attrs: nocallback nocreateundeforpoison nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #0

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

Reproduce:

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

Local llc output:

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

Occurrences (6):

InputFunctionConfig
ctlz-cttz-ctpop.485ffa379d.ll (mutant of ctlz-cttz-ctpop.ll)test_parity_i32-mtriple=riscv32 -verify-machineinstrs -mattr=+zhinx,+zfinx -O2
ctlz-cttz-ctpop.d360e98ef9.ll (mutant of ctlz-cttz-ctpop.ll)test_ctpop_i32-mtriple=riscv32 -verify-machineinstrs -mattr=+xtheadbb,+zdinx -O3
rv32zbb.595b8d2f36.ll (mutant of rv32zbb.ll)ctpop32_eq_one_nonzero-mtriple=riscv32 -verify-machineinstrs -mattr=+zdinx,+xtheadba -O0
xcvbitmanip.87da0315bf.ll (mutant of xcvbitmanip.ll)ctpop_i32_eq_one-mtriple=riscv32 -verify-machineinstrs -mattr=+xcvbitmanip,+zfinx -O2
xcvbitmanip.dfc2a23d3c.ll (mutant of xcvbitmanip.ll)ctpop_i32_ult_two-mtriple=riscv32 -verify-machineinstrs -mattr=+xcvbitmanip,+zhinx,+zba -O0
xcvbitmanip.dfc2a23d3c.ll (mutant of xcvbitmanip.ll)ctpop_i32_eq_one-mtriple=riscv32 -verify-machineinstrs -mattr=+xcvbitmanip,+zhinx,+zba -O0

Generated 2026-11-29 14:49 UTC.