[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 58/85] target/sparc: Move FMOVS, FNEGS, FABSS, FSRC*S, FNOT*S to
From: |
Richard Henderson |
Subject: |
[PATCH 58/85] target/sparc: Move FMOVS, FNEGS, FABSS, FSRC*S, FNOT*S to decodetree |
Date: |
Fri, 13 Oct 2023 14:28:19 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/sparc/insns.decode | 13 ++++++++
target/sparc/translate.c | 64 ++++++++++++++++-----------------------
2 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode
index 1418e45172..2072930bd7 100644
--- a/target/sparc/insns.decode
+++ b/target/sparc/insns.decode
@@ -33,6 +33,10 @@ CALL 01 i:s30
&r_r_r rd rs1 rs2
@r_r_r .. rd:5 ...... rs1:5 . ........ rs2:5 &r_r_r
+&r_r rd rs
+@r_r1 .. rd:5 ...... rs:5 . ........ ..... &r_r
+@r_r2 .. rd:5 ...... ..... . ........ rs:5 &r_r
+
Tcc_r 10 0 cond:4 111010 rs1:5 0 cc:1 0000000 rs2:5
Tcc_i 10 0 cond:4 111010 rs1:5 1 cc:1 0000 i:8
@@ -228,6 +232,10 @@ RESTORE 10 ..... 111101 ..... . .............
@r_r_ri
DONE 10 00000 111110 00000 0 0000000000000
RETRY 10 00001 111110 00000 0 0000000000000
+FMOVs 10 ..... 110100 00000 0 0000 0001 ..... @r_r2
+FNEGs 10 ..... 110100 00000 0 0000 0101 ..... @r_r2
+FABSs 10 ..... 110100 00000 0 0000 1001 ..... @r_r2
+
{
[
EDGE8cc 10 ..... 110110 ..... 0 0000 0000 ..... @r_r_r
@@ -251,6 +259,11 @@ RETRY 10 00001 111110 00000 0 0000000000000
ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r
BMASK 10 ..... 110110 ..... 0 0001 1001 ..... @r_r_r
+
+ FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s
+ FSRCs 10 ..... 110110 00000 0 0111 1001 ..... @r_r2 # FSRC2s
+ FNOTs 10 ..... 110110 ..... 0 0110 1011 00000 @r_r1 # FNOT1s
+ FNOTs 10 ..... 110110 00000 0 0110 0111 ..... @r_r2 # FNOT2s
]
NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1
}
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index d0efe9f72b..c2fe193b6d 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -1481,19 +1481,6 @@ static void gen_fop_FF(DisasContext *dc, int rd, int rs,
gen_store_fpr_F(dc, rd, dst);
}
-static void gen_ne_fop_FF(DisasContext *dc, int rd, int rs,
- void (*gen)(TCGv_i32, TCGv_i32))
-{
- TCGv_i32 dst, src;
-
- src = gen_load_fpr_F(dc, rs);
- dst = gen_dest_fpr_F(dc);
-
- gen(dst, src);
-
- gen_store_fpr_F(dc, rd, dst);
-}
-
static void gen_fop_FFF(DisasContext *dc, int rd, int rs1, int rs2,
void (*gen)(TCGv_i32, TCGv_ptr, TCGv_i32, TCGv_i32))
{
@@ -4823,6 +4810,27 @@ static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a,
MemOp mop)
TRANS(STFSR, ALL, do_stfsr, a, MO_TEUL)
TRANS(STXFSR, 64, do_stfsr, a, MO_TEUQ)
+static bool do_ff(DisasContext *dc, arg_r_r *a,
+ void (*func)(TCGv_i32, TCGv_i32))
+{
+ TCGv_i32 tmp;
+
+ if (gen_trap_ifnofpu(dc)) {
+ return true;
+ }
+
+ tmp = gen_load_fpr_F(dc, a->rs);
+ func(tmp, tmp);
+ gen_store_fpr_F(dc, a->rd, tmp);
+ return advance_pc(dc);
+}
+
+TRANS(FMOVs, ALL, do_ff, a, tcg_gen_mov_i32)
+TRANS(FNEGs, ALL, do_ff, a, gen_helper_fnegs)
+TRANS(FABSs, ALL, do_ff, a, gen_helper_fabss)
+TRANS(FSRCs, VIS1, do_ff, a, tcg_gen_mov_i32)
+TRANS(FNOTs, VIS1, do_ff, a, tcg_gen_not_i32)
+
#define CHECK_IU_FEATURE(dc, FEATURE) \
if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE)) \
goto illegal_insn;
@@ -4864,15 +4872,9 @@ static void disas_sparc_legacy(DisasContext *dc,
unsigned int insn)
switch (xop) {
case 0x1: /* fmovs */
- cpu_src1_32 = gen_load_fpr_F(dc, rs2);
- gen_store_fpr_F(dc, rd, cpu_src1_32);
- break;
case 0x5: /* fnegs */
- gen_ne_fop_FF(dc, rd, rs2, gen_helper_fnegs);
- break;
case 0x9: /* fabss */
- gen_ne_fop_FF(dc, rd, rs2, gen_helper_fabss);
- break;
+ g_assert_not_reached(); /* in decodetree */
case 0x29: /* fsqrts */
gen_fop_FF(dc, rd, rs2, gen_helper_fsqrts);
break;
@@ -5200,6 +5202,10 @@ static void disas_sparc_legacy(DisasContext *dc,
unsigned int insn)
case 0x018: /* VIS I alignaddr */
case 0x01a: /* VIS I alignaddrl */
case 0x019: /* VIS II bmask */
+ case 0x067: /* VIS I fnot2s */
+ case 0x06b: /* VIS I fnot1s */
+ case 0x075: /* VIS I fsrc1s */
+ case 0x079: /* VIS I fsrc2s */
g_assert_not_reached(); /* in decodetree */
case 0x020: /* VIS I fcmple16 */
CHECK_FPU_FEATURE(dc, VIS1);
@@ -5387,10 +5393,6 @@ static void disas_sparc_legacy(DisasContext *dc,
unsigned int insn)
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DD(dc, rd, rs2, tcg_gen_not_i64);
break;
- case 0x067: /* VIS I fnot2s */
- CHECK_FPU_FEATURE(dc, VIS1);
- gen_ne_fop_FF(dc, rd, rs2, tcg_gen_not_i32);
- break;
case 0x068: /* VIS I fandnot1 */
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_andc_i64);
@@ -5403,10 +5405,6 @@ static void disas_sparc_legacy(DisasContext *dc,
unsigned int insn)
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DD(dc, rd, rs1, tcg_gen_not_i64);
break;
- case 0x06b: /* VIS I fnot1s */
- CHECK_FPU_FEATURE(dc, VIS1);
- gen_ne_fop_FF(dc, rd, rs1, tcg_gen_not_i32);
- break;
case 0x06c: /* VIS I fxor */
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_xor_i64);
@@ -5444,11 +5442,6 @@ static void disas_sparc_legacy(DisasContext *dc,
unsigned int insn)
cpu_src1_64 = gen_load_fpr_D(dc, rs1);
gen_store_fpr_D(dc, rd, cpu_src1_64);
break;
- case 0x075: /* VIS I fsrc1s */
- CHECK_FPU_FEATURE(dc, VIS1);
- cpu_src1_32 = gen_load_fpr_F(dc, rs1);
- gen_store_fpr_F(dc, rd, cpu_src1_32);
- break;
case 0x076: /* VIS I fornot2 */
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs1, rs2, tcg_gen_orc_i64);
@@ -5462,11 +5455,6 @@ static void disas_sparc_legacy(DisasContext *dc,
unsigned int insn)
cpu_src1_64 = gen_load_fpr_D(dc, rs2);
gen_store_fpr_D(dc, rd, cpu_src1_64);
break;
- case 0x079: /* VIS I fsrc2s */
- CHECK_FPU_FEATURE(dc, VIS1);
- cpu_src1_32 = gen_load_fpr_F(dc, rs2);
- gen_store_fpr_F(dc, rd, cpu_src1_32);
- break;
case 0x07a: /* VIS I fornot1 */
CHECK_FPU_FEATURE(dc, VIS1);
gen_ne_fop_DDD(dc, rd, rs2, rs1, tcg_gen_orc_i64);
--
2.34.1
- [PATCH 54/85] target/sparc: Move EDGE* to decodetree, (continued)
- [PATCH 54/85] target/sparc: Move EDGE* to decodetree, Richard Henderson, 2023/10/13
- [PATCH 56/85] target/sparc: Move ADDRALIGN* to decodetree, Richard Henderson, 2023/10/13
- [PATCH 57/85] target/sparc: Move BMASK to decodetree, Richard Henderson, 2023/10/13
- [PATCH 60/85] target/sparc: Use tcg_gen_vec_{add,sub}*, Richard Henderson, 2023/10/13
- [PATCH 49/85] target/sparc: Split out fp ldst functions with asi precomputed, Richard Henderson, 2023/10/13
- [PATCH 55/85] target/sparc: Move ARRAY* to decodetree, Richard Henderson, 2023/10/13
- [PATCH 59/85] target/sparc: Move FMOVD, FNEGD, FABSD, FSRC*D, FNOT*D to decodetree, Richard Henderson, 2023/10/13
- [PATCH 61/85] target/sparc: Move gen_ne_fop_FFF insns to decodetree, Richard Henderson, 2023/10/13
- [PATCH 62/85] target/sparc: Move gen_ne_fop_DDD insns to decodetree, Richard Henderson, 2023/10/13
- [PATCH 68/85] target/sparc: Move gen_fop_FFF insns to decodetree, Richard Henderson, 2023/10/13
- [PATCH 58/85] target/sparc: Move FMOVS, FNEGS, FABSS, FSRC*S, FNOT*S to decodetree,
Richard Henderson <=
- [PATCH 66/85] target/sparc: Move gen_fop_DD insns to decodetree, Richard Henderson, 2023/10/13
- [PATCH 67/85] target/sparc: Move FSQRTq to decodetree, Richard Henderson, 2023/10/13
- [PATCH 69/85] target/sparc: Move gen_fop_DDD insns to decodetree, Richard Henderson, 2023/10/13
- [PATCH 72/85] target/sparc: Move FDMULQ to decodetree, Richard Henderson, 2023/10/13
- [PATCH 70/85] target/sparc: Move gen_fop_QQQ insns to decodetree, Richard Henderson, 2023/10/13
- [PATCH 63/85] target/sparc: Move PDIST to decodetree, Richard Henderson, 2023/10/13
- [PATCH 64/85] target/sparc: Move gen_gsr_fop_DDD insns to decodetree, Richard Henderson, 2023/10/13
- [PATCH 65/85] target/sparc: Move gen_fop_FF insns to decodetree, Richard Henderson, 2023/10/13
- [PATCH 71/85] target/sparc: Move FSMULD to decodetree, Richard Henderson, 2023/10/13
- [PATCH 75/85] target/sparc: Move FqTOs, FqTOi to decodetree, Richard Henderson, 2023/10/13