Branches in branch-free code: why RV32's missing cmov leaks conditionals into adds
jedisct1 · x · 2026-10-09
Frank DENIS walks through a curious case: compiling a 128-bit unsigned add for rv32imac with clang -O2 yields a conditional beq inside an addition. RV32 lacks a conditional-move (cmov) instruction — even 64-bit comparisons produce branches — so LLVM must propagate carries across four 32-bit adds using checks like sum1 == b1. The post contrasts x86/AArch64 cmov-based carry propagation and revisits the bitmask ctselect pattern used in constant-time code.
More from Research
- EA-VAE paper in IEEE T-PAMI fixes systematic uncertainty failures in VAEs — enzoferrante · 2026-10-10
- OpenAI reportedly solved 92 of the 500 most important open math problems in one GitHub push — altryne · 2026-10-10
- Quanta asks: is AI the end of math as we know it? — burny_tech · 2026-10-10
- AI math is teleportation to a foggy summit: Cepelewicz's striking mountain metaphor — burny_tech · 2026-10-10
- ICML paper debunks Platonic Representation convergence, proposes Aristotelian view — phillip_isola · 2026-10-10
- Isola lays out the three main pushbacks to the PRH narrative his new paper answers — phillip_isola · 2026-10-10