[clang] [CIR] Lowering __builtin_stdc_* calls (PR #214931)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 10 12:46:21 PDT 2026
https://github.com/bcardosolopes requested changes to this pull request.
`emitStdcBitWidth` only works when the argument is `unsigned int`, which is the one type the test covers. Details inline.
Answering your question to @andykaylor: yes, cover all the typed variants. `uc`/`us`/`ul`/`ull` are exactly the cases where the argument type and the result type differ, and that is where this falls over.
Shape question too. OG covers all 13 stdbit families with three helpers in CGBuiltin.cpp: `emitStdcCountIntrinsic`, `emitStdcBitWidthMinus`, `emitStdcFirstBit`. `count_zeros` is the same bitwidth-minus-popcount you are writing here, `leading_ones`/`trailing_ones` are the same count with the argument inverted. Worth mirroring that split now so the rest of #214443 slots in instead of one helper per family. Alternatively, you can postpone some of them, but the mechanism needs to be in place to fail if those paths are used in the meantime (erroNYI, etc)
https://github.com/llvm/llvm-project/pull/214931
More information about the cfe-commits
mailing list