diff options
author | Joseph Myers <joseph@codesourcery.com> | 2009-05-08 21:58:26 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2009-05-08 21:58:26 +0100 |
commit | c94f9067af215b26b634b6c9678297aa92d74fc7 (patch) | |
tree | 2750c2df225dea05be099d922f95c8e92115e8c1 /gcc/fold-const.c | |
parent | 9187e02deb92bfe982c845a682468fce39c8bf9b (diff) | |
download | gcc-c94f9067af215b26b634b6c9678297aa92d74fc7.zip gcc-c94f9067af215b26b634b6c9678297aa92d74fc7.tar.gz gcc-c94f9067af215b26b634b6c9678297aa92d74fc7.tar.bz2 |
fold-const.c (fold_binary): Do not fold multiplication by 1 or -1 for complex floating-point types if...
* 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.
From-SVN: r147295
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 14b9f10..fb59049 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)); |