[rs6000] Fix for builtins-4-runnable.c testcase FAIL on power7/BE 32-bit

Message ID 1518193377.7508.2.camel@us.ibm.com
State New
Headers show
Series
  • [rs6000] Fix for builtins-4-runnable.c testcase FAIL on power7/BE 32-bit
Related show

Commit Message

Carl Love Feb. 9, 2018, 4:22 p.m.
GCC maintainers:

The following patch contains fixes for the builtins4-runnable.c test in
32-bit mode for the current GCC 8 branch.  This is issue #290 in Bill
Schmidt's issues.  The int128 and uint128 variable types are not
supported in 32-bit mode.  The tests were moved to a new test file and
restricted to run only when int128 type is supported.

The patch passes the regression testing on Power 8 BE enabled for 64-
bit and 32-bit modes.  Additionally, the patch passes regression
testing on Power 8 LE.

Let me know if the patch looks OK or not. 

                       Carl Love
 

gcc/testsuite/ChangeLog:

2018-02-09  Carl Love  <cel@us.ibm.com>

	* gcc.target/powerpc/builtins-4-runnable.c (main): Move	
int128 and
	uint128 tests to new testfile.
	* gcc.target/powerpc/builtins-4-int128-runnable.c: New testfile
for
	int128 and uint128 tests.
	* gcc.target/powerpc/powerpc.exp: Add builtins-4-int128-
runnable.c to
	list oftorture tests.
---
 .../powerpc/builtins-4-int128-runnable.c           | 108
+++++++++++++++++++++
 .../gcc.target/powerpc/builtins-4-runnable.c       |  84 -----------
-----
 gcc/testsuite/gcc.target/powerpc/powerpc.exp       |   1 +
 3 files changed, 109 insertions(+), 84 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/builtins-4-int128-
runnable.c

$DEFAULT_CFLAGS
-- 
2.7.4

Comments

Carl Love Feb. 9, 2018, 10:09 p.m. | #1
GCC maintainers:

As pointed out, the dg arguments in new test file was missing the
{target 128}.  I updated the arguments to be 

    { dg-do run { target { int128 && powerpc64*-*-* } } }

Without the powerpc64*-*-* the test was still tried to compiled the
test case in 32-bit mode on BE and failed.

I reran the tests manually to verify the tests run as expected.  On a
Power 8 BE machine with GCC configured for -m32 and -m64 I ran:
     
    make -k check-gcc RUNTESTFLAGS="--target_board=unix'{-m32,-m64}' 
    powerpc.exp=builtins-4-int128-runnable.c" > out

The pertinent output was:

    Test Run By carll on Fri Feb  9 16:42:34 2018                                                                                  
    Native configuration is powerpc64-unknown-linux-gnu     
         === gcc tests ===                                                                                                        
                                                                                                                                   
    Schedule of variations:                                                                                                        
        unix/-m32                                                                                                                  
        unix/-m64                                                                                                                  
                                                                                                                                   
    Running target unix/-m32                                                                                                       
    Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.                                             
    Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.                                                 
    Using /home/carll/GCC/gcc-builtin4/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.                
    Running /home/carll/GCC/gcc-builtin4/gcc/testsuite/gcc.target/powerpc/powerpc.exp ...                                          
                                                                                                                                   
          === gcc Summary for unix/-m32 ===                                                                                        
                                                                                                                                   
    # of unsupported tests     6                                                                                                   
    Running target unix/-m64                                                                                                       
    Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.                                             
    Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.                                                 
    Using /home/carll/GCC/gcc-builtin4/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.                
    Running /home/carll/GCC/gcc-builtin4/gcc/testsuite/gcc.target/powerpc/powerpc.exp ...                                          
                                                                                                                                   
          === gcc Summary for unix/-m64 ===                                                                                        
                                                                                                                                   
    # of expected passes    12                                                                                                     
                                                                                                                                   
          === gcc Summary ===                                                                                                      
                                                                                                                                   
    # of expected passes    12                                                                                                     
    # of unsupported tests     6 
    /home/carll/GCC/build/gcc-builtin4/gcc/xgcc  version 8.0.1 20180209 (experimental) (GCC) 

On a Power 8 LE machine I ran:
                   
make -k check-gcc RUNTESTFLAGS="powerpc.exp=builtins-4-int128-runnable.c" > out   

The pertinent output was:

    Test Run By carll on Fri Feb  9 15:56:29 2018                                                                                                 
    Native configuration is powerpc64le-unknown-linux-gnu                                                                                         
                                                                                                                                                  
                    === gcc tests ===                                                                                                             
                                                                                                                                                  
    Schedule of variations:                                                                                                                       
        unix                                                                                                                                      
                                                                                                                                                  
    Running target unix                                                                                                                           
    Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.                                                            
    Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.                                                                
    Using /home/carll/GCC/gcc-builtins4/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.                              
    Running /home/carll/GCC/gcc-builtins4/gcc/testsuite/gcc.target/powerpc/powerpc.exp ...                                                        
                                                                                                                                                  
                    === gcc Summary ===                                                                                                           
                                                                                                                                                  
    # of expected passes            12                                                                                                            
    /home/carll/GCC/build/gcc-builtins4/gcc/xgcc  version 8.0.1 20180206 (experimental) (GCC)  

    The modified test     file builtins-4-runnable.c was run similarly to verify it passed on both machines.

                   Carl Love


    ---------------------------------------------------------------------------------------

    gcc/testsuite/ChangeLog:

    2018-02-09  Carl Love  <    cel@us.ibm.com    >

    	    * gcc.target/powerpc/builtins-4-runnable.c (main): Move    	    int128 and
    	    uint128 tests to new testfile.
    	    * gcc.target/powerpc/builtins-4-int128-runnable.c: New testfile for
    	    int128 and uint128 tests.
    	    * gcc.target/powerpc/powerpc.exp: Add builtins-4-int128-runnable.c to
    	    list of torture tests.
    ---
     .../powerpc/builtins-4-int128-runnable.c           | 108 +++++++++++++++++++++
     .../gcc.target/powerpc/builtins-4-runnable.c       |  84 ----------------
     gcc/testsuite/gcc.target/powerpc/powerpc.exp       |   1 +
     3 files changed, 109 insertions(+), 84 deletions(-)
     create mode 100644 gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c

    diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c
    new file mode 100644
    index 0000000..bc71db9
    --- /dev/null
    +++ b/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c
    @@ -0,0 +1,108 @@
    +/* { dg-do run { target { int128 && powerpc64*-*-* } } } */
    +/* { dg-require-effective-target vsx_hw } */
    +/* { dg-options "-maltivec -mvsx" } */
    +
    +#include <inttypes.h>
    +#include <altivec.h> // vector
    +
    +#ifdef DEBUG
    +#include <stdio.h>
    +#endif
    +
    +void abort (void);
    +
    +int main() {
    +  int i;
    +  __uint128_t data_u128[100];
    +  __int128_t data_128[100];
    +
    +  vector __int128_t vec_128_expected1, vec_128_result1;
    +  vector __uint128_t vec_u128_expected1, vec_u128_result1;
    +  signed long long zero = (signed long long) 0;
    +
    +  for (i = 0; i < 100; i++)
    +    {
    +      data_128[i] = i + 12800000;
    +      data_u128[i] = i + 12800001;
    +    }
    +
    +  /* vec_xl() tests */
    +
    +  vec_128_expected1 = (vector __int128_t){12800000};
    +  vec_128_result1 = vec_xl (zero, data_128);
    +
    +  if (vec_128_expected1[0] != vec_128_result1[0])
    +    {
    +#ifdef DEBUG
    +    	    printf("Error: vec_xl(), vec_128_result1[0] = %lld %llu; ",
    +    	           vec_128_result1[0] >> 64,
    +    	           vec_128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
    +    	    printf("vec_128_expected1[0] = %lld %llu\n",
    +    	           vec_128_expected1[0] >> 64,
    +    	           vec_128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
    +#else
    +    	    abort ();
    +#endif
    +    }
    +
    +  vec_u128_result1 = vec_xl (zero, data_u128);
    +  vec_u128_expected1 = (vector __uint128_t){12800001};
    +  if (vec_u128_expected1[0] != vec_u128_result1[0])
    +    {
    +#ifdef DEBUG
    +    	    printf("Error: vec_xl(), vec_u128_result1[0] = %lld; ",
    +    	           vec_u128_result1[0] >> 64,
    +    	           vec_u128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
    +    	    printf("vec_u128_expected1[0] = %lld\n",
    +    	           vec_u128_expected1[0] >> 64,
    +    	           vec_u128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
    +#else
    +    	    abort ();
    +#endif
    +    }
    +
    +  /* vec_xl_be() tests */
    +
    +  vec_128_result1 = vec_xl_be (zero, data_128);
    +#ifdef __BIG_ENDIAN__
    +  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
    +#else
    +  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
    +#endif
    +
    +  if (vec_128_expected1[0] != vec_128_result1[0])
    +    {
    +#ifdef DEBUG
    +    	    printf("Error: vec_xl_be(), vec_128_result1[0] = %llu %llu;",
    +    	           vec_128_result1[0] >> 64,
    +    	           vec_128_result1[0] & 0xFFFFFFFFFFFFFFFF);
    +    	    printf(" vec_128_expected1[0] = %llu %llu\n",
    +    	           vec_128_expected1[0] >> 64,
    +    	           vec_128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
    +#else
    +      abort ();
    +#endif
    +    }
    +
    +#ifdef __BIG_ENDIAN__
    +  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
    +#else
    +  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
    +#endif
    +
    +  vec_u128_result1 = vec_xl_be (zero, data_u128);
    +
    +  if (vec_u128_expected1[0] != vec_u128_result1[0])
    +    {
    +#ifdef DEBUG
    +    	    printf("Error: vec_xl_be(), vec_u128_result1[0] = %llu %llu;",
    +    	           vec_u128_result1[0] >> 64,
    +    	           vec_u128_result1[0] & 0xFFFFFFFFFFFFFFFF);
    +    	    printf(" vec_u128_expected1[0] = %llu %llu\n",
    +    	           vec_u128_expected1[0] >> 64,
    +    	           vec_u128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
    +#else
    +      abort ();
    +#endif
    +    }
    +}
    diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
    index de9b916..35884b5 100644
    --- a/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
    +++ b/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
    @@ -27,9 +27,6 @@ int main() {
     
       float data_f[100];
       double data_d[100];
    -  __uint128_t data_u128[100];
    -  __int128_t data_128[100];
    -
       signed long long disp;
     
       vector signed char vec_c_expected1, vec_c_expected2, vec_c_result1, vec_c_result2;
    @@ -47,8 +44,6 @@ int main() {
         vec_sll_result1, vec_sll_result2;
       vector unsigned long long vec_ull_expected1, vec_ull_expected2,
         vec_ull_result1, vec_ull_result2;
    -  vector __int128_t vec_128_expected1, vec_128_result1;
    -  vector __uint128_t vec_u128_expected1, vec_u128_result1;
       vector float vec_f_expected1, vec_f_expected2, vec_f_result1, vec_f_result2;
       vector double vec_d_expected1, vec_d_expected2, vec_d_result1, vec_d_result2;
       char buf[20];
    @@ -66,8 +61,6 @@ int main() {
           data_ull[i] = i+1001;
           data_f[i] = i+100000.0;
           data_d[i] = i+1000000.0;
    -      data_128[i] = i + 12800000;
    -      data_u128[i] = i + 12800001;
         }
     
       // vec_xl() tests
    @@ -319,39 +312,6 @@ int main() {
     #endif
         }
     
    -  vec_128_expected1 = (vector __int128_t){12800000};
    -  vec_128_result1 = vec_xl (zero, data_128);
    -
    -  if (vec_128_expected1[0] != vec_128_result1[0])
    -    {
    -#ifdef DEBUG
    -    	    printf("Error: vec_xl(), vec_128_result1[0] = %lld %llu; ",
    -    	           vec_128_result1[0] >> 64,
    -    	           vec_128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
    -    	    printf("vec_128_expected1[0] = %lld %llu\n",
    -    	           vec_128_expected1[0] >> 64,
    -    	           vec_128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
    -#else
    -    	    abort ();
    -#endif
    -    }
    -
    -  vec_u128_result1 = vec_xl (zero, data_u128);
    -  vec_u128_expected1 = (vector __uint128_t){12800001};
    -  if (vec_u128_expected1[0] != vec_u128_result1[0])
    -    {
    -#ifdef DEBUG
    -    	    printf("Error: vec_xl(), vec_u128_result1[0] = %lld; ",
    -    	           vec_u128_result1[0] >> 64,
    -    	           vec_u128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
    -    	    printf("vec_u128_expected1[0] = %lld\n",
    -    	           vec_u128_expected1[0] >> 64,
    -    	           vec_u128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
    -#else
    -    	    abort ();
    -#endif
    -    }
    -
       // vec_xl_be() tests
       disp = 1;
     #ifdef __BIG_ENDIAN__
    @@ -710,48 +670,4 @@ int main() {
         	    abort ();
     #endif
         }
    -
    -  disp = 0;
    -  vec_128_result1 = vec_xl_be (zero, data_128);
    -#ifdef __BIG_ENDIAN__
    -  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
    -#else
    -  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
    -#endif
    -
    -  if (vec_128_expected1[0] != vec_128_result1[0])
    -    {
    -#ifdef DEBUG
    -    	    printf("Error: vec_xl_be(), vec_128_result1[0] = %llu %llu;",
    -    	           vec_128_result1[0] >> 64,
    -    	           vec_128_result1[0] & 0xFFFFFFFFFFFFFFFF);
    -    	    printf(" vec_128_expected1[0] = %llu %llu\n",
    -    	           vec_128_expected1[0] >> 64,
    -    	           vec_128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
    -#else
    -      abort ();
    -#endif
    -    }
    -
    -#ifdef __BIG_ENDIAN__
    -  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
    -#else
    -  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
    -#endif
    -
    -  vec_u128_result1 = vec_xl_be (zero, data_u128);
    -
    -  if (vec_u128_expected1[0] != vec_u128_result1[0])
    -    {
    -#ifdef DEBUG
    -    	    printf("Error: vec_xl_be(), vec_u128_result1[0] = %llu %llu;",
    -    	           vec_u128_result1[0] >> 64,
    -    	           vec_u128_result1[0] & 0xFFFFFFFFFFFFFFFF);
    -    	    printf(" vec_u128_expected1[0] = %llu %llu\n",
    -    	           vec_u128_expected1[0] >> 64,
    -    	           vec_u128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
    -#else
    -      abort ();
    -#endif
    -    }
     }
    diff --git a/gcc/testsuite/gcc.target/powerpc/powerpc.exp b/gcc/testsuite/gcc.target/powerpc/powerpc.exp
    index 148acb1..fdb3e93 100644
    --- a/gcc/testsuite/gcc.target/powerpc/powerpc.exp
    +++ b/gcc/testsuite/gcc.target/powerpc/powerpc.exp
    @@ -54,6 +54,7 @@ torture-init
     # Test load/store builtins at multiple optimizations
     set-torture-options [list -O0 -Os -O1 -O2 -O3]
     gcc-dg-runtest [list $srcdir/$subdir/builtins-4-runnable.c \
    +    	    	    $srcdir/$subdir/builtins-4-int128-runnable.c \
         	    	    $srcdir/$subdir/builtins-6-runnable.c \
         	    	    $srcdir/$subdir/builtins-5-p9-runnable.c \
         	               	    $srcdir/$subdir/builtins-6-p9-runnable.c] "" $DEFAULT_CFLAGS
    -- 
    2.7.4
Segher Boessenkool Feb. 9, 2018, 11:13 p.m. | #2
Hi Carl,

On Fri, Feb 09, 2018 at 08:22:57AM -0800, Carl Love wrote:
> The following patch contains fixes for the builtins4-runnable.c test in
> 32-bit mode for the current GCC 8 branch.  This is issue #290 in Bill
> Schmidt's issues.  The int128 and uint128 variable types are not
> supported in 32-bit mode.  The tests were moved to a new test file and
> restricted to run only when int128 type is supported.

> 2018-02-09  Carl Love  <cel@us.ibm.com>
> 
> 	* gcc.target/powerpc/builtins-4-runnable.c (main): Move	
> int128 and
> 	uint128 tests to new testfile.
> 	* gcc.target/powerpc/builtins-4-int128-runnable.c: New testfile
> for
> 	int128 and uint128 tests.
> 	* gcc.target/powerpc/powerpc.exp: Add builtins-4-int128-
> runnable.c to
> 	list oftorture tests.

Missing space (and the layout is messed up a bit, that's your mailer
I guess -- the patch is wrapped as well, that's not good).

Okay for trunk.  Thanks!


Segher
Segher Boessenkool Feb. 12, 2018, 3:17 p.m. | #3
Hi Carl,

On Fri, Feb 09, 2018 at 02:09:06PM -0800, Carl Love wrote:
> As pointed out, the dg arguments in new test file was missing the
> {target 128}.  I updated the arguments to be 
> 
>     { dg-do run { target { int128 && powerpc64*-*-* } } }
> 
> Without the powerpc64*-*-* the test was still tried to compiled the
> test case in 32-bit mode on BE and failed.

If the dg-do target clause fails, you still get the default dg-do value,
which is "compile" for most testcases.

You want to use  dg-require-effective-target int128  if the testcase
cannot compile without int128.  Could you try that?

Btw, your patch is completely whitespace-damaged which makes it very hard
to read (and impossible to apply).  Please fix your setup :-)


Segher
Carl Love Feb. 12, 2018, 4:20 p.m. | #4
On Mon, 2018-02-12 at 09:17 -0600, Segher Boessenkool wrote:
> Hi Carl,
> 
> On Fri, Feb 09, 2018 at 02:09:06PM -0800, Carl Love wrote:
> > As pointed out, the dg arguments in new test file was missing the
> > {target 128}.  I updated the arguments to be 
> > 
> >     { dg-do run { target { int128 && powerpc64*-*-* } } }
> > 
> > Without the powerpc64*-*-* the test was still tried to compiled the
> > test case in 32-bit mode on BE and failed.
> 
> If the dg-do target clause fails, you still get the default dg-do
> value,
> which is "compile" for most testcases.
> 
> You want to use  dg-require-effective-target int128  if the testcase
> cannot compile without int128.  Could you try that?
> 
> Btw, your patch is completely whitespace-damaged which makes it very
> hard
> to read (and impossible to apply).  Please fix your setup :-)
> 
> 
> Segher
> 

Segher:

No problem, I hadn't committed the patch yet.  Nothing seemed to be
going right for me last Friday so I figured it best to wait for a
better day to do the commit.

I updated the patch as requested.  The dg commands are now:

/* { dg-do run } */
/* { dg-require-effective-target int128 } */
/* { dg-require-effective-target vsx_hw } */
/* { dg-options "-maltivec -mvsx" } */

#include <inttypes.h>

When run with the command:

    make -k check-gcc RUNTESTFLAGS="--target_board=unix'{-m32,-m64}' powerpc.exp=builtins-4-int128-runnable.c"

The results are the same:

    # of unsupported tests    	    	    6
    Running target unix/-m64
    Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
    Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
    Using /home/carll/GCC/gcc-builtin4/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
    Running /home/carll/GCC/gcc-builtin4/gcc/testsuite/gcc.target/powerpc/powerpc.exp ...

    	    	    === gcc Summary for unix/-m64 ===

    # of expected passes    	    	    12

    	    	    === gcc Summary ===

    # of expected passes    	    	    12
    # of unsupported tests    	    	    6
    /home/carll/GCC/build/gcc-builtin4/gcc/xgcc  version 8.0.1 20180209 (experimental) (GCC) 

It does sound like this is more reliable in terms of the test harness.

Below is the patch.  Sorry, I forgot to set the patch to "preformatted"
last time, as I said, I wasn't having a good day Friday.  :-)

Let me know if it all looks good this time.  Thanks.

                     Carl 

-------------------------------------------------------------------------------------

gcc/testsuite/ChangeLog:

2018-02-12  Carl Love  <cel@us.ibm.com>

	* gcc.target/powerpc/builtins-4-runnable.c (main): Move	int128 and
	uint128 tests to new testfile.
	* gcc.target/powerpc/builtins-4-int128-runnable.c: New testfile for
	int128 and uint128 tests.
	* gcc.target/powerpc/powerpc.exp: Add builtins-4-int128-runnable.c to
	list of torture tests.
---
 .../powerpc/builtins-4-int128-runnable.c           | 109 +++++++++++++++++++++
 .../gcc.target/powerpc/builtins-4-runnable.c       |  84 ----------------
 gcc/testsuite/gcc.target/powerpc/powerpc.exp       |   1 +
 3 files changed, 110 insertions(+), 84 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c

diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c
new file mode 100644
index 0000000..162e267
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c
@@ -0,0 +1,109 @@
+/* { dg-do run } */
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-maltivec -mvsx" } */
+
+#include <inttypes.h>
+#include <altivec.h> // vector
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+void abort (void);
+
+int main() {
+  int i;
+  __uint128_t data_u128[100];
+  __int128_t data_128[100];
+
+  vector __int128_t vec_128_expected1, vec_128_result1;
+  vector __uint128_t vec_u128_expected1, vec_u128_result1;
+  signed long long zero = (signed long long) 0;
+
+  for (i = 0; i < 100; i++)
+    {
+      data_128[i] = i + 12800000;
+      data_u128[i] = i + 12800001;
+    }
+
+  /* vec_xl() tests */
+
+  vec_128_expected1 = (vector __int128_t){12800000};
+  vec_128_result1 = vec_xl (zero, data_128);
+
+  if (vec_128_expected1[0] != vec_128_result1[0])
+    {
+#ifdef DEBUG
+	printf("Error: vec_xl(), vec_128_result1[0] = %lld %llu; ",
+	       vec_128_result1[0] >> 64,
+	       vec_128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+	printf("vec_128_expected1[0] = %lld %llu\n",
+	       vec_128_expected1[0] >> 64,
+	       vec_128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+#else
+	abort ();
+#endif
+    }
+
+  vec_u128_result1 = vec_xl (zero, data_u128);
+  vec_u128_expected1 = (vector __uint128_t){12800001};
+  if (vec_u128_expected1[0] != vec_u128_result1[0])
+    {
+#ifdef DEBUG
+	printf("Error: vec_xl(), vec_u128_result1[0] = %lld; ",
+	       vec_u128_result1[0] >> 64,
+	       vec_u128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+	printf("vec_u128_expected1[0] = %lld\n",
+	       vec_u128_expected1[0] >> 64,
+	       vec_u128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+#else
+	abort ();
+#endif
+    }
+
+  /* vec_xl_be() tests */
+
+  vec_128_result1 = vec_xl_be (zero, data_128);
+#ifdef __BIG_ENDIAN__
+  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
+#else
+  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
+#endif
+
+  if (vec_128_expected1[0] != vec_128_result1[0])
+    {
+#ifdef DEBUG
+	printf("Error: vec_xl_be(), vec_128_result1[0] = %llu %llu;",
+	       vec_128_result1[0] >> 64,
+	       vec_128_result1[0] & 0xFFFFFFFFFFFFFFFF);
+	printf(" vec_128_expected1[0] = %llu %llu\n",
+	       vec_128_expected1[0] >> 64,
+	       vec_128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
+#else
+      abort ();
+#endif
+    }
+
+#ifdef __BIG_ENDIAN__
+  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
+#else
+  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
+#endif
+
+  vec_u128_result1 = vec_xl_be (zero, data_u128);
+
+  if (vec_u128_expected1[0] != vec_u128_result1[0])
+    {
+#ifdef DEBUG
+	printf("Error: vec_xl_be(), vec_u128_result1[0] = %llu %llu;",
+	       vec_u128_result1[0] >> 64,
+	       vec_u128_result1[0] & 0xFFFFFFFFFFFFFFFF);
+	printf(" vec_u128_expected1[0] = %llu %llu\n",
+	       vec_u128_expected1[0] >> 64,
+	       vec_u128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
+#else
+      abort ();
+#endif
+    }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
index de9b916..35884b5 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
@@ -27,9 +27,6 @@ int main() {
 
   float data_f[100];
   double data_d[100];
-  __uint128_t data_u128[100];
-  __int128_t data_128[100];
-
   signed long long disp;
 
   vector signed char vec_c_expected1, vec_c_expected2, vec_c_result1, vec_c_result2;
@@ -47,8 +44,6 @@ int main() {
     vec_sll_result1, vec_sll_result2;
   vector unsigned long long vec_ull_expected1, vec_ull_expected2,
     vec_ull_result1, vec_ull_result2;
-  vector __int128_t vec_128_expected1, vec_128_result1;
-  vector __uint128_t vec_u128_expected1, vec_u128_result1;
   vector float vec_f_expected1, vec_f_expected2, vec_f_result1, vec_f_result2;
   vector double vec_d_expected1, vec_d_expected2, vec_d_result1, vec_d_result2;
   char buf[20];
@@ -66,8 +61,6 @@ int main() {
       data_ull[i] = i+1001;
       data_f[i] = i+100000.0;
       data_d[i] = i+1000000.0;
-      data_128[i] = i + 12800000;
-      data_u128[i] = i + 12800001;
     }
 
   // vec_xl() tests
@@ -319,39 +312,6 @@ int main() {
 #endif
     }
 
-  vec_128_expected1 = (vector __int128_t){12800000};
-  vec_128_result1 = vec_xl (zero, data_128);
-
-  if (vec_128_expected1[0] != vec_128_result1[0])
-    {
-#ifdef DEBUG
-	printf("Error: vec_xl(), vec_128_result1[0] = %lld %llu; ",
-	       vec_128_result1[0] >> 64,
-	       vec_128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
-	printf("vec_128_expected1[0] = %lld %llu\n",
-	       vec_128_expected1[0] >> 64,
-	       vec_128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
-#else
-	abort ();
-#endif
-    }
-
-  vec_u128_result1 = vec_xl (zero, data_u128);
-  vec_u128_expected1 = (vector __uint128_t){12800001};
-  if (vec_u128_expected1[0] != vec_u128_result1[0])
-    {
-#ifdef DEBUG
-	printf("Error: vec_xl(), vec_u128_result1[0] = %lld; ",
-	       vec_u128_result1[0] >> 64,
-	       vec_u128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
-	printf("vec_u128_expected1[0] = %lld\n",
-	       vec_u128_expected1[0] >> 64,
-	       vec_u128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
-#else
-	abort ();
-#endif
-    }
-
   // vec_xl_be() tests
   disp = 1;
 #ifdef __BIG_ENDIAN__
@@ -710,48 +670,4 @@ int main() {
 	abort ();
 #endif
     }
-
-  disp = 0;
-  vec_128_result1 = vec_xl_be (zero, data_128);
-#ifdef __BIG_ENDIAN__
-  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
-#else
-  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
-#endif
-
-  if (vec_128_expected1[0] != vec_128_result1[0])
-    {
-#ifdef DEBUG
-	printf("Error: vec_xl_be(), vec_128_result1[0] = %llu %llu;",
-	       vec_128_result1[0] >> 64,
-	       vec_128_result1[0] & 0xFFFFFFFFFFFFFFFF);
-	printf(" vec_128_expected1[0] = %llu %llu\n",
-	       vec_128_expected1[0] >> 64,
-	       vec_128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
-#else
-      abort ();
-#endif
-    }
-
-#ifdef __BIG_ENDIAN__
-  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
-#else
-  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
-#endif
-
-  vec_u128_result1 = vec_xl_be (zero, data_u128);
-
-  if (vec_u128_expected1[0] != vec_u128_result1[0])
-    {
-#ifdef DEBUG
-	printf("Error: vec_xl_be(), vec_u128_result1[0] = %llu %llu;",
-	       vec_u128_result1[0] >> 64,
-	       vec_u128_result1[0] & 0xFFFFFFFFFFFFFFFF);
-	printf(" vec_u128_expected1[0] = %llu %llu\n",
-	       vec_u128_expected1[0] >> 64,
-	       vec_u128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
-#else
-      abort ();
-#endif
-    }
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/powerpc.exp b/gcc/testsuite/gcc.target/powerpc/powerpc.exp
index 148acb1..fdb3e93 100644
--- a/gcc/testsuite/gcc.target/powerpc/powerpc.exp
+++ b/gcc/testsuite/gcc.target/powerpc/powerpc.exp
@@ -54,6 +54,7 @@ torture-init
 # Test load/store builtins at multiple optimizations
 set-torture-options [list -O0 -Os -O1 -O2 -O3]
 gcc-dg-runtest [list $srcdir/$subdir/builtins-4-runnable.c \
+		$srcdir/$subdir/builtins-4-int128-runnable.c \
 		$srcdir/$subdir/builtins-6-runnable.c \
 		$srcdir/$subdir/builtins-5-p9-runnable.c \
 	       	$srcdir/$subdir/builtins-6-p9-runnable.c] "" $DEFAULT_CFLAGS
Segher Boessenkool Feb. 12, 2018, 4:51 p.m. | #5
Hi Carl,

On Mon, Feb 12, 2018 at 08:20:16AM -0800, Carl Love wrote:
> On Mon, 2018-02-12 at 09:17 -0600, Segher Boessenkool wrote:
> > > Without the powerpc64*-*-* the test was still tried to compiled the
> > > test case in 32-bit mode on BE and failed.
> > 
> > If the dg-do target clause fails, you still get the default dg-do
> > value,
> > which is "compile" for most testcases.
> > 
> > You want to use  dg-require-effective-target int128  if the testcase
> > cannot compile without int128.  Could you try that?
> > 
> > Btw, your patch is completely whitespace-damaged which makes it very
> > hard
> > to read (and impossible to apply).  Please fix your setup :-)

[ That is fixed now, thanks! ]

> No problem, I hadn't committed the patch yet.  Nothing seemed to be
> going right for me last Friday so I figured it best to wait for a
> better day to do the commit.
> 
> I updated the patch as requested.  The dg commands are now:
> 
> /* { dg-do run } */
> /* { dg-require-effective-target int128 } */
> /* { dg-require-effective-target vsx_hw } */
> /* { dg-options "-maltivec -mvsx" } */

Thanks, that looks good.

> 2018-02-12  Carl Love  <cel@us.ibm.com>
> 
> 	* gcc.target/powerpc/builtins-4-runnable.c (main): Move	int128 and

You have a tab in the middle of the line there (after "Move").

> 	uint128 tests to new testfile.
> 	* gcc.target/powerpc/builtins-4-int128-runnable.c: New testfile for
> 	int128 and uint128 tests.
> 	* gcc.target/powerpc/powerpc.exp: Add builtins-4-int128-runnable.c to
> 	list of torture tests.

Okay for trunk.  Thanks!


Segher

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-
runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-
runnable.c
new file mode 100644
index 0000000..a6973f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c
@@ -0,0 +1,108 @@ 
+/* { dg-do run } */
+/* { dg-require-effective-target vsx_hw } */
+/* { dg-options "-maltivec -mvsx" } */
+
+#include <inttypes.h>
+#include <altivec.h> // vector
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+void abort (void);
+
+int main() {
+  int i;
+  __uint128_t data_u128[100];
+  __int128_t data_128[100];
+
+  vector __int128_t vec_128_expected1, vec_128_result1;
+  vector __uint128_t vec_u128_expected1, vec_u128_result1;
+  signed long long zero = (signed long long) 0;
+
+  for (i = 0; i < 100; i++)
+    {
+      data_128[i] = i + 12800000;
+      data_u128[i] = i + 12800001;
+    }
+
+  /* vec_xl() tests */
+
+  vec_128_expected1 = (vector __int128_t){12800000};
+  vec_128_result1 = vec_xl (zero, data_128);
+
+  if (vec_128_expected1[0] != vec_128_result1[0])
+    {
+#ifdef DEBUG
+	printf("Error: vec_xl(), vec_128_result1[0] = %lld %llu; ",
+	       vec_128_result1[0] >> 64,
+	       vec_128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+	printf("vec_128_expected1[0] = %lld %llu\n",
+	       vec_128_expected1[0] >> 64,
+	       vec_128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+#else
+	abort ();
+#endif
+    }
+
+  vec_u128_result1 = vec_xl (zero, data_u128);
+  vec_u128_expected1 = (vector __uint128_t){12800001};
+  if (vec_u128_expected1[0] != vec_u128_result1[0])
+    {
+#ifdef DEBUG
+	printf("Error: vec_xl(), vec_u128_result1[0] = %lld; ",
+	       vec_u128_result1[0] >> 64,
+	       vec_u128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
+	printf("vec_u128_expected1[0] = %lld\n",
+	       vec_u128_expected1[0] >> 64,
+	       vec_u128_expected1[0] &
(__int128_t)0xFFFFFFFFFFFFFFFF);
+#else
+	abort ();
+#endif
+    }
+
+  /* vec_xl_be() tests */
+
+  vec_128_result1 = vec_xl_be (zero, data_128);
+#ifdef __BIG_ENDIAN__
+  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
+#else
+  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
+#endif
+
+  if (vec_128_expected1[0] != vec_128_result1[0])
+    {
+#ifdef DEBUG
+	printf("Error: vec_xl_be(), vec_128_result1[0] = %llu %llu;",
+	       vec_128_result1[0] >> 64,
+	       vec_128_result1[0] & 0xFFFFFFFFFFFFFFFF);
+	printf(" vec_128_expected1[0] = %llu %llu\n",
+	       vec_128_expected1[0] >> 64,
+	       vec_128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
+#else
+      abort ();
+#endif
+    }
+
+#ifdef __BIG_ENDIAN__
+  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
+#else
+  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
+#endif
+
+  vec_u128_result1 = vec_xl_be (zero, data_u128);
+
+  if (vec_u128_expected1[0] != vec_u128_result1[0])
+    {
+#ifdef DEBUG
+	printf("Error: vec_xl_be(), vec_u128_result1[0] = %llu %llu;",
+	       vec_u128_result1[0] >> 64,
+	       vec_u128_result1[0] & 0xFFFFFFFFFFFFFFFF);
+	printf(" vec_u128_expected1[0] = %llu %llu\n",
+	       vec_u128_expected1[0] >> 64,
+	       vec_u128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
+#else
+      abort ();
+#endif
+    }
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
b/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
index de9b916..35884b5 100644
--- a/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
@@ -27,9 +27,6 @@  int main() {
 
   float data_f[100];
   double data_d[100];
-  __uint128_t data_u128[100];
-  __int128_t data_128[100];
-
   signed long long disp;
 
   vector signed char vec_c_expected1, vec_c_expected2, vec_c_result1,
vec_c_result2;
@@ -47,8 +44,6 @@  int main() {
     vec_sll_result1, vec_sll_result2;
   vector unsigned long long vec_ull_expected1, vec_ull_expected2,
     vec_ull_result1, vec_ull_result2;
-  vector __int128_t vec_128_expected1, vec_128_result1;
-  vector __uint128_t vec_u128_expected1, vec_u128_result1;
   vector float vec_f_expected1, vec_f_expected2, vec_f_result1,
vec_f_result2;
   vector double vec_d_expected1, vec_d_expected2, vec_d_result1,
vec_d_result2;
   char buf[20];
@@ -66,8 +61,6 @@  int main() {
       data_ull[i] = i+1001;
       data_f[i] = i+100000.0;
       data_d[i] = i+1000000.0;
-      data_128[i] = i + 12800000;
-      data_u128[i] = i + 12800001;
     }
 
   // vec_xl() tests
@@ -319,39 +312,6 @@  int main() {
 #endif
     }
 
-  vec_128_expected1 = (vector __int128_t){12800000};
-  vec_128_result1 = vec_xl (zero, data_128);
-
-  if (vec_128_expected1[0] != vec_128_result1[0])
-    {
-#ifdef DEBUG
-	printf("Error: vec_xl(), vec_128_result1[0] = %lld %llu; ",
-	       vec_128_result1[0] >> 64,
-	       vec_128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
-	printf("vec_128_expected1[0] = %lld %llu\n",
-	       vec_128_expected1[0] >> 64,
-	       vec_128_expected1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
-#else
-	abort ();
-#endif
-    }
-
-  vec_u128_result1 = vec_xl (zero, data_u128);
-  vec_u128_expected1 = (vector __uint128_t){12800001};
-  if (vec_u128_expected1[0] != vec_u128_result1[0])
-    {
-#ifdef DEBUG
-	printf("Error: vec_xl(), vec_u128_result1[0] = %lld; ",
-	       vec_u128_result1[0] >> 64,
-	       vec_u128_result1[0] & (__int128_t)0xFFFFFFFFFFFFFFFF);
-	printf("vec_u128_expected1[0] = %lld\n",
-	       vec_u128_expected1[0] >> 64,
-	       vec_u128_expected1[0] &
(__int128_t)0xFFFFFFFFFFFFFFFF);
-#else
-	abort ();
-#endif
-    }
-
   // vec_xl_be() tests
   disp = 1;
 #ifdef __BIG_ENDIAN__
@@ -710,48 +670,4 @@  int main() {
 	abort ();
 #endif
     }
-
-  disp = 0;
-  vec_128_result1 = vec_xl_be (zero, data_128);
-#ifdef __BIG_ENDIAN__
-  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
-#else
-  vec_128_expected1 = (vector __int128_t){ (__int128_t)12800000 };
-#endif
-
-  if (vec_128_expected1[0] != vec_128_result1[0])
-    {
-#ifdef DEBUG
-	printf("Error: vec_xl_be(), vec_128_result1[0] = %llu %llu;",
-	       vec_128_result1[0] >> 64,
-	       vec_128_result1[0] & 0xFFFFFFFFFFFFFFFF);
-	printf(" vec_128_expected1[0] = %llu %llu\n",
-	       vec_128_expected1[0] >> 64,
-	       vec_128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
-#else
-      abort ();
-#endif
-    }
-
-#ifdef __BIG_ENDIAN__
-  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
-#else
-  vec_u128_expected1 = (vector __uint128_t){ (__uint128_t)12800001 };
-#endif
-
-  vec_u128_result1 = vec_xl_be (zero, data_u128);
-
-  if (vec_u128_expected1[0] != vec_u128_result1[0])
-    {
-#ifdef DEBUG
-	printf("Error: vec_xl_be(), vec_u128_result1[0] = %llu %llu;",
-	       vec_u128_result1[0] >> 64,
-	       vec_u128_result1[0] & 0xFFFFFFFFFFFFFFFF);
-	printf(" vec_u128_expected1[0] = %llu %llu\n",
-	       vec_u128_expected1[0] >> 64,
-	       vec_u128_expected1[0] & 0xFFFFFFFFFFFFFFFF);
-#else
-      abort ();
-#endif
-    }
 }
diff --git a/gcc/testsuite/gcc.target/powerpc/powerpc.exp
b/gcc/testsuite/gcc.target/powerpc/powerpc.exp
index 148acb1..fdb3e93 100644
--- a/gcc/testsuite/gcc.target/powerpc/powerpc.exp
+++ b/gcc/testsuite/gcc.target/powerpc/powerpc.exp
@@ -54,6 +54,7 @@  torture-init
 # Test load/store builtins at multiple optimizations
 set-torture-options [list -O0 -Os -O1 -O2 -O3]
 gcc-dg-runtest [list $srcdir/$subdir/builtins-4-runnable.c \
+		$srcdir/$subdir/builtins-4-int128-runnable.c \
 		$srcdir/$subdir/builtins-6-runnable.c \
 		$srcdir/$subdir/builtins-5-p9-runnable.c \
 	       	$srcdir/$subdir/builtins-6-p9-runnable.c] ""