aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Dapp <rdapp@linux.ibm.com>2018-11-05 14:09:28 +0000
committerRobin Dapp <rdapp@gcc.gnu.org>2018-11-05 14:09:28 +0000
commit88e845c0603f46aae2e3d21944002a4dbf6e3fb6 (patch)
treec6aa405357e41966f29abcc9508758a5b1bce173
parent40ce7fa6dd38f8ac26d576c84f5dbe4362aa902b (diff)
downloadgcc-88e845c0603f46aae2e3d21944002a4dbf6e3fb6.zip
gcc-88e845c0603f46aae2e3d21944002a4dbf6e3fb6.tar.gz
gcc-88e845c0603f46aae2e3d21944002a4dbf6e3fb6.tar.bz2
S/390: Allow immediates in loc expander
This allows immediate operands for load on condition. gcc/ChangeLog: 2018-11-05 Robin Dapp <rdapp@linux.ibm.com> * config/s390/predicates.md: Fix typo. * config/s390/s390.md: Allow immediates for load on condition. gcc/testsuite/ChangeLog: 2018-11-05 Robin Dapp <rdapp@linux.ibm.com> * gcc.dg/loop-8.c: On s390, always run the test with -march=zEC12. From-SVN: r265804
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/s390/predicates.md2
-rw-r--r--gcc/config/s390/s390.md10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/loop-8.c4
5 files changed, 22 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 775461b..c76911d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-05 Robin Dapp <rdapp@linux.ibm.com>
+
+ * config/s390/predicates.md: Fix typo.
+ * config/s390/s390.md: Allow immediates for load on condition.
+
2018-11-05 Martin Liska <mliska@suse.cz>
* alloc-pool.h (struct pool_usage): Use SIZE_AMOUNT.
diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md
index 98a824e..97f717c 100644
--- a/gcc/config/s390/predicates.md
+++ b/gcc/config/s390/predicates.md
@@ -212,7 +212,7 @@
(INTVAL (op), false, GET_MODE_BITSIZE (mode), NULL, NULL);
})
-;; Return true if OP is ligitimate for any LOC instruction.
+;; Return true if OP is legitimate for any LOC instruction.
(define_predicate "loc_operand"
(ior (match_operand 0 "nonimmediate_operand")
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index e4049c2..644781f 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -6575,10 +6575,16 @@
(define_expand "mov<mode>cc"
[(set (match_operand:GPR 0 "nonimmediate_operand" "")
(if_then_else:GPR (match_operand 1 "comparison_operator" "")
- (match_operand:GPR 2 "nonimmediate_operand" "")
- (match_operand:GPR 3 "nonimmediate_operand" "")))]
+ (match_operand:GPR 2 "loc_operand" "")
+ (match_operand:GPR 3 "loc_operand" "")))]
"TARGET_Z196"
{
+ if (!TARGET_Z13 && CONSTANT_P (operands[2]))
+ operands[2] = force_reg (<MODE>mode, operands[2]);
+
+ if (!TARGET_Z13 && CONSTANT_P (operands[3]))
+ operands[3] = force_reg (<MODE>mode, operands[3]);
+
/* Emit the comparison insn in case we do not already have a comparison result. */
if (!s390_comparison (operands[1], VOIDmode))
operands[1] = s390_emit_compare (GET_CODE (operands[1]),
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f071598..4716695 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-11-05 Robin Dapp <rdapp@linux.ibm.com>
+
+ * gcc.dg/loop-8.c: On s390, always run the test with -march=zEC12.
+
2018-11-05 Richard Biener <rguenther@suse.de>
* gcc.dg/pr41488.c: Scan ivcanon dump instead of sccp one.
diff --git a/gcc/testsuite/gcc.dg/loop-8.c b/gcc/testsuite/gcc.dg/loop-8.c
index 842c0e7..1eefccc 100644
--- a/gcc/testsuite/gcc.dg/loop-8.c
+++ b/gcc/testsuite/gcc.dg/loop-8.c
@@ -1,6 +1,10 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-rtl-loop2_invariant" } */
/* { dg-skip-if "unexpected IV" { "hppa*-*-* mips*-*-* visium-*-* powerpc*-*-* riscv*-*-*" } } */
+/* Load immediate on condition is available from z13 on and prevents moving
+ the load out of the loop, so always run this test with -march=zEC12 that
+ does not have load immediate on condition. */
+/* { dg-additional-options "-march=zEC12" { target { s390*-*-* } } } */
void
f (int *a, int *b)