summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-24 18:58:58 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-24 18:58:58 +0000
commit21be42575a11522f5b73d88da65f681711c335a0 (patch)
treebcc127f2ba58f61140e326dd7155f9c73496fb01
parent98dc4c05ea0fbbbe82ba20f159e05527fa0583f0 (diff)
downloadgcc-21be42575a11522f5b73d88da65f681711c335a0.tar.gz
PR debug/48204
* simplify-rtx.c (simplify_const_unary_operation): Call real_convert when changing mode class with FLOAT_EXTEND. * gcc.dg/dfp/pr48204.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171423 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/simplify-rtx.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr48204.c10
4 files changed, 27 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 046aea78990..4e2732a9c0d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/48204
+ * simplify-rtx.c (simplify_const_unary_operation): Call
+ real_convert when changing mode class with FLOAT_EXTEND.
+
2011-03-24 Nick Clifton <nickc@redhat.com>
* config/rx/rx.h (LABEL_ALIGN_FOR_BARRIER): Define.
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 4a8e3c61667..847a4bb6ecf 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1526,7 +1526,8 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
}
else if (GET_CODE (op) == CONST_DOUBLE
- && SCALAR_FLOAT_MODE_P (mode))
+ && SCALAR_FLOAT_MODE_P (mode)
+ && SCALAR_FLOAT_MODE_P (GET_MODE (op)))
{
REAL_VALUE_TYPE d, t;
REAL_VALUE_FROM_CONST_DOUBLE (d, op);
@@ -1549,7 +1550,10 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
d = real_value_truncate (mode, d);
break;
case FLOAT_EXTEND:
- /* All this does is change the mode. */
+ /* All this does is change the mode, unless changing
+ mode class. */
+ if (GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op)))
+ real_convert (&d, mode, &d);
break;
case FIX:
real_arithmetic (&d, FIX_TRUNC_EXPR, &d, NULL);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b7cad7f297b..c01c7cbc149 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/48204
+ * gcc.dg/dfp/pr48204.c: New test.
+
2011-03-24 Steve Ellcey <sje@cup.hp.com>
PR target/48209
diff --git a/gcc/testsuite/gcc.dg/dfp/pr48204.c b/gcc/testsuite/gcc.dg/dfp/pr48204.c
new file mode 100644
index 00000000000..7b421581e6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr48204.c
@@ -0,0 +1,10 @@
+/* PR debug/48204 */
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-fre -g" } */
+
+void
+foo (void)
+{
+ float cf = 3.0f;
+ _Decimal64 d64 = cf;
+}