target/sparc: Fix FPMERGE

This instruction has f32 inputs, which changes the decode
of the register numbers.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240502165528.244004-7-richard.henderson@linaro.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
(cherry picked from commit d3ef26afde)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Richard Henderson 2024-05-02 09:55:27 -07:00 committed by Michael Tokarev
parent b7f629b431
commit 6466cf4131
3 changed files with 16 additions and 15 deletions

View File

@ -94,7 +94,7 @@ DEF_HELPER_FLAGS_2(fstox, TCG_CALL_NO_WG, s64, env, f32)
DEF_HELPER_FLAGS_2(fdtox, TCG_CALL_NO_WG, s64, env, f64) DEF_HELPER_FLAGS_2(fdtox, TCG_CALL_NO_WG, s64, env, f64)
DEF_HELPER_FLAGS_2(fqtox, TCG_CALL_NO_WG, s64, env, i128) DEF_HELPER_FLAGS_2(fqtox, TCG_CALL_NO_WG, s64, env, i128)
DEF_HELPER_FLAGS_2(fpmerge, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(fpmerge, TCG_CALL_NO_RWG_SE, i64, i32, i32)
DEF_HELPER_FLAGS_2(fmul8x16, TCG_CALL_NO_RWG_SE, i64, i32, i64) DEF_HELPER_FLAGS_2(fmul8x16, TCG_CALL_NO_RWG_SE, i64, i32, i64)
DEF_HELPER_FLAGS_2(fmul8x16a, TCG_CALL_NO_RWG_SE, i64, i32, s32) DEF_HELPER_FLAGS_2(fmul8x16a, TCG_CALL_NO_RWG_SE, i64, i32, s32)
DEF_HELPER_FLAGS_2(fmul8sux16, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(fmul8sux16, TCG_CALL_NO_RWG_SE, i64, i64, i64)

View File

@ -4656,6 +4656,7 @@ TRANS(FMUL8x16AU, VIS1, do_dff, a, gen_op_fmul8x16au)
TRANS(FMUL8x16AL, VIS1, do_dff, a, gen_op_fmul8x16al) TRANS(FMUL8x16AL, VIS1, do_dff, a, gen_op_fmul8x16al)
TRANS(FMULD8SUx16, VIS1, do_dff, a, gen_op_fmuld8sux16) TRANS(FMULD8SUx16, VIS1, do_dff, a, gen_op_fmuld8sux16)
TRANS(FMULD8ULx16, VIS1, do_dff, a, gen_op_fmuld8ulx16) TRANS(FMULD8ULx16, VIS1, do_dff, a, gen_op_fmuld8ulx16)
TRANS(FPMERGE, VIS1, do_dff, a, gen_helper_fpmerge)
static bool do_dfd(DisasContext *dc, arg_r_r_r *a, static bool do_dfd(DisasContext *dc, arg_r_r_r *a,
void (*func)(TCGv_i64, TCGv_i32, TCGv_i64)) void (*func)(TCGv_i64, TCGv_i32, TCGv_i64))
@ -4696,7 +4697,6 @@ static bool do_ddd(DisasContext *dc, arg_r_r_r *a,
TRANS(FMUL8SUx16, VIS1, do_ddd, a, gen_helper_fmul8sux16) TRANS(FMUL8SUx16, VIS1, do_ddd, a, gen_helper_fmul8sux16)
TRANS(FMUL8ULx16, VIS1, do_ddd, a, gen_helper_fmul8ulx16) TRANS(FMUL8ULx16, VIS1, do_ddd, a, gen_helper_fmul8ulx16)
TRANS(FPMERGE, VIS1, do_ddd, a, gen_helper_fpmerge)
TRANS(FPADD16, VIS1, do_ddd, a, tcg_gen_vec_add16_i64) TRANS(FPADD16, VIS1, do_ddd, a, tcg_gen_vec_add16_i64)
TRANS(FPADD32, VIS1, do_ddd, a, tcg_gen_vec_add32_i64) TRANS(FPADD32, VIS1, do_ddd, a, tcg_gen_vec_add32_i64)

View File

@ -74,22 +74,23 @@ typedef union {
float32 f; float32 f;
} VIS32; } VIS32;
uint64_t helper_fpmerge(uint64_t src1, uint64_t src2) uint64_t helper_fpmerge(uint32_t src1, uint32_t src2)
{ {
VIS64 s, d; VIS32 s1, s2;
VIS64 d;
s.ll = src1; s1.l = src1;
d.ll = src2; s2.l = src2;
d.ll = 0;
/* Reverse calculation order to handle overlap */ d.VIS_B64(7) = s1.VIS_B32(3);
d.VIS_B64(7) = s.VIS_B64(3); d.VIS_B64(6) = s2.VIS_B32(3);
d.VIS_B64(6) = d.VIS_B64(3); d.VIS_B64(5) = s1.VIS_B32(2);
d.VIS_B64(5) = s.VIS_B64(2); d.VIS_B64(4) = s2.VIS_B32(2);
d.VIS_B64(4) = d.VIS_B64(2); d.VIS_B64(3) = s1.VIS_B32(1);
d.VIS_B64(3) = s.VIS_B64(1); d.VIS_B64(2) = s2.VIS_B32(1);
d.VIS_B64(2) = d.VIS_B64(1); d.VIS_B64(1) = s1.VIS_B32(0);
d.VIS_B64(1) = s.VIS_B64(0); d.VIS_B64(0) = s2.VIS_B32(0);
/* d.VIS_B64(0) = d.VIS_B64(0); */
return d.ll; return d.ll;
} }