aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/combine.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr85300.c16
4 files changed, 36 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aee2060..f50d99a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/85300
+ * combine.c (subst): Handle subst of CONST_SCALAR_INT_P new_rtx also
+ into FLOAT and UNSIGNED_FLOAT like ZERO_EXTEND, return a CLOBBER if
+ simplify_unary_operation fails.
+
2018-04-10 Martin Liska <mliska@suse.cz>
* gdbhooks.py: Add pretty-printers for varpool_node, symtab_node,
diff --git a/gcc/combine.c b/gcc/combine.c
index ff672ad..3ad050f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5575,11 +5575,15 @@ subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy)
x = gen_rtx_CLOBBER (mode, const0_rtx);
}
else if (CONST_SCALAR_INT_P (new_rtx)
- && GET_CODE (x) == ZERO_EXTEND)
+ && (GET_CODE (x) == ZERO_EXTEND
+ || GET_CODE (x) == FLOAT
+ || GET_CODE (x) == UNSIGNED_FLOAT))
{
- x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x),
- new_rtx, GET_MODE (XEXP (x, 0)));
- gcc_assert (x);
+ x = simplify_unary_operation (GET_CODE (x), GET_MODE (x),
+ new_rtx,
+ GET_MODE (XEXP (x, 0)));
+ if (!x)
+ return gen_rtx_CLOBBER (VOIDmode, const0_rtx);
}
else
SUBST (XEXP (x, i), new_rtx);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7bd4b1d..f1da5c3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/85300
+ * gcc.dg/pr85300.c: New test.
+
2018-04-10 David Malcolm <dmalcolm@redhat.com>
PR c++/85110
diff --git a/gcc/testsuite/gcc.dg/pr85300.c b/gcc/testsuite/gcc.dg/pr85300.c
new file mode 100644
index 0000000..87a30b8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85300.c
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/85300 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -g -funroll-all-loops -fno-tree-ter -fno-web" } */
+
+void
+foo (double x, unsigned char y)
+{
+ while ((int) x < 1)
+ {
+ float a;
+
+ a = y | 0x100;
+ y = 0;
+ x = a;
+ }
+}