https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98801
--- Comment #2 from Jeff Hurchalla <jeffhurchalla at gmail dot com> --- Relying on improved codegen, I believe we have the current problem that there are times that a programmer knows a conditional is unpredictable, yet it would be impossible for a compiler to know. There's no documented way for a programmer to inform the compiler. There might also be cases (beyond my realm) for security where execution time can't be allowed to vary due to a mispredicted branch - again with no way to tell the compiler to use a conditional move, or branchless code. Barring a built-in function for conditional move, I'd alternatively request a documented canonical form to use in C that provides conditional moves when the ISA supports it (hypothetically, the earlier ugly bit-hack example could work for this due to its clear intent, whereas the ternary operator example could not due to unclear intent). Without a canonical form, could a compiler anticipate the near infinite number of ways a programmer might express it in C, even when the intent is clear? I'd certainly prefer a conditional move built-in function, if it's a possibility. It's clear and simple from a user's point of view. The translation to a machine instruction also seems pretty direct and limited in scope. Most ISAs support the instruction - ARM aarch64/A64/A32, x86_64, PPC. The one I know of that doesn't automatically is RISC-V, which needs the bit manipulation extension.