Optimize VEC_PERM_EXPR with same permutation index and operation
authorHongyu Wang <hongyu.wang@intel.com>
Mon, 17 Jan 2022 05:01:51 +0000 (13:01 +0800)
committerHongyu Wang <hongyu.wang@intel.com>
Tue, 15 Nov 2022 05:34:05 +0000 (13:34 +0800)
commitdc95e1e9702f2f6367bbc108c8d01169be1b66d2
tree50faeba31b0e0b822022987ca50fd70b946a8879
parent73b582a8e34a3c523c8ece0c6674f473acecab53
Optimize VEC_PERM_EXPR with same permutation index and operation

The sequence
     c1 = VEC_PERM_EXPR (a, a, mask)
     c2 = VEC_PERM_EXPR (b, b, mask)
     c3 = c1 op c2
can be optimized to
     c = a op b
     c3 = VEC_PERM_EXPR (c, c, mask)
for all integer vector operation, and float operation with
full permutation.

gcc/ChangeLog:

PR target/98167
* match.pd: New perm + vector op patterns for int and fp vector.

gcc/testsuite/ChangeLog:

PR target/98167
* gcc.target/i386/pr98167.c: New test.
gcc/match.pd
gcc/testsuite/gcc.target/i386/pr98167.c [new file with mode: 0644]