target/mips: drop Octeon zero-register fast paths
EXTS, CINS, and POP route their destination writes through gen_store_gpr(), which already discards writes to $zero. Remove the remaining translator fast paths for destination $zero so these Octeon instructions follow the same shape as BADDU/DMUL and the generic MIPS translator helpers. Add a mips64/mips64el linux-user TCG smoke test for representative Octeon population count instruction paths. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20260520172313.23777-8-philmd@linaro.org>
James Hilliard committed
Apr 21, 2026 at 17:10 UTC
7b786e1f3eb77e9bc13fffac7f7bb5be85a7e9c6
2 files changed
+16
-15
target/mips/tcg/octeon_translate.c
-15
@@ -74,11 +74,6 @@ static bool trans_EXTS(DisasContext *ctx, arg_EXTS *a)
74
{
75
TCGv_i64 t0;
76
77
- if (a->rt == 0) {
78
- /* nop */
79
- return true;
80
- }
81
-
77
t0 = tcg_temp_new_i64();
78
gen_load_gpr(t0, a->rs);
79
tcg_gen_sextract_i64(t0, t0, a->p, a->lenm1 + 1);
@@ -90,11 +85,6 @@ static bool trans_CINS(DisasContext *ctx, arg_CINS *a)
85
{
86
TCGv_i64 t0;
87
93
- if (a->rt == 0) {
94
- /* nop */
95
- return true;
96
- }
97
-
88
t0 = tcg_temp_new_i64();
89
gen_load_gpr(t0, a->rs);
90
tcg_gen_deposit_z_i64(t0, t0, a->p, a->lenm1 + 1);
@@ -106,11 +96,6 @@ static bool trans_POP(DisasContext *ctx, arg_POP *a)
96
{
97
TCGv_i64 t0;
98
109
- if (a->rd == 0) {
110
- /* nop */
111
- return true;
112
- }
113
-
99
t0 = tcg_temp_new_i64();
100
gen_load_gpr(t0, a->rs);
101
if (!a->dw) {
tests/tcg/mips/user/isa/octeon/octeon-insns.c
+16
@@ -39,10 +39,26 @@ static uint64_t octeon_dmul(uint64_t rs, uint64_t rt)
39
return rd;
40
}
41
42
+static uint64_t octeon_dpop(uint64_t rs)
43
+{
44
+ uint64_t rd;
45
+
46
+ asm volatile(
47
+ "move $8, %[rs]\n\t"
48
+ ".word 0x7100502d\n\t" /* dpop $10, $8 */
49
+ "move %[rd], $10\n\t"
50
+ : [rd] "=r" (rd)
51
+ : [rs] "r" (rs)
52
+ : "$8", "$10");
53
+
54
+ return rd;
55
+}
56
+
57
int main(void)
58
{
59
assert(octeon_baddu(0x123, 0x0f0) == 0x13);
60
assert(octeon_dmul(0x12345678, 0x10) == 0x123456780);
61
+ assert(octeon_dpop(0xf0f0f0f0f0f0f0f0ULL) == 32);
62
63
return 0;
64
}