aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2001-07-17 17:11:56 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2001-07-17 15:11:56 +0000
commit4ba5f92543efd538baa20eb7624cce7066fdbbb7 (patch)
tree9897d533a511d33bdf87b391d045985a0131d4ea /gcc/combine.c
parent3aa8ab7bfa8e38b018aa6eccf474d5d49643c49e (diff)
downloadgcc-4ba5f92543efd538baa20eb7624cce7066fdbbb7.zip
gcc-4ba5f92543efd538baa20eb7624cce7066fdbbb7.tar.gz
gcc-4ba5f92543efd538baa20eb7624cce7066fdbbb7.tar.bz2
combine.c (combine_simplify_rtx): Attempt to simplify a*(b/c) as (a*b)/c for floats in unsafe_math mode.
* combine.c (combine_simplify_rtx): Attempt to simplify a*(b/c) as (a*b)/c for floats in unsafe_math mode. * simplify-rtx.c (avoid_constatn_pool_reference): New static function. (simplify_binary_operation, simplify_unary_operation, simplify_relational_operation): Use it. * combine.c (combine_simplify_rtx): Don't do associative law on divisions; allow associative law on floats. From-SVN: r44073
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 6c2f40f..f8394e6 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3724,9 +3724,9 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
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))
+ && (INTEGRAL_MODE_P (mode)
+ || (flag_unsafe_math_optimizations && FLOAT_MODE_P (mode))))
{
if (GET_CODE (XEXP (x, 0)) == code)
{
@@ -4231,6 +4231,16 @@ combine_simplify_rtx (x, op0_mode, last, in_dest)
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: