rtlanal.c (canonicalize_condition): Split out duplicated mode check.

gcc/
	* rtlanal.c (canonicalize_condition): Split out duplicated mode check.
	Handle XOR.

gcc/testsuite/
	* gcc.dg/unroll_1.c: Add -fenable-rtl-loop2.

From-SVN: r207076
This commit is contained in:
Richard Sandiford 2014-01-25 20:03:16 +00:00 committed by Richard Sandiford
parent 746cd71961
commit 2c8798a225
4 changed files with 41 additions and 21 deletions

View File

@ -1,3 +1,8 @@
2014-01-25 Richard Sandiford <rdsandiford@googlemail.com>
* rtlanal.c (canonicalize_condition): Split out duplicated mode check.
Handle XOR.
2014-01-25 Jakub Jelinek <jakub@redhat.com>
* print-rtl.c (in_call_function_usage): New var.

View File

@ -5051,23 +5051,24 @@ canonicalize_condition (rtx insn, rtx cond, int reverse, rtx *earliest,
??? This mode check should perhaps look more like the mode check
in simplify_comparison in combine. */
if ((GET_CODE (SET_SRC (set)) == COMPARE
|| (((code == NE
|| (code == LT
&& val_signbit_known_set_p (inner_mode,
STORE_FLAG_VALUE))
if (((GET_MODE_CLASS (mode) == MODE_CC)
!= (GET_MODE_CLASS (inner_mode) == MODE_CC))
&& mode != VOIDmode
&& inner_mode != VOIDmode)
break;
if (GET_CODE (SET_SRC (set)) == COMPARE
|| (((code == NE
|| (code == LT
&& val_signbit_known_set_p (inner_mode,
STORE_FLAG_VALUE))
#ifdef FLOAT_STORE_FLAG_VALUE
|| (code == LT
&& SCALAR_FLOAT_MODE_P (inner_mode)
&& (fsfv = FLOAT_STORE_FLAG_VALUE (inner_mode),
REAL_VALUE_NEGATIVE (fsfv)))
|| (code == LT
&& SCALAR_FLOAT_MODE_P (inner_mode)
&& (fsfv = FLOAT_STORE_FLAG_VALUE (inner_mode),
REAL_VALUE_NEGATIVE (fsfv)))
#endif
))
&& COMPARISON_P (SET_SRC (set))))
&& (((GET_MODE_CLASS (mode) == MODE_CC)
== (GET_MODE_CLASS (inner_mode) == MODE_CC))
|| mode == VOIDmode || inner_mode == VOIDmode))
))
&& COMPARISON_P (SET_SRC (set))))
x = SET_SRC (set);
else if (((code == EQ
|| (code == GE
@ -5080,15 +5081,25 @@ canonicalize_condition (rtx insn, rtx cond, int reverse, rtx *earliest,
REAL_VALUE_NEGATIVE (fsfv)))
#endif
))
&& COMPARISON_P (SET_SRC (set))
&& (((GET_MODE_CLASS (mode) == MODE_CC)
== (GET_MODE_CLASS (inner_mode) == MODE_CC))
|| mode == VOIDmode || inner_mode == VOIDmode))
&& COMPARISON_P (SET_SRC (set)))
{
reverse_code = 1;
x = SET_SRC (set);
}
else if ((code == EQ || code == NE)
&& GET_CODE (SET_SRC (set)) == XOR)
/* Handle sequences like:
(set op0 (xor X Y))
...(eq|ne op0 (const_int 0))...
in which case:
(eq op0 (const_int 0)) reduces to (eq X Y)
(ne op0 (const_int 0)) reduces to (ne X Y)
This is the form used by MIPS16, for example. */
x = SET_SRC (set);
else
break;
}

View File

@ -1,3 +1,7 @@
2014-01-25 Richard Sandiford <rdsandiford@googlemail.com>
* gcc.dg/unroll_1.c: Add -fenable-rtl-loop2.
2014-01-25 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gcc.dg/vect/vect-nop-move.c (main): Check for vect runtime.

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-rtl-loop2_unroll=stderr -fno-peel-loops -fno-tree-vrp -fdisable-tree-cunroll -fdisable-tree-cunrolli -fenable-rtl-loop2_unroll" } */
/* { dg-options "-O2 -fdump-rtl-loop2_unroll=stderr -fno-peel-loops -fno-tree-vrp -fdisable-tree-cunroll -fdisable-tree-cunrolli -fenable-rtl-loop2 -fenable-rtl-loop2_unroll" } */
unsigned a[100], b[100];
inline void bar()