[llvm] [ConstantTime][LLVM] Add llvm.ct.select intrinsic with generic SelectionDAG lowering (PR #166702)

Simon Tatham via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 03:43:11 PST 2025


statham-arm wrote:

A couple of small nits from the PR description:

> Guarantees execution time independent of the condition value

A constant-time select _also_ wants to guarantee execution time independent of the values being selected! I guess you didn't mention that because you'd expect it from even the normal way to select between two values. But it wasn't _guaranteed_ by the normal way, so perhaps it's worth including explicitly here anyway.

Also it's probably worth mentioning that the "guarantee" is sometimes conditional, e.g. on Arm DIT being set while running the generated code. I expect that for instructions this simple it's probably OK _in practice_ even without that, but that's not the same thing as a promise that the next-generation CPU won't find something clever to do.

https://github.com/llvm/llvm-project/pull/166702


More information about the llvm-commits mailing list