FEX
FEX copied to clipboard
Incorrect translation of cmpxchg8b
The instruction cmpxchg8b qword ptr [rbp] gets translated to the following incorrect ARM code:
mov x20, x4
mov x21, x5
caspal w20, w21, w6, w7, [x9]
mrs x0, NZCV
cmp w20, w4
ccmp w21, w5, #0, eq
rmif x0, #0, #0xb
csel x4, x20, x4, ne
csel x5, x21, x5, ne
Observe that rmif is used with a shift value of 0 whereas a shift value of 28 is required to extract the NZCV bits.
Fixed in #5435, which amalgamates #5431 with necessary unit tests. Thanks for the report and fix! This was a gnarly one.