https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116896

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Though, maybe the integral SPACESHIP pattern matching wouldn't help.  Even for
std::partial_ordering
w4 (float const& lhs, float const& rhs) {
  return lhs <=> rhs;
}
we pattern recognize it into
  _11 = .SPACESHIP (_1, _2);
  if (_11 != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 5>; [50.00%]

  <bb 3> [local count: 536870912]:
  if (_11 == 1)
    goto <bb 5>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 4> [local count: 268435456]:

  <bb 5> [local count: 1073741824]:
  # _10 = PHI <0(2), -1(4), 1(3)>
and then expand
        movss   (%rdi), %xmm0
        comiss  (%rsi), %xmm0
        je      .L2
        seta    %al
        leal    -1(%rax,%rax), %eax
        ret
        .p2align 4,,10
        .p2align 3
.L2:
        xorl    %eax, %eax
        ret
so we are there back to what would be ideally turned into 2 setX and sbb.

Reply via email to