aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2018-11-20 09:32:49 +0000
committerIlya Leoshkevich <iii@gcc.gnu.org>2018-11-20 09:32:49 +0000
commit34a249bc2e3d60683e0e7fe3c68c85ca287f536f (patch)
tree03c869fa8394d034c1e26ec4df9aece147b86565
parentdc3221e1e3d3a39d88d2d35103f6f50e3400d7a8 (diff)
downloadgcc-34a249bc2e3d60683e0e7fe3c68c85ca287f536f.zip
gcc-34a249bc2e3d60683e0e7fe3c68c85ca287f536f.tar.gz
gcc-34a249bc2e3d60683e0e7fe3c68c85ca287f536f.tar.bz2
S/390: Skip LT(G) peephole when literal pool is involved
By the time peephole optimizations run, we've already made up our mind whether to use base-register or relative addressing for literal pool entries. LT(G) supports only base-register addressing, and so it is too late to convert L(G)RL + compare to LT(G). This change should not make the code worse unless building with e.g. -fno-dce, since comparing literal pool entries to zero should be optimized away during earlier passes. gcc/ChangeLog: 2018-11-20 Ilya Leoshkevich <iii@linux.ibm.com> PR target/88083 * config/s390/s390.md: Skip LT(G) peephole when literal pool is involved. * rtl.h (contains_constant_pool_address_p): New function. * rtlanal.c (contains_constant_pool_address_p): Likewise. gcc/testsuite/ChangeLog: 2018-11-20 Ilya Leoshkevich <iii@linux.ibm.com> PR target/88083 * gcc.target/s390/pr88083.c: New test. From-SVN: r266306
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/s390/s390.md3
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/rtlanal.c14
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/s390/pr88083.c9
6 files changed, 39 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ee2d87d..7589326 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2018-11-20 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ PR target/88083
+ * config/s390/s390.md: Skip LT(G) peephole when literal pool is
+ involved.
+ * rtl.h (contains_constant_pool_address_p): New function.
+ * rtlanal.c (contains_constant_pool_address_p): Likewise.
+
2018-11-20 Richard Biener <rguenther@suse.de>
PR middle-end/83215
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 7a556d4..721222d 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -941,7 +941,8 @@
(compare (match_dup 0) (match_operand:GPR 1 "const0_operand")))]
"s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM
&& GENERAL_REG_P (operands[0])
- && satisfies_constraint_T (operands[2])"
+ && satisfies_constraint_T (operands[2])
+ && !contains_constant_pool_address_p (operands[2])"
[(parallel
[(set (reg:CCS CC_REGNUM)
(compare:CCS (match_dup 2) (match_dup 1)))
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 4114cd0..dd3ce06 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -3385,6 +3385,7 @@ extern void set_insn_deleted (rtx_insn *);
extern rtx single_set_2 (const rtx_insn *, const_rtx);
extern bool contains_symbol_ref_p (const_rtx);
extern bool contains_symbolic_reference_p (const_rtx);
+extern bool contains_constant_pool_address_p (const_rtx);
/* Handle the cheap and common cases inline for performance. */
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 9220cbf..11e9664 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -6551,6 +6551,20 @@ contains_symbolic_reference_p (const_rtx x)
return false;
}
+/* Return true if RTL X contains a constant pool address. */
+
+bool
+contains_constant_pool_address_p (const_rtx x)
+{
+ subrtx_iterator::array_type array;
+ FOR_EACH_SUBRTX (iter, array, x, ALL)
+ if (SYMBOL_REF_P (*iter) && CONSTANT_POOL_ADDRESS_P (*iter))
+ return true;
+
+ return false;
+}
+
+
/* Return true if X contains a thread-local symbol. */
bool
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 31540b5..32a523e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-20 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ PR target/88083
+ * gcc.target/s390/pr88083.c: New test.
+
2018-11-20 Richard Biener <rguenther@suse.de>
PR middle-end/83215
diff --git a/gcc/testsuite/gcc.target/s390/pr88083.c b/gcc/testsuite/gcc.target/s390/pr88083.c
new file mode 100644
index 0000000..d5e530e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr88083.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-sched-last-insn-heuristic -fno-dce -march=z196 -O2" } */
+
+void *a, *b;
+
+void c(void)
+{
+ __builtin_memcpy(a, b, -1); /* { dg-warning "exceeds maximum object size" } */
+}