https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103216
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- For x86_64 we might be able to solve this at the RTL level during combine: (set (reg/v:QI 84 [ <retval> ]) (if_then_else:QI (lt (subreg:QI (reg:SI 86 [ a ]) 0) (const_int 0 [0])) (ior:QI (subreg:QI (reg:SI 86 [ a ]) 0) (const_int -128 [0xffffffffffffff80])) (reg/v:QI 84 [ <retval> ]))) That is optimize: (a < 0) ? a | signbit : b to (a < 0) ? a : b And I suspect we need after that) (a < 0) ? a : a & ~signbit into: a