rs6000.c (altivec_init_builtins): Define POWER8 built-ins for vec_xl and vec_xst...
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Wed, 10 May 2017 19:40:17 +0000 (19:40 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Wed, 10 May 2017 19:40:17 +0000 (19:40 +0000)
[gcc]

2017-05-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

* config/rs6000/rs6000.c (altivec_init_builtins): Define POWER8
built-ins for vec_xl and vec_xst with short and char pointer
arguments.

[gcc/testsuite]

2017-05-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

* gcc.target/powerpc/p8-vec-xl-xst.c: New file.

From-SVN: r247854

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/p8-vec-xl-xst.c [new file with mode: 0644]

index ce8351445bf76e2e4cf6fb310422347a48f17b48..075b50d1fc5fd88d697942c813b92a38b8dd56bb 100644 (file)
@@ -1,3 +1,9 @@
+2017-05-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * config/rs6000/rs6000.c (altivec_init_builtins): Define POWER8
+       built-ins for vec_xl and vec_xst with short and char pointer
+       arguments.
+
 2017-05-10  Sebastian Peryt  <sebastian.peryt@intel.com>
 
        * config/i386/avx512fintrin.h (_mm_mask_max_round_sd)
index 17b93a65b80296f0cf8750bded579f5a59aeadf7..e77026a931caa9df0f8d902a8e96c13ad4132225 100644 (file)
@@ -18295,6 +18295,17 @@ altivec_init_builtins (void)
       def_builtin ("__builtin_vsx_st_elemrev_v16qi",
                   void_ftype_v16qi_long_pvoid, VSX_BUILTIN_ST_ELEMREV_V16QI);
     }
+  else
+    {
+      rs6000_builtin_decls[(int) VSX_BUILTIN_LD_ELEMREV_V8HI]
+       = rs6000_builtin_decls[(int) VSX_BUILTIN_LXVW4X_V8HI];
+      rs6000_builtin_decls[(int) VSX_BUILTIN_LD_ELEMREV_V16QI]
+       = rs6000_builtin_decls[(int) VSX_BUILTIN_LXVW4X_V16QI];
+      rs6000_builtin_decls[(int) VSX_BUILTIN_ST_ELEMREV_V8HI]
+       = rs6000_builtin_decls[(int) VSX_BUILTIN_STXVW4X_V8HI];
+      rs6000_builtin_decls[(int) VSX_BUILTIN_ST_ELEMREV_V16QI]
+       = rs6000_builtin_decls[(int) VSX_BUILTIN_STXVW4X_V16QI];
+    }
 
   def_builtin ("__builtin_vec_vsx_ld", opaque_ftype_long_pcvoid,
               VSX_BUILTIN_VEC_LD);
index 57545d795f02525223660bd9e52358f966c21895..d7d1d04cb6937c0a5a12c57cad0140388a59154c 100644 (file)
@@ -1,3 +1,7 @@
+2017-05-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+
+       * gcc.target/powerpc/p8-vec-xl-xst.c: New file.
+
 2017-05-10  Sebastian Peryt  <sebastian.peryt@intel.com>
 
        * gcc.target/i386/avx512f-vmaxsd-1.c (_mm_mask_max_round_sd)
diff --git a/gcc/testsuite/gcc.target/powerpc/p8-vec-xl-xst.c b/gcc/testsuite/gcc.target/powerpc/p8-vec-xl-xst.c
new file mode 100644 (file)
index 0000000..de4e10f
--- /dev/null
@@ -0,0 +1,62 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O2" } */
+
+/* Verify fix for problem where vec_xl and vec_xst are not recognized
+   for the vector char and vector short cases on P8 only.  */
+
+#include <altivec.h>
+
+vector unsigned char
+foo (unsigned char * address)
+{
+  return __builtin_vec_xl (0, address);
+}
+
+void
+bar (vector unsigned char x, unsigned char * address)
+{
+  __builtin_vec_xst (x, 0, address);
+}
+
+vector unsigned short
+foot (unsigned short * address)
+{
+  return __builtin_vec_xl (0, address);
+}
+
+void
+bart (vector unsigned short x, unsigned short * address)
+{
+  __builtin_vec_xst (x, 0, address);
+}
+
+vector unsigned char
+fool (unsigned char * address)
+{
+  return vec_xl (0, address);
+}
+
+void
+barl (vector unsigned char x, unsigned char * address)
+{
+  vec_xst (x, 0, address);
+}
+
+vector unsigned short
+footle (unsigned short * address)
+{
+  return vec_xl (0, address);
+}
+
+void
+bartle (vector unsigned short x, unsigned short * address)
+{
+  vec_xst (x, 0, address);
+}
+
+/* { dg-final { scan-assembler-times "lxvd2x"   4 } } */
+/* { dg-final { scan-assembler-times "stxvd2x"  4 } } */
+/* { dg-final { scan-assembler-times "xxpermdi" 8 } } */