backport: re PR target/51408 (Miscompilation in arm.md:*minmax_arithsi)

gcc/
	Backport from mainline:

	2011-12-05  Kazu Hirata  <kazu@codesourcery.com>

	PR target/51408
	* config/arm/arm.md (*minmax_arithsi): Always require the else
	clause in the MINUS case.

testsuite/
	Backport from mainline:

	2011-12-05  Kazu Hirata  <kazu@codesourcery.com>

	PR target/51408
	* gcc.dg/pr51408.c: New.

From-SVN: r182153
This commit is contained in:
Kazu Hirata 2011-12-09 05:02:59 +00:00 committed by Kazu Hirata
parent 5191d65f00
commit e41a36a7a4
4 changed files with 42 additions and 1 deletions

View File

@ -1,3 +1,13 @@
2011-12-09 Kazu Hirata <kazu@codesourcery.com>
Backport from mainline:
2011-12-05 Kazu Hirata <kazu@codesourcery.com>
PR target/51408
* config/arm/arm.md (*minmax_arithsi): Always require the else
clause in the MINUS case.
2011-12-08 Jakub Jelinek <jakub@redhat.com>
Backported from mainline

View File

@ -3079,7 +3079,7 @@
bool need_else;
if (which_alternative != 0 || operands[3] != const0_rtx
|| (code != PLUS && code != MINUS && code != IOR && code != XOR))
|| (code != PLUS && code != IOR && code != XOR))
need_else = true;
else
need_else = false;

View File

@ -1,3 +1,12 @@
2011-12-09 Kazu Hirata <kazu@codesourcery.com>
Backport from mainline:
2011-12-05 Kazu Hirata <kazu@codesourcery.com>
PR target/51408
* gcc.dg/pr51408.c: New.
2011-12-08 Jakub Jelinek <jakub@redhat.com>
Backported from mainline

View File

@ -0,0 +1,22 @@
/* This testcase used to fail because of a bug in
arm.md:*minmax_arithsi. */
/* { dg-do run } */
/* { dg-options "-O1" } */
extern void abort (void);
int __attribute__((noinline))
foo (int a, int b)
{
int max = (b > 0) ? b : 0;
return max - a;
}
int
main (void)
{
if (foo (3, -1) != -3)
abort ();
return 0;
}