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

--- Comment #14 from YunQiang Su <syq at gcc dot gnu.org> ---
And it seems that the performance of SLL is related with the operand.

Just iterate from 0 to 1e9:

```
0000000000000b00 <f32>:
 b00:   000223c0        sll     a0,v0,0xf     #### <-- the code is something
wrong
                                              #### in normal code, we should
access
                                              #### v0 here.  v0 will be 100 or
1000.
 b04:   04810003        bgez    a0,b14 <f32+0x14>
 b08:   00000000        nop
 b0c:   03e00008        jr      ra
 b10:   240203e8        li      v0,1000
 b14:   03e00008        jr      ra
 b18:   24020064        li      v0,100
 b1c:   00000000        nop
```

is slower than

```
0000000000000b00 <f32>:
 b00:   000223c0        sll     a0,a0,0xf
 b04:   04810003        bgez    a0,b14 <f32+0x14>
 b08:   00000000        nop
 b0c:   03e00008        jr      ra
 b10:   240203e8        li      v0,1000
 b14:   03e00008        jr      ra
 b18:   24020064        li      v0,100
 b1c:   00000000        nop
```


I have no idea how to make a trade off here.

Reply via email to