]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/39902 (x * 1.0DF gets wrong value)
authorJanis Johnson <janis187@us.ibm.com>
Mon, 3 Aug 2009 21:49:12 +0000 (21:49 +0000)
committerJanis Johnson <janis@gcc.gnu.org>
Mon, 3 Aug 2009 21:49:12 +0000 (21:49 +0000)
PR c/39902
* simplify-rtx.c (simplify_binary_operation_1): Disable
simplifications for decimal float operations.
* gcc.target/powerpc/pr39902-2.c: New test.

From-SVN: r150386

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr39902-2.c [new file with mode: 0644]

index 359211c77e5d3533c45602adff5fbf5b306009e7..7f318c4d8c0bdb06420a88b55fcc83ee28b95853 100644 (file)
@@ -1,5 +1,9 @@
 2009-08-03  Janis Johnson  <janis187@us.ibm.com>
 
+       PR c/39902
+       * simplify-rtx.c (simplify_binary_operation_1): Disable
+       simplifications for decimal float operations.
+
        PR c/39902
        * tree.c (real_zerop, real_onep, real_twop, real_minus_onep):
        Special-case decimal float constants.
index f8756040ce0f17d6e6162ecf474f5a08d5268d6e..9ff5f296b8ecbba98b58c647ee5fbeac992abd3f 100644 (file)
@@ -2004,6 +2004,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
       /* x*2 is x+x and x*(-1) is -x */
       if (GET_CODE (trueop1) == CONST_DOUBLE
          && SCALAR_FLOAT_MODE_P (GET_MODE (trueop1))
+         && !DECIMAL_FLOAT_MODE_P (GET_MODE (trueop1))
          && GET_MODE (op0) == mode)
        {
          REAL_VALUE_TYPE d;
index 7e55fb99d7a4db61c67b45db50d88a163d0dc207..d5f0a0280f27070d7602769a999d4fcb50def925 100644 (file)
@@ -1,5 +1,8 @@
 2009-08-03  Janis Johnson  <janis187@us.ibm.com>
 
+       PR c/39902
+       * gcc.target/powerpc/pr39902-2.c: New test.
+
        PR c/39902
        * gcc.dg/dfp/pr39902.c: New test.
 
diff --git a/gcc/testsuite/gcc.target/powerpc/pr39902-2.c b/gcc/testsuite/gcc.target/powerpc/pr39902-2.c
new file mode 100644 (file)
index 0000000..463a36c
--- /dev/null
@@ -0,0 +1,28 @@
+/* Check that simplification "x*(-1)" -> "-x" is not performed for decimal
+   float types.  */
+
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */
+/* { dg-options "-std=gnu99 -O -mcpu=power6" } */
+/* { dg-final { scan-assembler-not "fneg" } } */
+
+extern _Decimal32 a32, b32;
+extern _Decimal64 a64, b64;
+extern _Decimal128 a128, b128;
+
+void
+foo32 (void)
+{
+  b32 = a32 * -1.0DF;
+}
+
+void
+foo64 (void)
+{
+  b64 = a64 * -1.0DD;
+}
+
+void
+foo128 (void)
+{
+  b128 = a128 * -1.0DL;
+}