tcg/loongarch64: Fix tcg_out_movi vs some pcrel pointers
commit521d7fb3ebdf88112ed13556a93e3037742b9eb8
authorRichard Henderson <richard.henderson@linaro.org>
Wed, 19 Jun 2024 05:41:13 +0000 (19 05:41 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 19 Jun 2024 20:50:22 +0000 (19 13:50 -0700)
tree66dda2f940150eeab148798000ef20eb57cfc56e
parent6b4965373e561b77f91cfbdf41353635c9661358
tcg/loongarch64: Fix tcg_out_movi vs some pcrel pointers

Simplify the logic for two-part, 32-bit pc-relative addresses.
Rather than assume all such fit in int32_t, do some arithmetic
and assert a result, do some arithmetic first and then check
to see if the pieces are in range.

Cc: qemu-stable@nongnu.org
Fixes: dacc51720db ("tcg/loongarch64: Implement tcg_out_mov and tcg_out_movi")
Reviewed-by: Song Gao <gaosong@loongson.cn>
Reported-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/loongarch64/tcg-target.c.inc