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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |pinskia at gcc dot gnu.org
   Last reconfirmed|                            |2026-04-21

--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
For aarch64, the following is done for the load/compare:
```
        ldr     w0, [x0]
        and     w0, w0, 131071
        cmp     w0, 16
```

While for riscv there is no `and`:
```
        lui     a5,%hi(b)
        lw      a4,%lo(b)(a5)
        li      a5,16
        beq     a4,a5,.L2
```

For `  b+=0x0fff0;` on riscv there is a zero extend from _BitInt (17) to 64bit
before the store:

        lui     a5,%hi(b)
        lw      a4,%lo(b)(a5)
        li      a5,65536
        addiw   a5,a5,-16
        addw    a5,a4,a5
        slli    a5,a5,47
        srli    a5,a5,47
        sext.w  a4,a5
        lui     a5,%hi(b)


Which I assume that would mean __atomic_add_fetch can't use amoadd.w here but a
loop.
        sw      a4,%lo(b)(a5)

Reply via email to