[PATCH, rs6000] Fix PR61397 (test case update for P8 vector loads/stores)

2016-02-26 Thread Bill Schmidt
Hi,

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61397 was almost resolved a
year ago, but had a proposed patch by Mike Meissner that was never
vetted and committed.  I've reviewed the patch and tested it on GCC 5
and GCC 6, and with the patch applied we see the test pass for both
32-bit and 64-bit on a Power8 big-endian platform, as well as for 64-bit
on a Power8 little-endian platform.

As I understand it, the test case got out of sync with the
implementation in GCC 5, and this rewrite of the test case restores
order.  I've verified that the original compilation options from Andreas
Schwab for this test case result in correct generation of lxsdx, which
was not the case with the original report.

The test case is extremely different in GCC 4.9.  As Mike has noted in
the PR, the -mupper-regs support does not exist in GCC 4.9, so the
rewritten test case does not apply there.

As stated, verified on powerpc64-unknown-linux-gnu (-m32, -m64) and
powerpc64le-unknown-linux-gnu (-m64).  Is this ok for trunk and GCC 5?

Thanks,
Bill


2016-02-26  Michael Meissner 
Bill Schmidt  

* gcc.target/powerpc/p8vector-ldst.c: Adjust to test desired
functionality for both 32-bit and 64-bit.


--- gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c(revision 220948)
+++ gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c(working copy)
@@ -1,4 +1,4 @@ 
-/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { 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" } } */
@@ -51,13 +51,14 @@ load_store_sf (unsigned long num,
   float value37= 0.0f;
   float value38= 0.0f;
   float value39= 0.0f;
-  unsigned long in_mask;
-  unsigned long out_mask;
+  unsigned long in_mask, in_mask2;
+  unsigned long out_mask, out_mask2;
   unsigned long i;
 
   for (i = 0; i < num; i++)
 {
   in_mask = *in_mask_ptr++;
+  in_mask2 = *in_mask_ptr++;
   if ((in_mask & (1L <<  0)) != 0L)
value00 = *from_ptr++;
 
@@ -118,67 +119,68 @@ load_store_sf (unsigned long num,
   if ((in_mask & (1L << 19)) != 0L)
value19 = *from_ptr++;
 
-  if ((in_mask & (1L << 20)) != 0L)
+  if ((in_mask2 & (1L << 0)) != 0L)
value20 = *from_ptr++;
 
-  if ((in_mask & (1L << 21)) != 0L)
+  if ((in_mask2 & (1L << 1)) != 0L)
value21 = *from_ptr++;
 
-  if ((in_mask & (1L << 22)) != 0L)
+  if ((in_mask2 & (1L << 2)) != 0L)
value22 = *from_ptr++;
 
-  if ((in_mask & (1L << 23)) != 0L)
+  if ((in_mask2 & (1L << 3)) != 0L)
value23 = *from_ptr++;
 
-  if ((in_mask & (1L << 24)) != 0L)
+  if ((in_mask2 & (1L << 4)) != 0L)
value24 = *from_ptr++;
 
-  if ((in_mask & (1L << 25)) != 0L)
+  if ((in_mask2 & (1L << 5)) != 0L)
value25 = *from_ptr++;
 
-  if ((in_mask & (1L << 26)) != 0L)
+  if ((in_mask2 & (1L << 6)) != 0L)
value26 = *from_ptr++;
 
-  if ((in_mask & (1L << 27)) != 0L)
+  if ((in_mask2 & (1L << 7)) != 0L)
value27 = *from_ptr++;
 
-  if ((in_mask & (1L << 28)) != 0L)
+  if ((in_mask2 & (1L << 8)) != 0L)
value28 = *from_ptr++;
 
-  if ((in_mask & (1L << 29)) != 0L)
+  if ((in_mask2 & (1L << 9)) != 0L)
value29 = *from_ptr++;
 
-  if ((in_mask & (1L << 30)) != 0L)
+  if ((in_mask2 & (1L << 10)) != 0L)
value30 = *from_ptr++;
 
-  if ((in_mask & (1L << 31)) != 0L)
+  if ((in_mask2 & (1L << 11)) != 0L)
value31 = *from_ptr++;
 
-  if ((in_mask & (1L << 32)) != 0L)
+  if ((in_mask2 & (1L << 12)) != 0L)
value32 = *from_ptr++;
 
-  if ((in_mask & (1L << 33)) != 0L)
+  if ((in_mask2 & (1L << 13)) != 0L)
value33 = *from_ptr++;
 
-  if ((in_mask & (1L << 34)) != 0L)
+  if ((in_mask2 & (1L << 14)) != 0L)
value34 = *from_ptr++;
 
-  if ((in_mask & (1L << 35)) != 0L)
+  if ((in_mask2 & (1L << 15)) != 0L)
value35 = *from_ptr++;
 
-  if ((in_mask & (1L << 36)) != 0L)
+  if ((in_mask2 & (1L << 16)) != 0L)
value36 = *from_ptr++;
 
-  if ((in_mask & (1L << 37)) != 0L)
+  if ((in_mask2 & (1L << 17)) != 0L)
value37 = *from_ptr++;
 
-  if ((in_mask & (1L << 38)) != 0L)
+  if ((in_mask2 & (1L << 18)) != 0L)
value38 = *from_ptr++;
 
-  if ((in_mask & (1L << 39)) != 0L)
+  if ((in_mask2 & (1L << 19)) != 0L)
value39 = *from_ptr++;
 
   out_mask = *out_mask_ptr++;
+  out_mask2 = *out_mask_ptr++;
   if ((out_mask & (1L <<  0)) != 0L)
*to_ptr++ = value00;
 
@@ -239,64 +241,64 @@ load_store_sf (unsigned long num,
   if ((out_mask & (1L << 19)) != 0L)
*to_ptr++ = value19;
 
-  if ((out_mask & (1L << 20)) != 0L)
+  if ((out_mask2 & (1L << 0)) != 0L)

Re: [PATCH, rs6000] Fix PR61397 (test case update for P8 vector loads/stores)

2016-02-26 Thread David Edelsohn
On Fri, Feb 26, 2016 at 9:18 AM, Bill Schmidt
 wrote:
> Hi,
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61397 was almost resolved a
> year ago, but had a proposed patch by Mike Meissner that was never
> vetted and committed.  I've reviewed the patch and tested it on GCC 5
> and GCC 6, and with the patch applied we see the test pass for both
> 32-bit and 64-bit on a Power8 big-endian platform, as well as for 64-bit
> on a Power8 little-endian platform.
>
> As I understand it, the test case got out of sync with the
> implementation in GCC 5, and this rewrite of the test case restores
> order.  I've verified that the original compilation options from Andreas
> Schwab for this test case result in correct generation of lxsdx, which
> was not the case with the original report.
>
> The test case is extremely different in GCC 4.9.  As Mike has noted in
> the PR, the -mupper-regs support does not exist in GCC 4.9, so the
> rewritten test case does not apply there.
>
> As stated, verified on powerpc64-unknown-linux-gnu (-m32, -m64) and
> powerpc64le-unknown-linux-gnu (-m64).  Is this ok for trunk and GCC 5?
>
> Thanks,
> Bill
>
>
> 2016-02-26  Michael Meissner 
> Bill Schmidt  
>
> * gcc.target/powerpc/p8vector-ldst.c: Adjust to test desired
> functionality for both 32-bit and 64-bit.

Okay.

Thanks, David