From: Andreas Krebbel Date: Mon, 15 Jul 2019 14:31:37 +0000 (+0000) Subject: S/390: Fix vector shift count operand X-Git-Tag: releases/gcc-7.5.0~352 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f4019044f410a2604f7ec350661fd484c300f46;p=thirdparty%2Fgcc.git S/390: Fix vector shift count operand 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-15 Andreas Krebbel Backport from mainline 2019-07-01 Andreas Krebbel * config/s390/vector.md: Fix shift count operand printing. gcc/testsuite/ChangeLog: 2019-07-15 Andreas Krebbel Backport from mainline 2019-07-01 Andreas Krebbel * gcc.target/s390/vector/vec-shift-2.c: New test. From-SVN: r273494 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c98e8b7d442..9de8ec77ca2e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-07-15 Andreas Krebbel + + Backport from mainline + 2019-07-01 Andreas Krebbel + + * config/s390/vector.md: Fix shift count operand printing. + 2019-07-12 Eric Botcazou PR rtl-optimization/91136 diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index 2952893834a7..eaa57071014e 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -933,7 +933,7 @@ (VEC_SHIFTS:VI (match_operand:VI 1 "register_operand" "v") (match_operand:SI 2 "nonmemory_operand" "an")))] "TARGET_VX" - "\t%v0,%v1,%Y2" + "\t%v0,%v1," [(set_attr "op_type" "VRS")]) ; Shift each element by corresponding vector element diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dd09f7696429..468cd0928ef7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-07-15 Andreas Krebbel + + Backport from mainline + 2019-07-01 Andreas Krebbel + + * gcc.target/s390/vector/vec-shift-2.c: New test. + 2019-07-12 Wilco Dijkstra PR testsuite/78529 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 index 000000000000..c7a1d93b817e --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vec-shift-2.c @@ -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; +}