From: Florian Krohm Date: Tue, 19 Aug 2025 21:54:35 +0000 (+0000) Subject: s390: Support Iop_Mul8/16/32/64. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd643b0c5e7647b038f2c7c3c48447698e653789;p=thirdparty%2Fvalgrind.git s390: Support Iop_Mul8/16/32/64. Easy as pie and fewer special cases for iropt-test. --- diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c index 499c28b87..99e2e7a52 100644 --- a/VEX/priv/host_s390_isel.c +++ b/VEX/priv/host_s390_isel.c @@ -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));