]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390: Merge s390_format_VRS_VRDV and s390_format_VRS_VRDVM
authorFlorian Krohm <flo2030@eich-krohm.de>
Thu, 22 Jan 2026 20:03:37 +0000 (20:03 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Thu, 22 Jan 2026 20:03:37 +0000 (20:03 +0000)
Add unused m4 parameter to s390_irgen_VLM / _VSTM. That way we no longer need
to distinguish between s390_format_VRS_VRDV and s390_format_VRS_VRDVM.
Rename remaining function to s390_format_VRSa and use it throughout.

Add field access macros VRSa_v1 and so on.

VEX/priv/guest_s390_toIR.c

index 14132ce394ba6d07e64b0419d0d48f2a51384729..01d8b9bfa69c03587b3db30cc3316b60bd5ee2fe 100644 (file)
@@ -285,6 +285,12 @@ typedef enum {
 #define VRS_d2(insn) (((insn) >> 32) & 0xfff)
 #define VRS_m4(insn) (((insn) >> 28) & 0xf)
 #define VRS_rxb(insn) (((insn) >> 24) & 0xf)
+#define VRSa_v1(insn) (((insn) >> 52) & 0xf)
+#define VRSa_v3(insn) (((insn) >> 48) & 0xf)
+#define VRSa_b2(insn) (((insn) >> 44) & 0xf)
+#define VRSa_d2(insn) (((insn) >> 32) & 0xfff)
+#define VRSa_m4(insn) (((insn) >> 28) & 0xf)
+#define VRSa_rxb(insn) (((insn) >> 24) & 0xf)
 #define VRSc_r1(insn) (((insn) >> 52) & 0xf)
 #define VRSc_v3(insn) (((insn) >> 48) & 0xf)
 #define VRSc_b2(insn) (((insn) >> 44) & 0xf)
@@ -3222,9 +3228,8 @@ s390_format_VRS_RRDV(void (*irgen)(UChar v1, UChar r3, IRTemp op2addr),
 
 
 static void
-s390_format_VRS_VRDVM(void (*irgen)(UChar v1, IRTemp op2addr, UChar v3,
-                      UChar m4), UChar v1, UChar b2, UShort d2, UChar v3,
-                      UChar m4, UChar rxb)
+s390_format_VRSa(void (*irgen)(UChar v1, IRTemp op2addr, UChar v3, UChar m4),
+                 UChar v1, UChar b2, UShort d2, UChar v3, UChar m4, UChar rxb)
 {
    IRTemp op2addr = newTemp(Ity_I64);
 
@@ -3242,26 +3247,6 @@ s390_format_VRS_VRDVM(void (*irgen)(UChar v1, IRTemp op2addr, UChar v3,
 }
 
 
-static void
-s390_format_VRS_VRDV(void (*irgen)(UChar v1, IRTemp op2addr, UChar v3),
-                     UChar v1, UChar b2, UShort d2, UChar v3, UChar m4, UChar rxb)
-{
-   IRTemp op2addr = newTemp(Ity_I64);
-
-   if (! s390_host_has_vx) {
-      emulation_failure(EmFail_S390X_vx);
-      return;
-   }
-
-   assign(op2addr, binop(Iop_Add64, mkU64(d2), b2 != 0 ? get_gpr_dw0(b2) :
-          mkU64(0)));
-
-   v1  = s390_vr_getVRindex(v1, 1, rxb);
-   v3  = s390_vr_getVRindex(v3, 2, rxb);
-   irgen(v1, op2addr, v3);
-}
-
-
 static void
 s390_format_VRS_VRRDM(void (*irgen)(UChar v1, IRTemp op2addr, UChar r3,
                                     UChar m4),
@@ -14302,7 +14287,8 @@ s390_irgen_VGEG(UChar v1, IRTemp op2addr, UChar m3)
 }
 
 static void
-s390_irgen_VLM(UChar v1, IRTemp op2addr, UChar v3)
+s390_irgen_VLM(UChar v1, IRTemp op2addr, UChar v3,
+               UChar m4 __attribute__((unused)))   /* alignment hint */
 {
    s390_insn_assert(v3 >= v1);
    s390_insn_assert(v3 - v1 <= 16);
@@ -14471,7 +14457,8 @@ s390_irgen_VSTEG(UChar v1, IRTemp op2addr, UChar m3)
 }
 
 static void
-s390_irgen_VSTM(UChar v1, IRTemp op2addr, UChar v3)
+s390_irgen_VSTM(UChar v1, IRTemp op2addr, UChar v3,
+                UChar m4 __attribute__((unused)))   /* alignment hint */
 {
    s390_insn_assert(v3 >= v1);
    s390_insn_assert(v3 - v1 <= 16);
@@ -19513,31 +19500,39 @@ s390_decode_6byte_and_irgen(const UChar *bytes)
                                            RXE_x2(ovl), RXE_b2(ovl),
                                            RXE_d2(ovl), RXE_m3(ovl));
                            goto ok;
-   case 0xe70000000030ULL: s390_format_VRS_VRDVM(s390_irgen_VESL, VRS_v1(ovl),
-                                                 VRS_b2(ovl), VRS_d2(ovl),
-                                                 VRS_v3(ovl), VRS_m4(ovl),
-                                                 VRS_rxb(ovl));  goto ok;
-   case 0xe70000000033ULL: s390_format_VRS_VRDVM(s390_irgen_VERLL, VRS_v1(ovl),
-                                                 VRS_b2(ovl), VRS_d2(ovl),
-                                                 VRS_v3(ovl), VRS_m4(ovl),
-                                                 VRS_rxb(ovl));  goto ok;
-   case 0xe70000000036ULL: s390_format_VRS_VRDV(s390_irgen_VLM, VRS_v1(ovl),
-                                                VRS_b2(ovl), VRS_d2(ovl), VRS_v3(ovl),
-                                                VRS_m4(ovl), VRS_rxb(ovl));  goto ok;
+   case 0xe70000000030ULL: s390_format_VRSa(s390_irgen_VESL, VRSa_v1(ovl),
+                                            VRSa_b2(ovl), VRSa_d2(ovl),
+                                            VRSa_v3(ovl), VRSa_m4(ovl),
+                                            VRSa_rxb(ovl));
+                           goto ok;
+   case 0xe70000000033ULL: s390_format_VRSa(s390_irgen_VERLL, VRSa_v1(ovl),
+                                            VRSa_b2(ovl), VRSa_d2(ovl),
+                                            VRSa_v3(ovl), VRSa_m4(ovl),
+                                            VRSa_rxb(ovl));
+                           goto ok;
+   case 0xe70000000036ULL: s390_format_VRSa(s390_irgen_VLM, VRSa_v1(ovl),
+                                            VRSa_b2(ovl), VRSa_d2(ovl),
+                                            VRSa_v3(ovl), VRSa_m4(ovl),
+                                            VRSa_rxb(ovl));
+                           goto ok;
    case 0xe70000000037ULL: s390_format_VRS_VRRD(s390_irgen_VLL, VRS_v1(ovl),
                                                 VRS_b2(ovl), VRS_d2(ovl), VRS_r3(ovl),
                                                 VRS_rxb(ovl));  goto ok;
-   case 0xe70000000038ULL: s390_format_VRS_VRDVM(s390_irgen_VESRL, VRS_v1(ovl),
-                                                 VRS_b2(ovl), VRS_d2(ovl),
-                                                 VRS_v3(ovl), VRS_m4(ovl),
-                                                 VRS_rxb(ovl));  goto ok;
-   case 0xe7000000003aULL: s390_format_VRS_VRDVM(s390_irgen_VESRA, VRS_v1(ovl),
-                                                 VRS_b2(ovl), VRS_d2(ovl),
-                                                 VRS_v3(ovl), VRS_m4(ovl),
-                                                 VRS_rxb(ovl));  goto ok;
-   case 0xe7000000003eULL: s390_format_VRS_VRDV(s390_irgen_VSTM, VRS_v1(ovl),
-                                                VRS_b2(ovl), VRS_d2(ovl), VRS_v3(ovl),
-                                                VRS_m4(ovl), VRS_rxb(ovl));  goto ok;
+   case 0xe70000000038ULL: s390_format_VRSa(s390_irgen_VESRL, VRSa_v1(ovl),
+                                            VRSa_b2(ovl), VRSa_d2(ovl),
+                                            VRSa_v3(ovl), VRSa_m4(ovl),
+                                            VRSa_rxb(ovl));
+                           goto ok;
+   case 0xe7000000003aULL: s390_format_VRSa(s390_irgen_VESRA, VRSa_v1(ovl),
+                                            VRSa_b2(ovl), VRSa_d2(ovl),
+                                            VRSa_v3(ovl), VRSa_m4(ovl),
+                                            VRSa_rxb(ovl));
+                           goto ok;
+   case 0xe7000000003eULL: s390_format_VRSa(s390_irgen_VSTM, VRSa_v1(ovl),
+                                            VRSa_b2(ovl), VRSa_d2(ovl),
+                                            VRSa_v3(ovl), VRSa_m4(ovl),
+                                            VRSa_rxb(ovl));
+                           goto ok;
    case 0xe7000000003fULL: s390_format_VRS_VRRD(s390_irgen_VSTL, VRS_v1(ovl),
                                                 VRS_b2(ovl), VRS_d2(ovl), VRS_r3(ovl),
                                                 VRS_rxb(ovl));  goto ok;