This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
associative law in combine
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com, patches at x86-64 dot org, timothy dot c dot prince at intel dot com
- Subject: associative law in combine
- From: Jan Hubicka <jh at suse dot cz>
- Date: Mon, 16 Jul 2001 22:44:23 +0200
Hi,
for some purpose combine attempts to apply associative law even on
divisions. Unless I am totally confused today, it is wrong.
I've failed to construct testcase to produce incorrect assembly tought.
Patch also enables the associative law for floating point values in
-ffast-math mode, that should be safe too I hope.
Bootstrap/regtesting in progress together with previous two patches.
OK assuming it passes?
Mon Jul 16 22:42:56 CEST 2001 Jan Hubicka <jh@suse.cz>
* combine.c (combine_simplify_rtx): Don't do associative law
on divisions; allow associative law on floats.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.215
diff -c -3 -p -r1.215 combine.c
*** combine.c 2001/07/16 09:16:04 1.215
--- combine.c 2001/07/16 20:40:50
*************** combine_simplify_rtx (x, op0_mode, last,
*** 3724,3732 ****
if they are logically related (i.e. (a & b) & a). */
if ((code == PLUS || code == MINUS
|| code == MULT || code == AND || code == IOR || code == XOR
- || code == DIV || code == UDIV
|| code == SMAX || code == SMIN || code == UMAX || code == UMIN)
! && INTEGRAL_MODE_P (mode))
{
if (GET_CODE (XEXP (x, 0)) == code)
{
--- 3726,3734 ----
if they are logically related (i.e. (a & b) & a). */
if ((code == PLUS || code == MINUS
|| code == MULT || code == AND || code == IOR || code == XOR
|| code == SMAX || code == SMIN || code == UMAX || code == UMIN)
! && (INTEGRAL_MODE_P (mode)
! || (flag_unsafe_math_optimizations && FLOAT_MODE_P (mode))))
{
if (GET_CODE (XEXP (x, 0)) == code)
{