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

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|spaceship<mode>4 sj         |spaceship<mode>4 should be
                   |                            |defined for riscv
           Keywords|                            |missed-optimization
             Target|                            |riscv

--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Sorry pressed return too early.
Take:
```
int sp1 (int a, int b)
{
   return a < b ? -1 : a > b ? 1 : 0;
}
```

This should be give:
```
        slt     a2, a0, a1
        slt     a0, a1, a0
        sub     a0, a0, a2
```

Which is what is done for LLVM but currently gcc has a branch form of:
```
        blt     a0,a1,.L3
        sgt     a0,a0,a1
        ret
.L3:
        li      a0,-1
        ret
```

Reply via email to