This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, rs6000] Add missing vec_max tests
- From: Carl Love <cel at us dot ibm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: Peter Bergner <bergner at vnet dot ibm dot com>, gcc-patches at gcc dot gnu dot org, David Edelsohn <dje dot gcc at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Date: Fri, 04 May 2018 07:59:37 -0700
- Subject: Re: [PATCH, rs6000] Add missing vec_max tests
- References: <1525102564.13190.1.camel@us.ibm.com> <063ed1a5-08b7-36b1-d9f5-c584ac46e659@vnet.ibm.com> <1525107147.13190.5.camel@us.ibm.com> <20180503164313.GN14117@gate.crashing.org>
Segher:
> > - *out++ = vec_sel (in0, in1, inl);
> > - *out++ = vec_sel (in0, in1, inb);
> > *out++ = vec_sub (in0, in1);
> > *out++ = vec_sqrt (in0);
> > *out++ = vec_trunc (in0);
>
> Why does the patch remove these two vec_sel? If that is wanted, the
> changelog should mention this.
>
Segher:
No clue why I removed the vec_sel test. Been sitting on the testsuite
patch set too long, I don't recall. I put it back in and tested it.
Then noticed there wasn't any tests for the xxsel instruction which the
vec_sel test generates. I added an instruction count test to both the
BE and LE tests. I found the BE test needed some updating as well.
The revised patch is given below. I retested on:
powerpc64le-unknown-linux-gnu (Power 8 LE)
powerpc64-unknown-linux-gnu (Power 8 BE)
powerpc64le-unknown-linux-gnu (Power 9 LE).
Please let me know if everything looks OK now. Thanks.
Carl Love
----------------------------------------------------------------
gcc/testsuite/ChangeLog:
2018-05-03 Carl Love <cel@us.ibm.com>
* gcc.target/powerpc/vsx-vector-6.h (foo): Add test for vec_max,
vec_trunc.
* gcc.target/powerpc/vsx-vector-6-le.c (dg-final): Update xvcmpeqdp,
xvcmpgtdp, xvcmpgedp counts. Add xxsel counts.
* gcc.target/powerpc/vsx-vector-6-be.c (dg-final): Update xvcmpgtdp,
xvcmpgedp counts. Add xxsel counts.
---
gcc/testsuite/gcc.target/powerpc/vsx-vector-6-be.c | 5 +++--
gcc/testsuite/gcc.target/powerpc/vsx-vector-6-le.c | 7 ++++---
gcc/testsuite/gcc.target/powerpc/vsx-vector-6.h | 14 ++++++++++++--
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-be.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-be.c
index a33f6d1..3305781 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-be.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-be.c
@@ -9,8 +9,8 @@
/* { dg-final { scan-assembler-times "xvadddp" 1 } } */
/* { dg-final { scan-assembler-times "xxlnor" 7 } } */
/* { dg-final { scan-assembler-times "xvcmpeqdp" 6 } } */
-/* { dg-final { scan-assembler-times "xvcmpgtdp" 7 } } */
-/* { dg-final { scan-assembler-times "xvcmpgedp" 6 } } */
+/* { dg-final { scan-assembler-times "xvcmpgtdp" 8 } } */
+/* { dg-final { scan-assembler-times "xvcmpgedp" 7 } } */
/* { dg-final { scan-assembler-times "xvrdpim" 1 } } */
/* { dg-final { scan-assembler-times "xvmaddadp" 1 } } */
/* { dg-final { scan-assembler-times "xvmsubadp" 1 } } */
@@ -26,6 +26,7 @@
/* { dg-final { scan-assembler-times "xvnmaddasp" 1 } } */
/* { dg-final { scan-assembler-times "vmsumshs" 1 } } */
/* { dg-final { scan-assembler-times "xxland" 13 } } */
+/* { dg-final { scan-assembler-times "xxsel" 2 } } */
/* Source code for the test in vsx-vector-6.h */
#include "vsx-vector-6.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-le.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-le.c
index fe7eeb1..dbf87b3 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-le.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-le.c
@@ -14,9 +14,9 @@
their usage counts being stable. Therefore, we just ensure at least one
xxlor instruction was generated. */
/* { dg-final { scan-assembler "xxlor" } } */
-/* { dg-final { scan-assembler-times "xvcmpeqdp" 5 } } */
-/* { dg-final { scan-assembler-times "xvcmpgtdp" 8 } } */
-/* { dg-final { scan-assembler-times "xvcmpgedp" 6 } } */
+/* { dg-final { scan-assembler-times "xvcmpeqdp" 4 } } */
+/* { dg-final { scan-assembler-times "xvcmpgtdp" 7 } } */
+/* { dg-final { scan-assembler-times "xvcmpgedp" 7 } } */
/* { dg-final { scan-assembler-times "xvrdpim" 1 } } */
/* { dg-final { scan-assembler-times "xvmaddadp" 1 } } */
/* { dg-final { scan-assembler-times "xvmsubadp" 1 } } */
@@ -32,6 +32,7 @@
/* { dg-final { scan-assembler-times "xvnmaddasp" 1 } } */
/* { dg-final { scan-assembler-times "vmsumshs" 1 } } */
/* { dg-final { scan-assembler-times "xxland" 13 } } */
+/* { dg-final { scan-assembler-times "xxsel" 2 } } */
/* Source code for the test in vsx-vector-6.h */
#include "vsx-vector-6.h"
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6.h b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6.h
index 422f8a1..a891b64 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6.h
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6.h
@@ -7,7 +7,9 @@
void foo (vector double *out, vector double *in, vector long *p_l, vector bool long *p_b,
vector unsigned char *p_uc, int *i, vector float *p_f,
vector bool char *outbc, vector bool int *outbi,
- vector bool short *outbsi, vector int *outsi, vector unsigned int *outui)
+ vector bool short *outbsi, vector int *outsi,
+ vector unsigned int *outui, vector signed char *outsc,
+ vector unsigned char *outuc)
{
vector double in0 = in[0];
vector double in1 = in[1];
@@ -20,6 +22,8 @@ void foo (vector double *out, vector double *in, vector long *p_l, vector bool l
vector float inf0;
vector float inf1;
vector float inf2;
+ vector char inc0;
+ vector char inc1;
vector bool char inbc0;
vector bool char inbc1;
vector bool short inbs0;
@@ -30,6 +34,7 @@ void foo (vector double *out, vector double *in, vector long *p_l, vector bool l
vector unsigned short int inusi0, inusi1;
vector signed int insi0, insi1;
vector unsigned int inui0, inui1;
+ vector unsigned char inuc0, inuc1;
*out++ = vec_abs (in0);
*out++ = vec_add (in0, in1);
@@ -103,6 +108,7 @@ void foo (vector double *out, vector double *in, vector long *p_l, vector bool l
*p_f++ = vec_nmsub (inf0, inf1, inf2);
*p_f++ = vec_nmadd (inf0, inf1, inf2);
*p_f++ = vec_or (inf0, inf1);
+ *p_f++ = vec_trunc (inf0);
*out++ = vec_or (inbl0, in0);
*out++ = vec_or (in0, inbl0);
@@ -113,6 +119,8 @@ void foo (vector double *out, vector double *in, vector long *p_l, vector bool l
*outbc++ = vec_andc (inbc0, inbc1);
*outbc++ = vec_or (inbc0, inbc1);
+ *outuc++ = vec_max (inuc0, inuc1);
+
*outbi++ = vec_andc (inbi0, inbi1);
*outbsi++ = vec_andc (inbs0, inbs1);
@@ -151,7 +159,9 @@ int main()
vector bool short *outbsi;
vector int *outsi;
vector unsigned int *outui;
+ vector signed char *outsc;
+ vector unsigned char *outuc;
foo (out, in, p_l, p_b, p_uc, i, p_f, outbc,
- outbi, outbsi, outsi, outui);
+ outbi, outbsi, outsi, outui, outsc, outuc);
}
--
2.7.4