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>
This commit is contained in:
parent
4e9ce6a2ec
commit
4ed2ba3f4a
@ -2530,7 +2530,7 @@ static bool fold_sextract(OptContext *ctx, TCGOp *op)
|
|||||||
|
|
||||||
static bool fold_shift(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;
|
TempOptInfo *t1, *t2;
|
||||||
|
|
||||||
if (fold_const2(ctx, op) ||
|
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
|
* If the sign bit is known zero, then logical right shift
|
||||||
* will not reduce the number of input sign repetitions.
|
* will not reduce the number of input sign repetitions.
|
||||||
*/
|
*/
|
||||||
sign = -s_mask;
|
if (~z_mask & -s_mask) {
|
||||||
if (sign && !(z_mask & sign)) {
|
|
||||||
return fold_masks_s(ctx, op, s_mask);
|
return fold_masks_s(ctx, op, s_mask);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user