]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
s390: Support Iop_Mul8/16/32/64.
authorFlorian Krohm <flo2030@eich-krohm.de>
Tue, 19 Aug 2025 21:54:35 +0000 (21:54 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Tue, 19 Aug 2025 21:54:35 +0000 (21:54 +0000)
Easy as pie and fewer special cases for iropt-test.

VEX/priv/host_s390_isel.c

index 499c28b87332215981a84148bc654fe0031aeedc..99e2e7a524f8e53de2eb8bb73fadaad2dc9165f0 100644 (file)
@@ -1243,10 +1243,17 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr)
       s390_opnd_RMI op2, value, opnd;
       s390_insn *insn;
       Bool is_commutative, is_signed_multiply, is_signed_divide;
+      Bool is_single_multiply = False;
 
       is_commutative = True;
 
       switch (expr->Iex.Binop.op) {
+      case Iop_Mul8:
+      case Iop_Mul16:
+      case Iop_Mul32:
+      case Iop_Mul64:
+         is_single_multiply = True;
+         /* fall through */
       case Iop_MullU8:
       case Iop_MullU16:
       case Iop_MullU32:
@@ -1271,7 +1278,7 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr)
 
       do_multiply: {
             HReg r10, r11;
-            UInt arg_size = size / 2;
+            UInt arg_size = is_single_multiply ? size : size / 2;
 
             order_commutative_operands(arg1, arg2);
 
@@ -1296,6 +1303,12 @@ s390_isel_int_expr_wrk(ISelEnv *env, IRExpr *expr)
                return res;
             }
 
+            /* For Iop_Mul64 the result is in r11[0:63] */
+            if (expr->Iex.Binop.op == Iop_Mul64) {
+               addInstr(env, s390_insn_move(size, res, r11));
+               return res;
+            }
+
             /* The result is in registers r10 and r11. Combine them into a SIZE-bit
                value into the destination register. */
             addInstr(env, s390_insn_move(arg_size, res, r10));