From 2af1c87cfeb60fe5a05890d13183da7f0c2e8b01 Mon Sep 17 00:00:00 2001 From: Jing Yu Date: Wed, 27 Jan 2010 13:22:49 -0800 Subject: Backport upstream patch r152443. Fix a bug in distribute_and_simplify_rtx in which a floating point mode RTX is unsafely optimized. --- gcc-4.4.0/README.google | 6 ++++++ gcc-4.4.0/gcc/combine.c | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'gcc-4.4.0') diff --git a/gcc-4.4.0/README.google b/gcc-4.4.0/README.google index 199418057..e2f11a2e3 100644 --- a/gcc-4.4.0/README.google +++ b/gcc-4.4.0/README.google @@ -2229,3 +2229,9 @@ gcc/testsuite/gcc.c-torture/execute/pr42691.c i2 "set reg const". Owner: jingyu Status: backport from upstream r155948. + +gcc/combine.c + Backport upstream patch r152443. Fix a bug in distribute_and_simplify_rtx + in which a floating point mode RTX is unsafely optimized. + Owner: dougkwan + Status: backport of upstream rev 152443. diff --git a/gcc-4.4.0/gcc/combine.c b/gcc-4.4.0/gcc/combine.c index 0de23fe0f..48ec81c44 100644 --- a/gcc-4.4.0/gcc/combine.c +++ b/gcc-4.4.0/gcc/combine.c @@ -8516,6 +8516,12 @@ distribute_and_simplify_rtx (rtx x, int n) enum rtx_code outer_code, inner_code; rtx decomposed, distributed, inner_op0, inner_op1, new_op0, new_op1, tmp; + /* Distributivity is not true for floating point as it can change the + value. So we don't do it unless -funsafe-math-optimizations. */ + if (FLOAT_MODE_P (GET_MODE (x)) + && ! flag_unsafe_math_optimizations) + return NULL_RTX; + decomposed = XEXP (x, n); if (!ARITHMETIC_P (decomposed)) return NULL_RTX; -- cgit v1.2.3