]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/arm: Avoid writing to constant TCGv in trans_CSEL()
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 27 Jul 2023 10:39:06 +0000 (11:39 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 31 Jul 2023 18:09:04 +0000 (21:09 +0300)
commit26a49f9f6283083cf6084696ee99914228a3690a
treecdf90f7a9f4c6388baf09874cc1aacf020817a23
parent8cce5d060a3e9fb27b1c954a640df5f8c951c576
target/arm: Avoid writing to constant TCGv in trans_CSEL()

In commit 0b188ea05acb5 we changed the implementation of
trans_CSEL() to use tcg_constant_i32(). However, this change
was incorrect, because the implementation of the function
sets up the TCGv_i32 rn and rm to be either zero or else
a TCG temp created in load_reg(), and these TCG temps are
then in both cases written to by the emitted TCG ops.
The result is that we hit a TCG assertion:

qemu-system-arm: ../../tcg/tcg.c:4455: tcg_reg_alloc_mov: Assertion `!temp_readonly(ots)' failed.

(or on a non-debug build, just produce a garbage result)

Adjust the code so that rn and rm are always writeable
temporaries whether the instruction is using the special
case "0" or a normal register as input.

Cc: qemu-stable@nongnu.org
Fixes: 0b188ea05acb5 ("target/arm: Use tcg_constant in trans_CSEL")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230727103906.2641264-1-peter.maydell@linaro.org
(cherry picked from commit 2b0d656ab6484cae7f174e194215a6d50343ecd2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: context fixup in target/arm/tcg/translate.c)
target/arm/translate.c