aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJanis Johnson <janis187@us.ibm.com>2009-08-03 21:38:53 +0000
committerJanis Johnson <janis@gcc.gnu.org>2009-08-03 21:38:53 +0000
commit50cd60be11a52f6ee997d331f83c5b62ee59f448 (patch)
tree3a7a0f8a8cbeffcc21995e11ae23fb831f2f9e90 /gcc
parent1768a052038172cc56a7af8ad2e90982f3c84d13 (diff)
downloadgcc-50cd60be11a52f6ee997d331f83c5b62ee59f448.zip
gcc-50cd60be11a52f6ee997d331f83c5b62ee59f448.tar.gz
gcc-50cd60be11a52f6ee997d331f83c5b62ee59f448.tar.bz2
re PR c/39902 (x * 1.0DF gets wrong value)
PR c/39902 * simplify-rtx.c (simplify_binary_operation_1): Disable simplifications for decimal float operations. PR c/39902 * gcc.target/powerpc/pr39902-2.c: New test. From-SVN: r150383
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/simplify-rtx.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr39902-2.c28
4 files changed, 40 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4d9d516..a888baf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +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.
+
2009-08-03 Jakub Jelinek <jakub@redhat.com>
PR middle-end/40943
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index ff69068..e3809a8 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1997,6 +1997,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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e2b141c..86a991e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-03 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/39902
+ * gcc.target/powerpc/pr39902-2.c: New test.
+
2009-08-03 Jakub Jelinek <jakub@redhat.com>
PR middle-end/40943
diff --git a/gcc/testsuite/gcc.target/powerpc/pr39902-2.c b/gcc/testsuite/gcc.target/powerpc/pr39902-2.c
new file mode 100644
index 0000000..463a36c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr39902-2.c
@@ -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;
+}