aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-16 15:15:40 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-16 15:15:40 +0000
commit3ae1cc909273683bc08e3a03b67984d8de035237 (patch)
treeb6733f347deabb26123cd915133b4007c4eda4c1 /gcc/optabs.c
parentf72a5e61748af6eebe662bac07f42308df23a9ac (diff)
PR rtl-optimization/69764
PR rtl-optimization/69771 * optabs.c (expand_binop): Ensure for shift optabs invalid CONST_INT op1 is valid for GET_MODE_INNER (mode) and force it into a reg. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233456 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index b651878b725..a6d8822b87e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1125,6 +1125,16 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1,
op1 = negate_rtx (mode, op1);
binoptab = add_optab;
}
+ /* For shifts, constant invalid op1 might be expanded from different
+ mode than MODE. As those are invalid, force them to a register
+ to avoid further problems during expansion. */
+ else if (CONST_INT_P (op1)
+ && shift_optab_p (binoptab)
+ && UINTVAL (op1) >= GET_MODE_BITSIZE (GET_MODE_INNER (mode)))
+ {
+ op1 = gen_int_mode (INTVAL (op1), GET_MODE_INNER (mode));
+ op1 = force_reg (GET_MODE_INNER (mode), op1);
+ }
/* Record where to delete back to if we backtrack. */
last = get_last_insn ();