aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>2017-04-25 07:41:41 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2017-04-25 07:41:41 +0000
commit3cb9ee2f9c10a04a7498be3279897b46669c61dc (patch)
tree68d8a15d09edb7899d14406a9af12510a5810f30
parent03db9ab59481e07de0f8b651e6cc5c0f7d26b330 (diff)
downloadgcc-3cb9ee2f9c10a04a7498be3279897b46669c61dc.zip
gcc-3cb9ee2f9c10a04a7498be3279897b46669c61dc.tar.gz
gcc-3cb9ee2f9c10a04a7498be3279897b46669c61dc.tar.bz2
S/390: PR79895: Fix TImode constant handling
The P constraint letter is supposed to match every constant which is acceptable during reload. However, constraints do not appear to be able to handle const_wide_int yet. It works with predicates so the alternative is modelled with a new predicate now. gcc/ChangeLog: 2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com> PR target/79895 * config/s390/predicates.md (reload_const_wide_int_operand): New predicate. * config/s390/s390.md ("movti"): Remove d/P alternative. ("movti_bigconst"): New pattern definition. gcc/testsuite/ChangeLog: 2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com> PR target/79895 * gcc.target/s390/pr79895.c: New test. From-SVN: r247133
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/s390/predicates.md5
-rw-r--r--gcc/config/s390/s390.md13
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/s390/pr79895.c9
5 files changed, 38 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c70d790..e9cefd9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ PR target/79895
+ * config/s390/predicates.md (reload_const_wide_int_operand): New
+ predicate.
+ * config/s390/s390.md ("movti"): Remove d/P alternative.
+ ("movti_bigconst"): New pattern definition.
+
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR target/80080
diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md
index 0c82efc..34a7ea2 100644
--- a/gcc/config/s390/predicates.md
+++ b/gcc/config/s390/predicates.md
@@ -199,6 +199,11 @@
(and (match_code "const_int")
(match_test "INTVAL (op) <= 32767 && INTVAL (op) >= -32768"))))
+(define_predicate "reload_const_wide_int_operand"
+ (and (match_code "const_wide_int")
+ (match_test "legitimate_reload_constant_p (op)")))
+
+
;; operators --------------------------------------------------------------
;; Return nonzero if OP is a valid comparison operator
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 8a700ed..c9fd19a 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -1494,11 +1494,20 @@
; movti instruction pattern(s).
;
+
+; Separate out the register pair alternative since constraints (P) are
+; not able to deal with const_wide_int's. But predicates do.
+(define_insn "*movti_bigconst"
+ [(set (match_operand:TI 0 "register_operand" "=d")
+ (match_operand:TI 1 "reload_const_wide_int_operand" ""))]
+ "TARGET_ZARCH"
+ "#")
+
; FIXME: More constants are possible by enabling jxx, jyy constraints
; for TImode (use double-int for the calculations)
(define_insn "movti"
- [(set (match_operand:TI 0 "nonimmediate_operand" "=d,S,v, v, v,v,d,v,R, d,o")
- (match_operand:TI 1 "general_operand" " S,d,v,j00,jm1,d,v,R,v,dPT,d"))]
+ [(set (match_operand:TI 0 "nonimmediate_operand" "=d,S,v, v, v,v,d,v,R, d,o")
+ (match_operand:TI 1 "general_operand" " S,d,v,j00,jm1,d,v,R,v,dT,d"))]
"TARGET_ZARCH"
"@
lmg\t%0,%N0,%S1
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e4a9f0e..ffa5b4a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-25 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ PR target/79895
+ * gcc.target/s390/pr79895.c: New test.
+
2017-04-25 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR target/80080
diff --git a/gcc/testsuite/gcc.target/s390/pr79895.c b/gcc/testsuite/gcc.target/s390/pr79895.c
new file mode 100644
index 0000000..02374e4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr79895.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O1 -mno-lra" } */
+
+unsigned __int128 g;
+void
+foo ()
+{
+ g = (unsigned __int128)1 << 127;
+}