aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-11-27 16:32:54 +0000
committerJakub Jelinek <jakub@redhat.com>2019-11-27 16:32:54 +0000
commitb8554f0168db18aebd00f865b38bf15d57622928 (patch)
treefd7d0c88c381c8f4da3f8cf88cdd0394a775f8fc
parenta7520ddce117864baa4c6d9c1261a838f994125b (diff)
PR rtl-optimization/92510
* combine.c (gen_lowpart_for_combine): Only transform lowpart subreg of comparison into a comparison with different mode if both imode and omode are scalar integral modes. * gcc.dg/pr92510.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@278777 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/combine.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr92510.c16
4 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f2cacc047d8..7dbf824938f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/92510
+ * combine.c (gen_lowpart_for_combine): Only transform lowpart subreg
+ of comparison into a comparison with different mode if both imode and
+ omode are scalar integral modes.
+
2019-11-27 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/90007
diff --git a/gcc/combine.c b/gcc/combine.c
index 3fbd84fcb80..16e606d8a21 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -11812,7 +11812,9 @@ gen_lowpart_for_combine (machine_mode omode, rtx x)
/* If X is a comparison operator, rewrite it in a new mode. This
probably won't match, but may allow further simplifications. */
- else if (COMPARISON_P (x))
+ else if (COMPARISON_P (x)
+ && SCALAR_INT_MODE_P (imode)
+ && SCALAR_INT_MODE_P (omode))
return gen_rtx_fmt_ee (GET_CODE (x), omode, XEXP (x, 0), XEXP (x, 1));
/* If we couldn't simplify X any other way, just enclose it in a
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aca3864b184..4f97f4cc58c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/92510
+ * gcc.dg/pr92510.c: New test.
+
2019-11-27 Andrew Sutton <asutton@lock3software.com>
PR c++/92236
diff --git a/gcc/testsuite/gcc.dg/pr92510.c b/gcc/testsuite/gcc.dg/pr92510.c
new file mode 100644
index 00000000000..d468586c0f8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr92510.c
@@ -0,0 +1,16 @@
+/* PR rtl-optimization/92510 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-loop-vectorize -fno-forward-propagate -fno-tree-scev-cprop" } */
+
+int v;
+
+long int
+foo (long int x)
+{
+ signed char i;
+
+ for (i = 0; i < 8; ++i)
+ x |= !!v;
+
+ return x + i;
+}