arm: Fix arm {,u}subvdi4 and usubvsi4 expanders [PR94286]

The following testcase ICEs, because these expanders will happily create
a SImode 0x80000000 CONST_INT, which is not valid RTL, as CONST_INTs need to
be sign extended from the mode precision to full HWI.

2020-03-24  Jakub Jelinek  <jakub@redhat.com>

	PR target/94286
	* config/arm/arm.md (subvdi4, usubvsi4, usubvdi4): Use gen_int_mode
	instead of GEN_INT.

	* gcc.dg/pr94286.c: New test.
This commit is contained in:
Jakub Jelinek 2020-03-24 10:28:58 +01:00
parent 565ab7efbd
commit 596c90d355
4 changed files with 22 additions and 3 deletions

View File

@ -1,5 +1,9 @@
2020-03-24 Jakub Jelinek <jakub@redhat.com>
PR target/94286
* config/arm/arm.md (subvdi4, usubvsi4, usubvdi4): Use gen_int_mode
instead of GEN_INT.
PR debug/94285
* tree-ssa-loop-manip.c (create_iv): If after, set stmt location to
e->goto_locus even if gsi_bb (*incr_pos) contains only debug stmts.

View File

@ -1481,7 +1481,7 @@
lo_op2 = force_reg (SImode, lo_op2);
if (CONST_INT_P (lo_op2))
emit_insn (gen_cmpsi2_addneg (lo_result, lo_op1, lo_op2,
GEN_INT (-INTVAL (lo_op2))));
gen_int_mode (-INTVAL (lo_op2), SImode)));
else
emit_insn (gen_subsi3_compare1 (lo_result, lo_op1, lo_op2));
@ -1525,7 +1525,8 @@
}
else if (CONST_INT_P (operands[2]))
emit_insn (gen_cmpsi2_addneg (operands[0], operands[1], operands[2],
GEN_INT (-INTVAL (operands[2]))));
gen_int_mode (-INTVAL (operands[2]),
SImode)));
else if (CONST_INT_P (operands[1]))
{
mode = CC_RSBmode;
@ -1597,7 +1598,7 @@
lo_op2 = force_reg (SImode, lo_op2);
if (CONST_INT_P (lo_op2))
emit_insn (gen_cmpsi2_addneg (lo_result, lo_op1, lo_op2,
GEN_INT (-INTVAL (lo_op2))));
gen_int_mode (-INTVAL (lo_op2), SImode)));
else
emit_insn (gen_subsi3_compare1 (lo_result, lo_op1, lo_op2));

View File

@ -1,5 +1,8 @@
2020-03-24 Jakub Jelinek <jakub@redhat.com>
PR target/94286
* gcc.dg/pr94286.c: New test.
PR debug/94285
* gfortran.dg/pr94285.f90: New test.

View File

@ -0,0 +1,11 @@
/* PR target/94286 */
/* { dg-do compile } */
/* { dg-options "-O2 -g" } */
unsigned a, b;
int
foo (void)
{
return __builtin_sub_overflow (a, 0x80000000U, &b);
}