From: Víctor Colombo <[email protected]>

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 <[email protected]>
Signed-off-by: Matheus Ferst <[email protected]>
---
 target/ppc/translate/vsx-impl.c.inc | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

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)
 {
-- 
2.25.1


Reply via email to