Commit cbce506f by Andreas Krebbel Committed by Andreas Krebbel

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-01  Andreas Krebbel  <krebbel@linux.ibm.com>

	* config/s390/vector.md:

gcc/testsuite/ChangeLog:

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

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

From-SVN: r272884
parent d21c7dd6
2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/vector.md:
2019-07-01 Richard Sandiford <richard.sandiford@arm.com> 2019-07-01 Richard Sandiford <richard.sandiford@arm.com>
* ira-lives.c (process_bb_node_lives): Use ira_setup_alts. * ira-lives.c (process_bb_node_lives): Use ira_setup_alts.
......
...@@ -981,7 +981,7 @@ ...@@ -981,7 +981,7 @@
(VEC_SHIFTS:VI (match_operand:VI 1 "register_operand" "v") (VEC_SHIFTS:VI (match_operand:VI 1 "register_operand" "v")
(match_operand:SI 2 "nonmemory_operand" "an")))] (match_operand:SI 2 "nonmemory_operand" "an")))]
"TARGET_VX" "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")]) [(set_attr "op_type" "VRS")])
; Shift each element by corresponding vector element ; Shift each element by corresponding vector element
......
2019-07-01 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.target/s390/vector/vec-shift-2.c: New test.
2019-07-01 Ed Schonberg <schonberg@adacore.com> 2019-07-01 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/generic_inst3.adb, * gnat.dg/generic_inst3.adb,
......
/* { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment