]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
tcg/optimize: Build and use z_bits and o_bits in fold_nor
authorRichard Henderson <richard.henderson@linaro.org>
Tue, 10 Dec 2024 03:13:02 +0000 (21:13 -0600)
committerRichard Henderson <richard.henderson@linaro.org>
Mon, 30 Jun 2025 13:42:37 +0000 (07:42 -0600)
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/optimize.c

index 758f7b142ee1b3fccc8556305708835be29e77ea..29d1f29124e5f1d491c3a3c4311eed53742fce54 100644 (file)
@@ -2231,16 +2231,22 @@ static bool fold_neg(OptContext *ctx, TCGOp *op)
 
 static bool fold_nor(OptContext *ctx, TCGOp *op)
 {
-    uint64_t s_mask;
+    uint64_t z_mask, o_mask, s_mask;
+    TempOptInfo *t1, *t2;
 
     if (fold_const2_commutative(ctx, op) ||
         fold_xi_to_not(ctx, op, 0)) {
         return true;
     }
 
-    s_mask = arg_info(op->args[1])->s_mask
-           & arg_info(op->args[2])->s_mask;
-    return fold_masks_s(ctx, op, s_mask);
+    t1 = arg_info(op->args[1]);
+    t2 = arg_info(op->args[2]);
+
+    z_mask = ~(t1->o_mask | t2->o_mask);
+    o_mask = ~(t1->z_mask | t2->z_mask);
+    s_mask = t1->s_mask & t2->s_mask;
+
+    return fold_masks_zos(ctx, op, z_mask, o_mask, s_mask);
 }
 
 static bool fold_not(OptContext *ctx, TCGOp *op)