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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2025-11-07
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This all depends also on the abi.

For Darwin ABI clang trunk produces:
```
_x:
        rev16   w8, w1
        cmp     w0, #0
        csel    w8, w1, w8, eq
        add     w0, w8, w2
        ret
```
For the windows ABI clang trunk  produces:
```
x:
        rev     w8, w1
        cmp     w0, #0
        lsr     w8, w8, #16
        csel    w8, w1, w8, eq
        and     w8, w8, #0xffff
        add     w0, w8, w2, uxth
        ret
```

For the standard elf abi clang  trunk  produces:
```
x:
        rev     w8, w1
        cmp     w0, #0
        lsr     w8, w8, #16
        csel    w8, w1, w8, eq
        and     w8, w8, #0xffff
        add     w0, w8, w2, uxth
        ret
```

As mentioned gcc trunk produces:
```
x:
        and     w3, w1, 65535
        rev16   w1, w1
        cmp     w0, 0
        and     w1, w1, 65535
        csel    w3, w3, w1, eq
        add     w0, w3, w2, uxth
        ret
```
there is one extra and here I think which could go after the csel.

Reply via email to