Commit c729951e by Vlad Lazar Committed by Vlad Lazar

Enable underflow check in canonicalize_comparison. (PR86995)

gcc/
2018-08-30  Vlad Lazar  <vlad.lazar@arm.com>

	PR middle-end/86995
	* expmed.c (canonicalize_comparison): Use wi::sub instead of wi::add
	if to_add is negative.

From-SVN: r263973
parent d0eaed46
2018-08-30 Vlad Lazar <vlad.lazar@arm.com>
PR middle-end/86995
* expmed.c (canonicalize_comparison): Use wi::sub instead of wi::add
if to_add is negative.
2018-08-29 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR middle-end/87053
......
......@@ -6239,7 +6239,13 @@ canonicalize_comparison (machine_mode mode, enum rtx_code *code, rtx *imm)
wrapping around in the case of unsigned values. If any occur
cancel the optimization. */
wi::overflow_type overflow = wi::OVF_NONE;
wide_int imm_modif = wi::add (imm_val, to_add, sgn, &overflow);
wide_int imm_modif;
if (to_add == 1)
imm_modif = wi::add (imm_val, 1, sgn, &overflow);
else
imm_modif = wi::sub (imm_val, 1, sgn, &overflow);
if (overflow)
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment