diff mbox series

[32/37] target/ppc: Implement do_helper_XX3 and move xxperm* to use it

Message ID 20220107185653.1609775-33-matheus.ferst@eldorado.org.br
State Superseded
Headers show
Series target/ppc: PowerISA Vector/VSX instruction batch | expand

Commit Message

Matheus K. Ferst Jan. 7, 2022, 6:56 p.m. UTC
From: Víctor Colombo <victor.colombo@eldorado.org.br>

do_helper_XX3 is a wrapper for instructions that only call its helper.
It will be used later to implement instructions like xscmp*dp.

Signed-off-by: Víctor Colombo <victor.colombo@eldorado.org.br>
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 target/ppc/translate/vsx-impl.c.inc | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/target/ppc/translate/vsx-impl.c.inc b/target/ppc/translate/vsx-impl.c.inc
index 69bfa742b7..b31e363c1b 100644
--- a/target/ppc/translate/vsx-impl.c.inc
+++ b/target/ppc/translate/vsx-impl.c.inc
@@ -1160,7 +1160,8 @@  GEN_VSX_HELPER_X2(xvrspiz, 0x12, 0x09, 0, PPC2_VSX)
 GEN_VSX_HELPER_2(xvtstdcsp, 0x14, 0x1A, 0, PPC2_VSX)
 GEN_VSX_HELPER_2(xvtstdcdp, 0x14, 0x1E, 0, PPC2_VSX)
 
-static bool trans_XXPERM(DisasContext *ctx, arg_XX3 *a)
+static bool do_helper_XX3(DisasContext *ctx, arg_XX3 *a,
+    void (*helper)(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr))
 {
     TCGv_ptr xt, xa, xb;
 
@@ -1171,7 +1172,7 @@  static bool trans_XXPERM(DisasContext *ctx, arg_XX3 *a)
     xa = gen_vsr_ptr(a->xa);
     xb = gen_vsr_ptr(a->xb);
 
-    gen_helper_VPERM(xt, xa, xt, xb);
+    helper(cpu_env, xt, xa, xb);
 
     tcg_temp_free_ptr(xt);
     tcg_temp_free_ptr(xa);
@@ -1180,25 +1181,8 @@  static bool trans_XXPERM(DisasContext *ctx, arg_XX3 *a)
     return true;
 }
 
-static bool trans_XXPERMR(DisasContext *ctx, arg_XX3 *a)
-{
-    TCGv_ptr xt, xa, xb;
-
-    REQUIRE_INSNS_FLAGS2(ctx, ISA300);
-    REQUIRE_VSX(ctx);
-
-    xt = gen_vsr_ptr(a->xt);
-    xa = gen_vsr_ptr(a->xa);
-    xb = gen_vsr_ptr(a->xb);
-
-    gen_helper_VPERMR(xt, xa, xt, xb);
-
-    tcg_temp_free_ptr(xt);
-    tcg_temp_free_ptr(xa);
-    tcg_temp_free_ptr(xb);
-
-    return true;
-}
+TRANS(XXPERM, do_helper_XX3, gen_helper_VPERM);
+TRANS(XXPERMR, do_helper_XX3, gen_helper_VPERMR);
 
 static bool trans_XXPERMDI(DisasContext *ctx, arg_XX3_dm *a)
 {