summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-08 20:58:26 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-08 20:58:26 +0000
commitfc86f9dfc71eac1dd1751ed3421994efe47314a9 (patch)
tree2750c2df225dea05be099d922f95c8e92115e8c1 /gcc/fold-const.c
parentccf4ab6ba79565bf35426a5aad3140e6354e0121 (diff)
downloadgcc-fc86f9dfc71eac1dd1751ed3421994efe47314a9.tar.gz
* fold-const.c (fold_binary): Do not fold multiplication by 1 or
-1 for complex floating-point types if honoring signed zeros. testsuite: * gcc.dg/torture/complex-sign-mul-minus-one.c, gcc.dg/torture/complex-sign-mul-one.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147295 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 14b9f100b51..fb590492fb4 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10647,13 +10647,18 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
&& real_zerop (arg1))
return omit_one_operand (type, arg1, arg0);
- /* In IEEE floating point, x*1 is not equivalent to x for snans. */
+ /* In IEEE floating point, x*1 is not equivalent to x for snans.
+ Likewise for complex arithmetic with signed zeros. */
if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
+ && (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
+ || !COMPLEX_FLOAT_TYPE_P (TREE_TYPE (arg0)))
&& real_onep (arg1))
return non_lvalue (fold_convert (type, arg0));
/* Transform x * -1.0 into -x. */
if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
+ && (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
+ || !COMPLEX_FLOAT_TYPE_P (TREE_TYPE (arg0)))
&& real_minus_onep (arg1))
return fold_convert (type, negate_expr (arg0));