rs6000: Remove useless insns fed into lvx/stvx [PR97019]
authorKewen Lin <linkw@linux.ibm.com>
Wed, 16 Sep 2020 03:32:55 +0000 (22:32 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Wed, 16 Sep 2020 03:59:35 +0000 (22:59 -0500)
commite0d98ffd14487b7105de3d151122144086faa1fa
tree06428317ab4a0f16f5940fb03dd8d0da63a8c6c0
parent01d56aeaffa11959278dd6f6f2c1085cac25a345
rs6000: Remove useless insns fed into lvx/stvx [PR97019]

This patch is to extend the existing function find_alignment_op to
check all defintions of base_reg are AND operations with mask -16B
to force the alignment.  If all are satifised, it passes all AND
operations and instructions to function recombine_lvx_pattern
and recombine_stvx_pattern, they can remove all useless ANDs
further.

Bootstrapped/regtested on powerpc64le-linux-gnu P8.

gcc/ChangeLog:

PR target/97019
* config/rs6000/rs6000-p8swap.c (find_alignment_op): Adjust to
support multiple defintions which are all AND operations with
the mask -16B.
(recombine_lvx_pattern): Adjust to handle multiple AND operations
from find_alignment_op.
(recombine_stvx_pattern): Likewise.

gcc/testsuite/ChangeLog:

PR target/97019
* gcc.target/powerpc/pr97019.c: New test.
gcc/config/rs6000/rs6000-p8swap.c
gcc/testsuite/gcc.target/powerpc/pr97019.c [new file with mode: 0644]