]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix PR92950: Wrong code emitted for movv1qi
authorAndreas Krebbel <krebbel@linux.ibm.com>
Mon, 16 Dec 2019 08:03:28 +0000 (08:03 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Mon, 16 Dec 2019 08:03:28 +0000 (08:03 +0000)
The backend emits 16 bit memory loads for single element character
vector.  As a result the character will not be right justified in the
GPR.

gcc/ChangeLog:

2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>

PR target/92950
* config/s390/vector.md ("mov<mode>" for V_8): Replace lh, lhy,
and lhrl with llc.

gcc/testsuite/ChangeLog:

2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>

PR target/92950
* gcc.target/s390/vector/pr92950.c: New test.

From-SVN: r279410

gcc/ChangeLog
gcc/config/s390/vector.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/vector/pr92950.c [new file with mode: 0644]

index 9b892fa297235d6a2f97556279aab8b33e967d77..acf14a5bb74abf3103a7c2bdc4c192c1c8ec425e 100644 (file)
@@ -1,3 +1,9 @@
+2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>
+
+       PR target/92950
+       * config/s390/vector.md ("mov<mode>" for V_8): Replace lh, lhy,
+       and lhrl with llc.
+
 2019-12-14  Martin Sebor  <msebor@redhat.com>
 
        * doc/extend.texi (attribute access): Correct typos.
index d40e310f9e79d046bc82e5f019be15b6fa4e2e22..1e591ba31b6de928a068a65ce0cb79740ec9e49b 100644 (file)
 ; However, this would probably be slower.
 
 (define_insn "mov<mode>"
-  [(set (match_operand:V_8 0 "nonimmediate_operand" "=v,v,d,v,R,  v,  v,  v,  v,d,  Q,  S,  Q,  S,  d,  d,d,d,d,R,T")
-        (match_operand:V_8 1 "general_operand"      " v,d,v,R,v,j00,jm1,jyy,jxx,d,j00,j00,jm1,jm1,j00,jm1,R,T,b,d,d"))]
-  ""
+  [(set (match_operand:V_8 0 "nonimmediate_operand" "=v,v,d,v,R,  v,  v,  v,  v,d,  Q,  S,  Q,  S,  d,  d,d,R,T")
+        (match_operand:V_8 1 "general_operand"      " v,d,v,R,v,j00,jm1,jyy,jxx,d,j00,j00,jm1,jm1,j00,jm1,T,d,d"))]
+  "TARGET_VX"
   "@
    vlr\t%v0,%v1
    vlvgb\t%v0,%1,0
    mviy\t%0,-1
    lhi\t%0,0
    lhi\t%0,-1
-   lh\t%0,%1
-   lhy\t%0,%1
-   lhrl\t%0,%1
+   llc\t%0,%1
    stc\t%1,%0
    stcy\t%1,%0"
-  [(set_attr "op_type"      "VRR,VRS,VRS,VRX,VRX,VRI,VRI,VRI,VRI,RR,SI,SIY,SI,SIY,RI,RI,RX,RXY,RIL,RX,RXY")])
+  [(set_attr "op_type"      "VRR,VRS,VRS,VRX,VRX,VRI,VRI,VRI,VRI,RR,SI,SIY,SI,SIY,RI,RI,RXY,RX,RXY")])
 
 (define_insn "mov<mode>"
   [(set (match_operand:V_16 0 "nonimmediate_operand" "=v,v,d,v,R,  v,  v,  v,  v,d,  Q,  Q,  d,  d,d,d,d,R,T,b")
index 591f152466b14f1dc939201b8c7c741da89be0e9..cc1a7350d61319cf27d8658d5cf16f8fa5097dea 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-16  Andreas Krebbel  <krebbel@linux.ibm.com>
+
+       PR target/92950
+       * gcc.target/s390/vector/pr92950.c: New test.
+
 2019-12-15  Andrew Pinski  <apinski@marvell.com>
 
        * gcc.c-torture/compile/bitfield-1.c: New test.
diff --git a/gcc/testsuite/gcc.target/s390/vector/pr92950.c b/gcc/testsuite/gcc.target/s390/vector/pr92950.c
new file mode 100644 (file)
index 0000000..9c7ed12
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mzarch -march=z13 --save-temps" } */
+
+struct a {
+  int b;
+  char c;
+};
+struct a d = {1, 16};
+struct a *e = &d;
+
+int f = 0;
+
+int main() {
+  struct a g = {0, 0 };
+  f = 0;
+
+  for (; f <= 1; f++) {
+    g = d;
+    *e = g;
+  }
+
+  if (d.c != 16)
+    __builtin_abort();
+}