This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
simplify multiplication by reciprocals to division
- 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: simplify multiplication by reciprocals to division
- From: Jan Hubicka <jh at suse dot cz>
- Date: Mon, 16 Jul 2001 22:40:27 +0200
Hi,
this patch makes combine to simplify multiplication by reciprocals to
division.
Honza
Mon Jul 16 22:38:44 CEST 2001 Jan Hubicka <jh@suse.cz>
* combine.c (combine_simplify_rtx): Attempt to simplify
a*(b/c) as (a*b)/c for floats in unsafe_math mode.
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:38:11
*************** combine_simplify_rtx (x, op0_mode, last,
*** 4231,4236 ****
--- 4233,4248 ----
if (GET_CODE (x) != MULT)
return x;
}
+ /* Try simplify a*(b/c) as (a*b)/c. */
+ if (FLOAT_MODE_P (mode) && flag_unsafe_math_optimizations
+ && GET_CODE (XEXP (x, 0)) == DIV)
+ {
+ rtx tem = simplify_binary_operation (MULT, mode,
+ XEXP (XEXP (x, 0), 0),
+ XEXP (x, 1));
+ if (tem)
+ return gen_binary (DIV, mode, tem, XEXP (XEXP (x, 0), 1));
+ }
break;
case UDIV: