]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
ir_opt.c: Algebraic simplification for Iop_Sub.
authorFlorian Krohm <flo2030@eich-krohm.de>
Wed, 3 Sep 2025 15:03:08 +0000 (15:03 +0000)
committerFlorian Krohm <flo2030@eich-krohm.de>
Wed, 3 Sep 2025 15:03:08 +0000 (15:03 +0000)
The simplification rules for IopSub32/64 also apply for Iop_Sub8/16.

VEX/priv/ir_opt.c

index 84bc4e021ff2d41963b05a61477ce3fd0200b130..b362be007efa636d8e2d5e56b6688a6c786443ab 100644 (file)
@@ -2654,19 +2654,22 @@ static IRExpr* fold_Expr_WRK ( IRExpr** env, IRExpr* e )
                }
                break;
 
+            case Iop_Sub8:
+            case Iop_Sub16:
             case Iop_Sub32:
             case Iop_Sub64:
-               /* Sub32/Sub64(x,0) ==> x */
+               /* Sub8/Sub16/Sub32/Sub64(x,0) ==> x */
                if (isZeroU(e->Iex.Binop.arg2)) {
                   e2 = e->Iex.Binop.arg1;
                   break;
                }
-               /* Sub32/Sub64(t,t) ==> 0, for some IRTemp t */
+               /* Sub8/Sub16/Sub32/Sub64(t,t) ==> 0, for some IRTemp t */
                if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) {
                   e2 = mkZeroOfPrimopResultType(e->Iex.Binop.op);
                   break;
                }
                break;
+
             case Iop_Sub8x16:
                /* Sub8x16(x,0) ==> x */
                if (isZeroV128(e->Iex.Binop.arg2)) {