builtins-4-runnable.c (main): Move int128 and uint128 tests to new testfile.
authorCarl Love <cel@us.ibm.com>
Mon, 12 Feb 2018 17:21:28 +0000 (17:21 +0000)
committerCarl Love <carll@gcc.gnu.org>
Mon, 12 Feb 2018 17:21:28 +0000 (17:21 +0000)
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.

From-SVN: r257591

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/builtins-4-int128-runnable.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/builtins-4-runnable.c
gcc/testsuite/gcc.target/powerpc/powerpc.exp

index c4ae3e34ab6ae0ae7a6fb8c058c9c6302f7b3eb5..dba0bedb7cf2f8536e8429ea7eb7e63b6574329b 100644 (file)
@@ -1,3 +1,12 @@
+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.
+
 2018-02-12  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/84273
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 (file)
index 0000000..162e267
--- /dev/null
@@ -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
+    }
+}
index de9b916de1703b584e00f331be1549c5d299d0bc..35884b5b84856cc0d96f09dded4496dbf5e74916 100644 (file)
@@ -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__
@@ -708,50 +668,6 @@ int main() {
               i,  vec_d_result2[i], i, vec_d_expected2[i]);
 #else
        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
     }
 }
index 148acb1a1888263e0fffb0574eec8886a32db346..fdb3e931d713d7249178887ee06fcac3b28e1159 100644 (file)
@@ -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