]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
S/390: Fix vector shift count operand
authorAndreas Krebbel <krebbel@linux.ibm.com>
Wed, 17 Jul 2019 07:32:30 +0000 (07:32 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Wed, 17 Jul 2019 07:32:30 +0000 (07:32 +0000)
We currently use subst definitions to handle the different variants of shift
count operands. Unfortunately, in the vector shift pattern the shift count
operand is used directly. Without it being adjusted for the 'subst' variants the
displacement value is omitted resulting in a wrong shift count being applied.

This patch needs to be applied to older branches as well.

gcc/ChangeLog:

2019-07-17  Andreas Krebbel  <krebbel@linux.ibm.com>

Backport from mainline
2019-07-01  Andreas Krebbel  <krebbel@linux.ibm.com>

* config/s390/vector.md: Fix shift count operand printing.

gcc/testsuite/ChangeLog:

2019-07-17  Andreas Krebbel  <krebbel@linux.ibm.com>

Backport from mainline
2019-07-01  Andreas Krebbel  <krebbel@linux.ibm.com>

* gcc.target/s390/vector/vec-shift-2.c: New test.

From-SVN: r273546

gcc/ChangeLog
gcc/config/s390/vector.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c [new file with mode: 0644]

index c2d1caa81b99dd2b0d3b3859118c3ce8de37ac21..70232ffbac9c61f736c98705f55bce24c2c955d7 100644 (file)
@@ -1,3 +1,10 @@
+2019-07-17  Andreas Krebbel  <krebbel@linux.ibm.com>
+
+       Backport from mainline
+       2019-07-01  Andreas Krebbel  <krebbel@linux.ibm.com>
+
+       * config/s390/vector.md: Fix shift count operand printing.
+
 2019-07-16  Wilco Dijkstra  <wdijkstr@arm.com>
 
        Backport from mainline
index a2c101245779ce3c6e19a0da20fbef00142b3665..140ef474a920b6b8afe6b7b7ea6eb5959d00b423 100644 (file)
        (VEC_SHIFTS:VI (match_operand:VI 1 "register_operand"   "v")
                       (match_operand:SI 2 "nonmemory_operand" "an")))]
   "TARGET_VX"
-  "<vec_shifts_mnem><bhfgq>\t%v0,%v1,%Y2"
+  "<vec_shifts_mnem><bhfgq>\t%v0,%v1,<addr_style_op_ops>"
   [(set_attr "op_type" "VRS")])
 
 ; Shift each element by corresponding vector element
index afecf0b8ea9c136861ebe49cf167cbfde00c836d..ecd4b6a71789258db7c25ba1dd8c0b9e79b077f2 100644 (file)
@@ -1,3 +1,10 @@
+2019-07-17  Andreas Krebbel  <krebbel@linux.ibm.com>
+
+       Backport from mainline
+       2019-07-01  Andreas Krebbel  <krebbel@linux.ibm.com>
+
+       * gcc.target/s390/vector/vec-shift-2.c: New test.
+
 2019-07-16  Wilco Dijkstra  <wdijkstr@arm.com>
 
        PR target/89190
diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c b/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c
new file mode 100644 (file)
index 0000000..c7a1d93
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -mzarch -march=z13 --save-temps" } */
+
+/* { dg-final { scan-assembler-times "veslf" 1 } } */
+
+typedef __attribute__((vector_size(16))) signed int v4si;
+
+v4si __attribute__((noinline,noclone))
+shift_left_by_scalar (v4si in, int shift_count)
+{
+  return in << (3 + shift_count);
+}
+
+int
+main ()
+{
+  v4si a = { 1, 2, 3, 4 };
+  v4si result = shift_left_by_scalar (a, 1);
+
+  if (result[1] != 32)
+    __builtin_abort ();
+
+  return 0;
+}