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

Fabian Vogt <fab...@ritter-vogt.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fab...@ritter-vogt.de

--- Comment #4 from Fabian Vogt <fab...@ritter-vogt.de> ---
FTR, this was originally reported as
https://bugzilla.opensuse.org/show_bug.cgi?id=1174753 with some more info:

> Assembly dump of CAS16 operation generated:
> 00000000004006f0 <__aarch64_cas16_acq_rel>:
>   4006f0:       90000110        adrp    x16, 420000 
> <__libc_start_main@GLIBC_2.17>
>   4006f4:       3940e610        ldrb    w16, [x16, #57]
>   4006f8:       34000070        cbz     w16, 400704 
> <__aarch64_cas16_acq_rel+0x14>
>   4006fc:       4860fc82        caspal  x0, x1, x2, x3, [x4]
>   400700:       d65f03c0        ret
>   400704:       aa0003f0        mov     x16, x0
>   400708:       aa0103f1        mov     x17, x1
>   40070c:       c87f8480        ldaxp   x0, x1, [x4]
>   400710:       eb10001f        cmp     x0, x16
>   400714:       fa510020        ccmp    x1, x17, #0x0, eq  // eq = none
>   400718:       54000061        b.ne    400724 <__aarch64_cas16_acq_rel+0x34> 
>  // b.any
>   40071c:       c82fc490        stlxp   w15, x16, x17, [x4]
>   400720:       35ffff6f        cbnz    w15, 40070c 
> <__aarch64_cas16_acq_rel+0x1c>
>   400724:       d65f03c0        ret
>   400728:       d503201f        nop
>   40072c:       d503201f        nop
> 
> CASPAL instruction (at 4006fc) would compare and read 2 64-bit values
> starting at memory specified in register x4 to values stored in x0 and x1,
> and if they compare equal, overwrite values stored at x4 with x2 and x3.
> 
> However the fallback instructions (starting at 40070c) writes x0 and x1
> (saved in x16 and x17 at 400704) to memory pointed by x4 rather than x2 and
> x3.

Reply via email to