GCC Maintainers:
Test file gcc/testsuite/gcc.target/powerpc/altivec-7.c has issues when
compiling for Power 6. Specifically, the new tests that were added for
vec_unpackh and vec_unpackl that return a long long bool. The long
long type is not compatible on Power 6 with just the "-maltivec"
command line option.
This patch removes the tests for vec_unpackh and vec_unpackl that
return a long long bool from altivec-7.c and puts them in a new file
altivec-37.c using the "=mvsx" option. Additionally, tests for the two
builtins returning long long int are added to altivec-37.
The patch was tested on:
powerpc64le-unknown-linux-gnu (Power 8 LE)
powerpc64le-unknown-linux-gnu (Power 9 LE)
powerpc64-unknown-linux-gnu (Power 8 BE)
With no regressions.
Additionally, hand testing with the commands
make -k check-gcc RUNTESTFLAGS="-mcpu=power6 --target_board=unix'{-m64,-m32}'
powerpc.exp=altivec-7.c"
make -k check-gcc RUNTESTFLAGS="-mcpu=power6 --target_board=unix'{-m64,-m32}'
powerpc.exp=altivec-37.c"
were run on all three configurations to ensure compiling for Power 6 works
everywhere.
Please let me know if the patch looks OK for GCC mainline.
Carl Love
---------------------------------------------------------------------
gcc/testsuite/ChangeLog:
2018-06-08 Carl Love <[email protected]>
* gcc.target/powerpc/altivec-7.c (main): Remove tests
vec_unpackh(vecubi[0]) and vec_unpackl(vecubi[0]). Remove
duplicate dg-final for xxlxor. Update dg-final instruction
counts.
* gcc.target/powerpc/altivec-37.c (main): New file for
tests vec_unpackh(vecubi[0]) and vec_unpackl(vecubi[0]).
---
gcc/testsuite/gcc.target/powerpc/altivec-37.c | 32 +++++++++++++++++++++++++++
gcc/testsuite/gcc.target/powerpc/altivec-7.c | 9 +-------
2 files changed, 33 insertions(+), 8 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/powerpc/altivec-37.c
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-37.c
b/gcc/testsuite/gcc.target/powerpc/altivec-37.c
new file mode 100644
index 0000000..a77bcd3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-37.c
@@ -0,0 +1,32 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mpower8-vector -mvsx" } */
+
+#include <altivec.h>
+
+vector bool int *vecubi;
+vector bool long long *vecublli;
+vector signed int *vecsi;
+vector signed long long int *vecslli;
+
+int main ()
+{
+
+ /* use of ‘long long’ in AltiVec types requires -mvsx */
+ /* __builtin_altivec_vupkhsw and __builtin_altivec_vupklsw
+ requires the -mpower8-vector option */
+ *vecublli++ = vec_unpackh(vecubi[0]);
+ *vecslli++ = vec_unpackl(vecsi[0]);
+
+ return 0;
+}
+
+//MAKE SURE INSTRUCTIONS ARE CORRECT
+
+/* Expected results:
+ vec_unpackh vupklsw
+ vec_unpackl vupkhsw
+*/
+
+/* { dg-final { scan-assembler-times "vupklsw" 1 } } */
+/* { dg-final { scan-assembler-times "vupkhsw" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-7.c
b/gcc/testsuite/gcc.target/powerpc/altivec-7.c
index 6aad9a9..b61092c 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-7.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-7.c
@@ -18,7 +18,6 @@ vector unsigned int *vecuint;
vector bool int *vecubi;
vector bool char *vecubci;
vector bool short int *vecubsi;
-vector bool long long int *vecublli;
vector unsigned short *vecushort;
vector bool int *vecbint;
vector float *vecfloat;
@@ -50,13 +49,11 @@ int main ()
*vecubi++ = vec_unpackh(vecubsi[0]);
*vecuint++ = vec_unpackh(varpixel[0]);
- *vecublli++ = vec_unpackh(vecubi[0]);
*vecubsi++ = vec_unpackh(vecubci[0]);
*vecshort++ = vec_unpackh(vecchar[0]);
*vecubi++ = vec_unpackl(vecubsi[0]);
*vecuint++ = vec_unpackl(varpixel[0]);
- *vecublli++ = vec_unpackl(vecubi[0]);
*vecubsi++ = vec_unpackl(vecubci[0]);
*vecshort++ = vec_unpackl(vecchar[0]);
@@ -72,11 +69,9 @@ int main ()
vec_lvewx lvewx
vec_unpackh vupklsh
vec_unpackh vupklpx
- vec_unpackh vupklsw
vec_unpackh vupklsb
vec_unpackl vupkhsh
vec_unpackl vupkhpx
- vec_unpackl vupkhsw
vec_unpackl vupkhsb
vec_andc xxnor
xxland
@@ -90,7 +85,7 @@ int main ()
/* { dg-final { scan-assembler-times "vpkpx" 2 } } */
/* { dg-final { scan-assembler-times "vmulesb" 1 } } */
/* { dg-final { scan-assembler-times "vmulosb" 1 } } */
-/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M} 44 { target le } } }
*/
+/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M} 42 { target le } } }
*/
/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M} 4 { target be } } }
*/
/* { dg-final { scan-assembler-times "lvewx" 2 } } */
/* { dg-final { scan-assembler-times "lvxl" 1 } } */
@@ -100,12 +95,10 @@ int main ()
/* { dg-final { scan-assembler-times "xxland" 4 } } */
/* { dg-final { scan-assembler-times "xxlxor" 5 } } */
/* { dg-final { scan-assembler-times "xxlandc" 0 } } */
-/* { dg-final { scan-assembler-times "xxlxor" 5 } } */
/* { dg-final { scan-assembler-times "lvx" 1 } } */
/* { dg-final { scan-assembler-times "vmsumubm" 1 } } */
/* { dg-final { scan-assembler-times "vupklpx" 1 } } */
/* { dg-final { scan-assembler-times "vupklsx" 0 } } */
/* { dg-final { scan-assembler-times "vupklsb" 2 } } */
/* { dg-final { scan-assembler-times "vupkhpx" 1 } } */
-/* { dg-final { scan-assembler-times "vupkhsw" 1 } } */
/* { dg-final { scan-assembler-times "vupkhsb" 2 } } */
--
2.7.4