This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Use swap_commutative_operands_p in fold_rtx.
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Jul 2003 11:29:45 -0600 (MDT)
- Subject: [PATCH] Use swap_commutative_operands_p in fold_rtx.
The following patch teaches CSE's fold_rtx to use rtlanal.c's function
"swap_commutative_operands_p" when deciding whether to swap the order
of operands of a commutative operator during constant folding.
The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all languages except treelang, and regression tested
with a top-level "make -k check" with no new failures.
Ok for mainline?
2003-07-17 Roger Sayle <roger@eyesopen.com>
* cse.c (fold_rtx): Use swap_commutative_operands_p to determine
whether to reorder the operands of a commutative binary operator.
Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.268
diff -c -3 -p -r1.268 cse.c
*** cse.c 1 Jul 2003 01:15:03 -0000 1.268
--- cse.c 17 Jul 2003 13:02:20 -0000
*************** fold_rtx (rtx x, rtx insn)
*** 3783,3792 ****
|| code == LTGT || code == UNEQ || code == ORDERED
|| code == UNORDERED)
{
! if (must_swap || (const_arg0
! && (const_arg1 == 0
! || (GET_CODE (const_arg0) == CONST_INT
! && GET_CODE (const_arg1) != CONST_INT))))
{
rtx tem = XEXP (x, 0);
--- 3783,3793 ----
|| code == LTGT || code == UNEQ || code == ORDERED
|| code == UNORDERED)
{
! if (must_swap
! || swap_commutative_operands_p (const_arg0 ? const_arg0
! : XEXP (x, 0),
! const_arg1 ? const_arg1
! : XEXP (x, 1)))
{
rtx tem = XEXP (x, 0);
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833