@samitouri / QOSamiQemu / commits / 638e8e64fd

target/mips: split Octeon SEQI/SNEI decode

Decode the equality and inequality forms as explicit SEQI/SNEI instructions rather than using shared generated SEQNEI entries. The explicit decoder names match the architectural mnemonics, which makes the translator entry points and trace/debug output easier to correlate with the instruction set. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> [PMD: Split SEQNE vs SEQNEI (this patch)] Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20260520172313.23777-10-philmd@linaro.org>

James Hilliard committed Apr 21, 2026 at 11:27 UTC 638e8e64fd53abf890e4bc3b208e1b3fab1f005b
2 files changed +16 -15
target/mips/tcg/octeon.decode
+3 -1
@@ -30,6 +30,7 @@ BBIT 11 set:1 . 10 rs:5 ..... offset:s16 p=%bbit_p
30 # SNEI rt, rs, immediate
31
32 @r3 ...... rs:5 rt:5 rd:5 ..... ......
33 +&cmpi rs rt imm
34 %bitfield_p 0:1 6:5
35 @bitfield ...... rs:5 rt:5 lenm1:5 ..... ..... . p=%bitfield_p
36
@@ -40,7 +41,8 @@ CINS 011100 ..... ..... ..... ..... 11001 . @bitfield
41 POP 011100 rs:5 00000 rd:5 00000 10110 dw:1
42 SEQ 011100 ..... ..... ..... 00000 101010 @r3
43 SNE 011100 ..... ..... ..... 00000 101011 @r3
43 -SEQNEI 011100 rs:5 rt:5 imm:s10 10111 ne:1
44 +SEQI 011100 rs:5 rt:5 imm:s10 101110 &cmpi
45 +SNEI 011100 rs:5 rt:5 imm:s10 101111 &cmpi
46
47 &lx base index rd
48 @lx ...... base:5 index:5 rd:5 ...... ..... &lx
target/mips/tcg/octeon_translate.c
+13 -14
@@ -132,29 +132,28 @@ static bool trans_SNE(DisasContext *ctx, arg_SNE *a)
132 return do_seq_sne(ctx, a, TCG_COND_NE);
133 }
134
135 -static bool trans_SEQNEI(DisasContext *ctx, arg_SEQNEI *a)
135 +static bool do_seqi_snei(DisasContext *ctx, const arg_cmpi *a, TCGCond cond)
136 {
137 TCGv_i64 t0;
138
139 - if (a->rt == 0) {
140 - /* nop */
141 - return true;
142 - }
143 -
139 t0 = tcg_temp_new_i64();
145 -
140 gen_load_gpr(t0, a->rs);
141
148 - /* Sign-extend to 64 bit value */
149 - target_ulong imm = a->imm;
150 - if (a->ne) {
151 - tcg_gen_setcondi_i64(TCG_COND_NE, cpu_gpr[a->rt], t0, imm);
152 - } else {
153 - tcg_gen_setcondi_i64(TCG_COND_EQ, cpu_gpr[a->rt], t0, imm);
154 - }
142 + tcg_gen_setcondi_i64(cond, t0, t0, a->imm);
143 + gen_store_gpr(t0, a->rt);
144 return true;
145 }
146
147 +static bool trans_SEQI(DisasContext *ctx, arg_SEQI *a)
148 +{
149 + return do_seqi_snei(ctx, a, TCG_COND_EQ);
150 +}
151 +
152 +static bool trans_SNEI(DisasContext *ctx, arg_SNEI *a)
153 +{
154 + return do_seqi_snei(ctx, a, TCG_COND_NE);
155 +}
156 +
157 static bool trans_lx(DisasContext *ctx, arg_lx *a, MemOp mop)
158 {
159 gen_lx(ctx, a->rd, a->base, a->index, mop);