]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/arm: Fix return value from LDSMIN/LDSMAX 8/16 bit atomics
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 19 Jun 2023 10:20:18 +0000 (11:20 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 22 Jun 2023 07:34:30 +0000 (10:34 +0300)
commit1bc596d079dba75794560e0b52f1b0cb7d5dd3a4
tree4a37ac1ee6e356275194d4350cf01524542b58e5
parent23315ad0b8c04423fd274e9c571ae2cee9bd50c2
target/arm: Fix return value from LDSMIN/LDSMAX 8/16 bit atomics

The atomic memory operations are supposed to return the old memory
data value in the destination register.  This value is not
sign-extended, even if the operation is the signed minimum or
maximum.  (In the pseudocode for the instructions the returned data
value is passed to ZeroExtend() to create the value in the register.)

We got this wrong because we were doing a 32-to-64 zero extend on the
result for 8 and 16 bit data values, rather than the correct amount
of zero extension.

Fix the bug by using ext8u and ext16u for the MO_8 and MO_16 data
sizes rather than ext32u.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230602155223.2040685-2-peter.maydell@linaro.org
(cherry picked from commit 243705aa6ea3465b20e9f5a8bfcf36d3153f3c10)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/arm/translate-a64.c