[rs6000] Fix x86 SSSE3 compatibility implementations and testcases
authorPaul A. Clarke <pc@us.ibm.com>
Wed, 19 Dec 2018 15:06:00 +0000 (15:06 +0000)
committerPaul Clarke <pc@gcc.gnu.org>
Wed, 19 Dec 2018 15:06:00 +0000 (15:06 +0000)
commit9a0317e70007d6558e53a2ba5b104ff09b2e9642
treef1f4edb728114846cdec925fe3fa4c24fef616bc
parentec5e681485a3a069ccf0316dacba4ce6fa348c6b
[rs6000] Fix x86 SSSE3 compatibility implementations and testcases

This patch is the analog to r266868-r266870, but for SSSE3.
The SSSE3 tests had been inadvertently made to PASS without actually running
the test code. Actually running the code turned up some previously undetected
issues.

This patch fixes some issues in the implementations, fixes up the tests
to use a union for the test data, which avoids strict aliasing issues,
and enables the tests to actually run (by removing a dependency on
__BUILTIN_CPU_SUPPORTS).

Also, there's a fairly insignificant change in the testcases that walk
through the data as pairs of vectors from:
  [0] and [1]
  [2] and [3]
  ...
  [n-4] and [n-3]
  [n-2] and [n-1]

to:
  [0] and [1]
  [1] and [2]
  ...
  [n-3] and [n-2]
  [n-2] and [n-1]

Since the testcases compute the correct answers based on the input, no
other changes were necessary to effect the change.

2018-12-19  Paul A. Clarke  <pc@us.ibm.com>

[gcc]

* config/rs6000/tmmintrin.h (_mm_hadds_epi16): Vector lanes swapped.
(_mm_hsub_epi32): Likewise.
(_mm_shuffle_epi8): Fix reversed interpretation of parameters.
(_mm_shuffle_pi8): Likewise.
(_mm_addubs_pi16): Likewise.

[gcc/testsuite]

* gcc.target/powerpc/ssse3-check.h: Enable tests to run.
* gcc.target/powerpc/ssse3-pabsb.c: Code fixes for strict aliasing
issues.
* gcc.target/powerpc/ssse3-pabsd.c: Likewise.
* gcc.target/powerpc/ssse3-palignr.c: Likewise.
* gcc.target/powerpc/ssse3-phaddd.c: Likewise.
* gcc.target/powerpc/ssse3-phaddsw.c: Likewise.
* gcc.target/powerpc/ssse3-phaddw.c: Likewise.
* gcc.target/powerpc/ssse3-phsubd.c: Likewise.
* gcc.target/powerpc/ssse3-phsubw.c: Likewise.
* gcc.target/powerpc/ssse3-pmulhrsw.c: Likewise.
* gcc.target/powerpc/ssse3-pshufb.c: Likewise.
* gcc.target/powerpc/ssse3-psignb.c: Likewise.
* gcc.target/powerpc/ssse3-psignd.c: Likewise.
* gcc.target/powerpc/ssse3-psignw.c: Likewise.
* gcc.target/powerpc/ssse3-vals.h: Provide input data as a union.

From-SVN: r267271
21 files changed:
gcc/ChangeLog
gcc/config/rs6000/tmmintrin.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/ssse3-check.h
gcc/testsuite/gcc.target/powerpc/ssse3-pabsb.c
gcc/testsuite/gcc.target/powerpc/ssse3-pabsd.c
gcc/testsuite/gcc.target/powerpc/ssse3-pabsw.c
gcc/testsuite/gcc.target/powerpc/ssse3-palignr.c
gcc/testsuite/gcc.target/powerpc/ssse3-phaddd.c
gcc/testsuite/gcc.target/powerpc/ssse3-phaddsw.c
gcc/testsuite/gcc.target/powerpc/ssse3-phaddw.c
gcc/testsuite/gcc.target/powerpc/ssse3-phsubd.c
gcc/testsuite/gcc.target/powerpc/ssse3-phsubsw.c
gcc/testsuite/gcc.target/powerpc/ssse3-phsubw.c
gcc/testsuite/gcc.target/powerpc/ssse3-pmaddubsw.c
gcc/testsuite/gcc.target/powerpc/ssse3-pmulhrsw.c
gcc/testsuite/gcc.target/powerpc/ssse3-pshufb.c
gcc/testsuite/gcc.target/powerpc/ssse3-psignb.c
gcc/testsuite/gcc.target/powerpc/ssse3-psignd.c
gcc/testsuite/gcc.target/powerpc/ssse3-psignw.c
gcc/testsuite/gcc.target/powerpc/ssse3-vals.h