]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
S/390: Allow immediates in loc expander
authorRobin Dapp <rdapp@linux.ibm.com>
Mon, 5 Nov 2018 14:09:28 +0000 (14:09 +0000)
committerRobin Dapp <rdapp@gcc.gnu.org>
Mon, 5 Nov 2018 14:09:28 +0000 (14:09 +0000)
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

gcc/ChangeLog
gcc/config/s390/predicates.md
gcc/config/s390/s390.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/loop-8.c

index 775461b936e098e60239832557623408e5160b26..c76911db0aac0744985bfcfae996c0af5e0aa88e 100644 (file)
@@ -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.
index 98a824e77b7742096ea24ca3844d9c881984c196..97f717c558d0649f5a52ef239c8f4b02a067c381 100644 (file)
     (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")
index e4049c254063d452087e6659d6798e3c0dbcc0a2..644781f8ad64c86d994f35e65697f520545a9847 100644 (file)
 (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]),
index f0715986e0faffb94c158347536df564c3c4ba04..47166959123f4487317a04eaab8d55b87ff5c45a 100644 (file)
@@ -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.
index 842c0e773b24343c14648cc5f2acbae2c5b9e8ff..1eefccc1a3b1e67b014d54b8d75e973b339a39d2 100644 (file)
@@ -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)