+2015-06-25 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/65979
+ PR target/66611
+ * config/sh/sh.md (tstsi_t peephole2): Use insn_invalid_p to check if
+ the replacement insn will work.
+
2015-06-25 H.J. Lu <hongjiu.lu@intel.com>
* gcc.c (driver_handle_option): Validate -pie if PIE is enabled
if (REGNO (operands[1]) == REGNO (operands[2]))
operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));
- sh_check_add_incdec_notes (emit_insn (gen_rtx_SET (operands[2],
- operands[3])));
+ // We don't know what the new set insn will be in detail. Just make sure
+ // that it still can be recognized and the constraints are satisfied.
+ rtx_insn* i = emit_insn (gen_rtx_SET (operands[2], operands[3]));
+
+ recog_data_d prev_recog_data = recog_data;
+ bool i_invalid = insn_invalid_p (i, false);
+ recog_data = prev_recog_data;
+
+ if (i_invalid)
+ FAIL;
+
+ sh_check_add_incdec_notes (i);
+
emit_insn (gen_tstsi_t (operands[2],
gen_rtx_REG (SImode, (REGNO (operands[1])))));
})
|| REGNO (operands[2]) == REGNO (operands[5]))"
[(const_int 0)]
{
- sh_check_add_incdec_notes (emit_insn (gen_rtx_SET (operands[2],
- operands[3])));
+ // We don't know what the new set insn will be in detail. Just make sure
+ // that it still can be recognized and the constraints are satisfied.
+ rtx_insn* i = emit_insn (gen_rtx_SET (operands[2], operands[3]));
+
+ recog_data_d prev_recog_data = recog_data;
+ bool i_invalid = insn_invalid_p (i, false);
+ recog_data = prev_recog_data;
+
+ if (i_invalid)
+ FAIL;
+
+ sh_check_add_incdec_notes (i);
+
emit_insn (gen_tstsi_t (operands[2],
gen_rtx_REG (SImode, (REGNO (operands[1])))));
})