https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116896
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Note, we have a pattern matcher for floating point spaceship (that has without -ffast-math 4 cases), but not for integer. And the code we emit for lhs <=> rhs matches what we emit for if (lhs == rhs) { return std::strong_ordering::equal; } else if (lhs < rhs) { return std::strong_ordering::less; } else { return std::strong_ordering::greater; } Seems clang 19 also emitted different sequences for the two different manual cases but used cmov nevertheless instead of the conditional jump (as I said, that can be a win or can be bad pessimization, depending on the exact compared values). That said, clang trunk seems to emit movl (%rdi), %eax cmpl (%rsi), %eax setl %al setg %cl subb %al, %cl movsbl %cl, %eax for both, so something without jumps and without conditional moves. I guess we should check out how does that work for latency and throughput on different CPUs.