p9-extract-1.c: Make second argument of vec_extract a signed int.
authorCarl Love <cel@us.ibm.com>
Mon, 25 Jun 2018 16:04:14 +0000 (16:04 +0000)
committerCarl Love <carll@gcc.gnu.org>
Mon, 25 Jun 2018 16:04:14 +0000 (16:04 +0000)
gcc/testsuite/ChangeLog:

2018-06-25  Carl Love  <cel@us.ibm.com>

* gcc.target/powerpc/p9-extract-1.c: Make second argument of
  vec_extract a signed int. Add vec_extract tests for bool char
and bool int.
* gcc.target/powerpc/p9-extract-4.c:  New test file for long long
vec_extract tests.

From-SVN: r262023

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/p9-extract-1.c
gcc/testsuite/gcc.target/powerpc/p9-extract-4.c [new file with mode: 0644]

index f9912f0..9d3d16e 100644 (file)
@@ -1,3 +1,13 @@
+gcc/testsuite/ChangeLog:
+
+2018-06-25  Carl Love  <cel@us.ibm.com>
+
+       * gcc.target/powerpc/p9-extract-1.c: Make second argument of
+       vec_extract a signed int. Add vec_extract tests for bool char
+       and bool int.
+       * gcc.target/powerpc/p9-extract-4.c:  New test file for long long
+       vec_extract tests.
+
 2018-06-25  Tom de Vries  <tdevries@suse.de>
 
        * lib/gcc-gdb-test.exp (report_gdb): Handle gdb -v failure.
index ecbe0ed..ab9e766 100644 (file)
 int
 extract_int_0 (vector int a)
 {
-  int b = vec_extract (a, 0);
+  int c = 0;
+  int b = vec_extract (a, c);
   return b;
 }
 
 int
 extract_int_3 (vector int a)
 {
-  int b = vec_extract (a, 3);
+  int c = 3;
+  int b = vec_extract (a, c);
   return b;
 }
 
 unsigned int
 extract_uint_0 (vector unsigned int a)
 {
-  unsigned int b = vec_extract (a, 0);
+  int c = 0;
+  unsigned int b = vec_extract (a, c);
   return b;
 }
 
 unsigned int
 extract_uint_3 (vector unsigned int a)
 {
-  unsigned int b = vec_extract (a, 3);
+  int c = 3;
+  unsigned int b = vec_extract (a, c);
   return b;
 }
 
 short
 extract_short_0 (vector short a)
 {
-  short b = vec_extract (a, 0);
+  int c = 0;
+  short b = vec_extract (a, c);
   return b;
 }
 
 short
 extract_short_7 (vector short a)
 {
-  short b = vec_extract (a, 7);
+  int c = 7;
+  short b = vec_extract (a, c);
   return b;
 }
 
 unsigned short
 extract_ushort_0 (vector unsigned short a)
 {
-  unsigned short b = vec_extract (a, 0);
+  int c = 0;
+  unsigned short b = vec_extract (a, c);
   return b;
 }
 
 unsigned short
 extract_ushort_7 (vector unsigned short a)
 {
-  unsigned short b = vec_extract (a, 7);
+  int c = 7;
+  unsigned short b = vec_extract (a, c);
   return b;
 }
 
 signed char
 extract_schar_0 (vector signed char a)
 {
-  signed char b = vec_extract (a, 0);
+  int c = 0;
+  signed char b = vec_extract (a, c);
   return b;
 }
 
 signed char
 extract_schar_15 (vector signed char a)
 {
-  signed char b = vec_extract (a, 15);
+  int c = 15;
+  signed char b = vec_extract (a, c);
   return b;
 }
 
 unsigned char
 extract_uchar_0 (vector unsigned char a)
 {
-  unsigned char b = vec_extract (a, 0);
+  int c = 0;
+  unsigned char b = vec_extract (a, c);
   return b;
 }
 
 unsigned char
 extract_uchar_15 (vector unsigned char a)
 {
-  signed char b = vec_extract (a, 15);
+  int c = 15;
+  signed char b = vec_extract (a, c);
+  return b;
+}
+
+unsigned char
+extract_bool_char_0 (vector bool char a)
+{
+  int c = 0;
+  unsigned char b = vec_extract (a, c);
+  return b;
+}
+
+unsigned int
+extract_bool_int_0 (vector bool int a)
+{
+  int c = 0;
+  unsigned int b = vec_extract (a, c);
   return b;
 }
 
diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-4.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-4.c
new file mode 100644 (file)
index 0000000..1f38982
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mcpu=power9 -O2" } */
+
+/* This file tests the extraction of 64-bit values.  On Power 9, the direct
+   move is prefered for the  64-bit extract as it is either lower latency or
+   the same latency as the extract instruction depending on the Endianess of
+   the system.  Furthermore, there can be up to four move instructions in
+   flight at a time versus only two extract intructions at a time.  */
+
+#include <altivec.h>
+
+unsigned long long
+extract_bool_long_long_0 (vector bool long long a)
+{
+  int c = 0;
+  unsigned long long b = vec_extract (a, c);
+  return b;
+}
+
+unsigned long long int
+extract_long_long_0 (vector unsigned long long int a)
+{
+  int c = 0;
+  unsigned long long int b = vec_extract (a, c);
+  return b;
+}
+
+/* { dg-final { scan-assembler-times "m\[ft\]vsr" 2 } } */