Bootstrapped and regression tested on s390x with z900 and z13 default.

gcc/ChangeLog:

2018-08-08  Andreas Krebbel  <kreb...@linux.ibm.com>

        PR target/85295
        * config/s390/constraints.md ("NxHD0", "NxSD0"): New constraint
        definitions.
        * config/s390/s390.md ("movti"): Add more alternatives for
        constant to GPR copies.

gcc/testsuite/ChangeLog:

2018-08-08  Andreas Krebbel  <kreb...@linux.ibm.com>

        PR target/85295
        * gcc.target/s390/TI-constants-lra.c: New testcase.
        * gcc.target/s390/TI-constants-nolra.c: New testcase.

diff --git a/gcc/config/s390/constraints.md b/gcc/config/s390/constraints.md
index b18622d8dac..b8ba8510096 100644
--- a/gcc/config/s390/constraints.md
+++ b/gcc/config/s390/constraints.md
@@ -51,7 +51,7 @@
 ;;    M -- Constant integer with a value of 0x7fffffff.
 ;;    N -- Multiple letter constraint followed by 4 parameter letters.
 ;;         0..9,x:  number of the part counting from most to least significant
-;;         H,Q:     mode of the part
+;;         S,H,Q:   mode of the part
 ;;         D,S,H:   mode of the containing operand
 ;;         0,F:     value of the other parts (F - all bits set)
 ;;         --
@@ -204,7 +204,7 @@
 
 ;;    N -- Multiple letter constraint followed by 4 parameter letters.
 ;;         0..9,x:  number of the part counting from most to least significant
-;;         H,Q:     mode of the part
+;;         S,H,Q:   mode of the part
 ;;         D,S,H:   mode of the containing operand
 ;;         0,F:     value of the other parts (F = all bits set)
 ;;
@@ -226,6 +226,18 @@
        (match_test "s390_N_constraint_str (\"xQS0\", ival)")))
 
 
+(define_constraint "NxHD0"
+  "@internal"
+   (and (match_code "const_int")
+        (match_test "s390_N_constraint_str (\"xHD0\", ival)")))
+
+
+(define_constraint "NxSD0"
+  "@internal"
+   (and (match_code "const_int")
+        (match_test "s390_N_constraint_str (\"xSD0\", ival)")))
+
+
 (define_constraint "NxQD0"
   "@internal"
    (and (match_code "const_int")
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index c4d391bc9b5..1296e26e536 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -1516,8 +1516,8 @@
 ; 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,dT,d"))]
+  [(set (match_operand:TI 0 "nonimmediate_operand" "=d,S,v,  v,  v,v,d,v,R,d,  
  d, d,    d, d,o")
+        (match_operand:TI 1 "general_operand"      " 
S,d,v,j00,jm1,d,v,R,v,K,NxHD0,Os,NxSD0,dT,d"))]
   "TARGET_ZARCH"
   "@
    lmg\t%0,%N0,%S1
@@ -1530,10 +1530,14 @@
    vl\t%v0,%1
    vst\t%v1,%0
    #
+   #
+   #
+   #
+   #
    #"
-  [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*")
-   (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*")
-   (set_attr "cpu_facility" "*,*,vx,vx,vx,vx,vx,vx,vx,*,*")])
+  [(set_attr "op_type" "RSY,RSY,VRR,VRI,VRI,VRR,*,VRX,VRX,*,*,*,*,*,*")
+   (set_attr "type" "lm,stm,*,*,*,*,*,*,*,*,*,*,*,*,*")
+   (set_attr "cpu_facility" "*,*,vx,vx,vx,vx,vx,vx,vx,*,*,*,extimm,*,*")])
 
 (define_split
   [(set (match_operand:TI 0 "nonimmediate_operand" "")
diff --git a/gcc/testsuite/gcc.target/s390/TI-constants-lra.c 
b/gcc/testsuite/gcc.target/s390/TI-constants-lra.c
new file mode 100644
index 00000000000..cc52a62182b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/TI-constants-lra.c
@@ -0,0 +1,47 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3" } */
+
+/* 2x lghi */
+__int128 a() {
+  return 0;
+}
+
+/* 2x lghi */
+__int128 b() {
+  return -1;
+}
+
+/* 2x lghi */
+__int128 c() {
+  return -2;
+}
+
+/* lghi + llilh */
+__int128 d() {
+  return 16000 << 16;
+}
+
+/* lghi + llihf */
+__int128 e() {
+  return (unsigned long long)80000 << 32;
+}
+
+/* lghi + llihf */
+__int128 f() {
+  return (unsigned __int128)80000 << 96;
+}
+
+/* llihf + llihf - this is handled via movti_bigconst pattern */
+__int128 g() {
+  return ((unsigned __int128)80000 << 96) | ((unsigned __int128)80000 << 32);
+}
+
+/* Literal pool */
+__int128 h() {
+  return ((unsigned __int128)80000 << 32) | 1;
+}
+
+/* Literal pool */
+__int128 i() {
+  return (((unsigned __int128)80000 << 32) | 1) << 64;
+}
diff --git a/gcc/testsuite/gcc.target/s390/TI-constants-nolra.c 
b/gcc/testsuite/gcc.target/s390/TI-constants-nolra.c
new file mode 100644
index 00000000000..b9948fc4aa5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/TI-constants-nolra.c
@@ -0,0 +1,47 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -mno-lra" } */
+
+/* 2x lghi */
+__int128 a() {
+  return 0;
+}
+
+/* 2x lghi */
+__int128 b() {
+  return -1;
+}
+
+/* 2x lghi */
+__int128 c() {
+  return -2;
+}
+
+/* lghi + llilh */
+__int128 d() {
+  return 16000 << 16;
+}
+
+/* lghi + llihf */
+__int128 e() {
+  return (unsigned long long)80000 << 32;
+}
+
+/* lghi + llihf */
+__int128 f() {
+  return (unsigned __int128)80000 << 96;
+}
+
+/* llihf + llihf - this is handled via movti_bigconst pattern */
+__int128 g() {
+  return ((unsigned __int128)80000 << 96) | ((unsigned __int128)80000 << 32);
+}
+
+/* Literal pool */
+__int128 h() {
+  return ((unsigned __int128)80000 << 32) | 1;
+}
+
+/* Literal pool */
+__int128 i() {
+  return (((unsigned __int128)80000 << 32) | 1) << 64;
+}

Reply via email to