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>
---
tcg/optimize.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index 052b5a060e..e53e6b6969 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2513,7 +2513,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) ||
@@ -2548,8 +2548,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;
--
2.43.0