This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH v3, rs6000] Add built-in support for vector compare listed in the ABI
- From: "Carl E. Love" <cel at us dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>, segher at kernel dot crashing dot org, David Edelsohn <dje dot gcc at gmail dot com>
- Cc: cel at us dot ibm dot com
- Date: Tue, 06 Dec 2016 13:23:24 -0800
- Subject: [PATCH v3, rs6000] Add built-in support for vector compare listed in the ABI
- Authentication-results: sourceware.org; auth=none
GCC maintainers:
Per the feedback I received on the first and second versions of the
patch I have created the following patch to modify the original commit
for the vector compare built-in support. Specifically, the tests were
broken into files for the processors that supports them. This allows
for specific control over specifying the effective targets and compiler
options.
The patch has been boot strapped and tested on
powerpc64le-unknown-linux-gnu (Power 8) and on
powerpc64-unknown-linux-gnu (Power 7).
Is this ok for trunk?
Carl Love
gcc/testsuite/ChangeLog:
2016-12-06 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/builtins-3.c: Move built-in tests for P8 and
P9 to their own test file. This allows precise constraints on the
effective target and compile options.
* gcc.target/powerpc/builtins-3-p8.c: New file for the vector
compare P8 built-in tests.
* gcc.target/powerpc/builtins-3-p9.c: New file for the vector
compare P9 built-in tests.
---
gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c | 17 ++++++++
gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c | 42 +++++++++++++++++++
gcc/testsuite/gcc.target/powerpc/builtins-3.c | 51 ++++--------------------
3 files changed, 67 insertions(+), 43 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
create mode 100644 gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
new file mode 100644
index 0000000..e52795c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mcpu=power8" } */
+
+#include <altivec.h>
+
+vector bool long long
+test_eq_long_long (vector bool long long x, vector bool long long y)
+{
+ return vec_cmpeq (x, y);
+}
+
+/* Expected test results:
+
+ test_eq_long_long 1 vcmpequd inst */
+
+/* { dg-final { scan-assembler-times "vcmpequd" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
new file mode 100644
index 0000000..d846e29
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p9vector_ok } */
+/* { dg-options "-mcpu=power9" } */
+
+#include <altivec.h>
+
+vector bool char
+test_ne_char (vector bool char x, vector bool char y)
+{
+ return vec_cmpne (x, y);
+}
+
+vector bool short
+test_ne_short (vector bool short x, vector bool short y)
+{
+ return vec_cmpne (x, y);
+}
+
+vector bool int
+test_ne_int (vector bool int x, vector bool int y)
+{
+ return vec_cmpne (x, y);
+}
+
+vector bool long
+test_ne_long (vector bool long x, vector bool long y)
+{
+ return vec_cmpne (x, y);
+}
+
+/* Expected test results:
+
+ test_ne_char 1 vcmpneb
+ test_ne_short 1 vcmpneh
+ test_ne_int 1 vcmpnew
+ test_ne_long 1 vcmpequd, 1 xxlnor inst */
+
+/* { dg-final { scan-assembler-times "vcmpneb" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpneh" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpnew" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpequd" 1 } } */
+/* { dg-final { scan-assembler-times "xxlnor" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3.c b/gcc/testsuite/gcc.target/powerpc/builtins-3.c
index 1a09654..1d243ce 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-maltivec -mvsx" } */
#include <altivec.h>
@@ -22,48 +22,13 @@ test_eq_int (vector bool int x, vector bool int y)
return vec_cmpeq (x, y);
}
-vector bool long
-test_eq_long (vector bool long x, vector bool long y)
-{
- return vec_cmpeq (x, y);
-}
-
-vector bool char
-test_ne_char (vector bool char x, vector bool char y)
-{
- return vec_cmpne (x, y);
-}
-
-vector bool short
-test_ne_short (vector bool short x, vector bool short y)
-{
- return vec_cmpne (x, y);
-}
-
-vector bool int
-test_ne_int (vector bool int x, vector bool int y)
-{
- return vec_cmpne (x, y);
-}
-
-vector bool long
-test_ne_long (vector bool long x, vector bool long y)
-{
- return vec_cmpne (x, y);
-}
-/* Note: vec_cmpne is implemented as vcmpeq and then NOT'ed
- using the xxlnor instruction.
+/* Expected test results:
- Expected test results:
- test_eq_char 1 vcmpeq inst
- test_eq_short 1 vcmpeq inst
- test_eq_int 1 vcmpeq inst
- test_eq_long 1 vcmpeq inst
- test_ne_char 1 vcmpeq, 1 xxlnor inst
- test_ne_short 1 vcmpeq, 1 xxlnor inst
- test_ne_int 1 vcmpeq, 1 xxlnor inst
- test_ne_long 1 vcmpeq, 1 xxlnor inst */
+ test_eq_char 1 vcmpequb inst
+ test_eq_short 1 vcmpequh inst
+ test_eq_int 1 vcmpequw inst */
-/* { dg-final { scan-assembler-times "vcmpeq" 8 } } */
-/* { dg-final { scan-assembler-times "xxlnor" 4 } } */
+/* { dg-final { scan-assembler-times "vcmpequb" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpequh" 1 } } */
+/* { dg-final { scan-assembler-times "vcmpequw" 1 } } */
--
1.9.1