diff options
Diffstat (limited to 'gcc/simplify-rtx.cc')
-rw-r--r-- | gcc/simplify-rtx.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 6f969ef..06b52ca 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -1709,6 +1709,17 @@ simplify_context::simplify_unary_operation_1 (rtx_code code, machine_mode mode, if (GET_MODE (op) == mode) return op; + /* (zero_extend:SI (and:QI X (const))) -> (and:SI (lowpart:SI X) const) + where const does not sign bit set. */ + if (GET_CODE (op) == AND + && CONST_INT_P (XEXP (op, 1)) + && INTVAL (XEXP (op, 1)) > 0) + { + rtx tem = rtl_hooks.gen_lowpart_no_emit (mode, XEXP (op, 0)); + if (tem) + return simplify_gen_binary (AND, mode, tem, XEXP (op, 1)); + } + /* Check for a zero extension of a subreg of a promoted variable, where the promotion is zero-extended, and the target mode is the same as the variable's promotion. */ @@ -6465,14 +6476,16 @@ simplify_context::simplify_relational_operation_1 (rtx_code code, case LEU: /* (eq (popcount x) (const_int 0)) -> (eq x (const_int 0)). */ return simplify_gen_relational (EQ, mode, GET_MODE (XEXP (op0, 0)), - XEXP (op0, 0), const0_rtx); + XEXP (op0, 0), + CONST0_RTX (GET_MODE (XEXP (op0, 0)))); case NE: case GT: case GTU: /* (ne (popcount x) (const_int 0)) -> (ne x (const_int 0)). */ return simplify_gen_relational (NE, mode, GET_MODE (XEXP (op0, 0)), - XEXP (op0, 0), const0_rtx); + XEXP (op0, 0), + CONST0_RTX (GET_MODE (XEXP (op0, 0)))); default: break; |