diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2024-12-19 19:38:54 -0800 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2024-12-24 08:32:15 -0800 |
commit | 4ed2ba3f4abe6b3c03a905d44cdd18b3a3c1ce33 (patch) | |
tree | 29edfd27f0585d3147dc405ae40b57280d623c39 /tcg | |
parent | 4e9ce6a2ec73d42e12aedf21b255dc00b378fc8d (diff) | |
download | qemu-4ed2ba3f4abe6b3c03a905d44cdd18b3a3c1ce33.zip qemu-4ed2ba3f4abe6b3c03a905d44cdd18b3a3c1ce33.tar.gz qemu-4ed2ba3f4abe6b3c03a905d44cdd18b3a3c1ce33.tar.bz2 |
tcg/optimize: Simplify sign bit test in fold_shift
Merge the two conditions, sign != 0 && !(z_mask & sign),
by testing ~z_mask & sign. If sign == 0, the logical and
will produce false.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r-- | tcg/optimize.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index b70e9bd..26790f7 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2530,7 +2530,7 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op) static bool fold_shift(OptContext *ctx, TCGOp *op) { - uint64_t s_mask, z_mask, sign; + uint64_t s_mask, z_mask; TempOptInfo *t1, *t2; if (fold_const2(ctx, op) || @@ -2565,8 +2565,7 @@ static bool fold_shift(OptContext *ctx, TCGOp *op) * If the sign bit is known zero, then logical right shift * will not reduce the number of input sign repetitions. */ - sign = -s_mask; - if (sign && !(z_mask & sign)) { + if (~z_mask & -s_mask) { return fold_masks_s(ctx, op, s_mask); } break; |