From: Avinash Jayakar <avinashd@[email protected]>

Hi,

Following patch fixes some BE failures on power10. Kindly review.

The updated tests pass both in powerpc64 and powerpc64le. Ok for trunk?

Thanks and regards,
Avinash Jayakar

The following tests:
 gcc.target/powerpc/vsx-load-element-extend-int.c
 gcc.target/powerpc/vsx-load-element-extend-longlong.c
 gcc.target/powerpc/vsx-load-element-extend-short.c
 gcc.target/powerpc/vsx-store-element-truncate-longlong.c

Failed on power10 BE target. One of the main reason being loading and
storing elements that cross the border of the types. This would give
different results in LE and BE systems, and hence the expected results
were wrong.

This patch corrects the inputs to these tests with proper types, so that
expected results in both systems are the same.

Few helper functions which printed the inputs and expected values with
VERBOSE flags were incorrect. This patch corrects this to print proper
values in both LE and BE system.

2026-09-04  Avinash Jayakar  <[email protected]>

gcc/testsuite/ChangeLog:
        PR testsuite/127189
        * gcc.target/powerpc/vsx-load-element-extend-int.c:
        * gcc.target/powerpc/vsx-load-element-extend-longlong.c:
        * gcc.target/powerpc/vsx-load-element-extend-short.c:
        * gcc.target/powerpc/vsx-store-element-truncate-longlong.c:
---
 .../powerpc/vsx-load-element-extend-int.c     | 116 +++++++++---------
 .../vsx-load-element-extend-longlong.c        | 106 +++++++---------
 .../powerpc/vsx-load-element-extend-short.c   | 116 +++++++++---------
 .../vsx-store-element-truncate-longlong.c     |  30 ++---
 4 files changed, 177 insertions(+), 191 deletions(-)

diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
index c40e1a3a0f7..4c2e45e019b 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-int.c
@@ -43,53 +43,53 @@ extended test.
 long long buffer[8];
 unsigned long verbose=0;
 
-char initbuffer[64] = {
-       0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
-                       0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x80,
-       0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
-                       0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x90,
-       0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
-                       0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xa0,
-       0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
-                       0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xb0
+int initbuffer[16] = {
+       0x11121314, 0x15161718,
+                       0x898a8b8c, 0x8d8e8f80,
+       0x21222324, 0x25262728,
+                       0x999a9b9c, 0x9d9e9f90,
+       0x31323334, 0x35363738,
+                       0xa9aaabac, 0xadaeafa0,
+       0x41424344, 0x45464748,
+                       0xb9babbbc, 0xbdbebfb0
 };
 
 vector signed __int128 signed_expected[16] = {
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000014131211},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000015141312},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000016151413},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000017161514},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000018171615},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff89181716},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8a891817},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8b8a8918},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8c8b8a89},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8d8c8b8a},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8e8d8c8b},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8f8e8d8c},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff808f8e8d},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000021808f8e},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x000000002221808f},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000023222180}
+        { (__int128) 0x0 << 64 | (__int128) 0x11121314},
+        { (__int128) 0x0 << 64 | (__int128) 0x15161718},
+        { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff898a8b8c},
+        { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff8d8e8f80},
+        { (__int128) 0x0 << 64 | (__int128) 0x21222324},
+        { (__int128) 0x0 << 64 | (__int128) 0x25262728},
+        { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff999a9b9c},
+        { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffff9d9e9f90},
+        { (__int128) 0x0 << 64 | (__int128) 0x31323334},
+        { (__int128) 0x0 << 64 | (__int128) 0x35363738},
+        { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffa9aaabac},
+        { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffadaeafa0},
+        { (__int128) 0x0 << 64 | (__int128) 0x41424344},
+        { (__int128) 0x0 << 64 | (__int128) 0x45464748},
+        { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffb9babbbc},
+        { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffbdbebfb0}
 };
 
 vector unsigned __int128 unsigned_expected[16] = {
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000014131211},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000015141312},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000016151413},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000017161514},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000018171615},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000089181716},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x000000008a891817},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x000000008b8a8918},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x000000008c8b8a89},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x000000008d8c8b8a},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x000000008e8d8c8b},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x000000008f8e8d8c},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000808f8e8d},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000021808f8e},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x000000002221808f},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000023222180}
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x11121314},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x15161718},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x898a8b8c},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x8d8e8f80},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x21222324},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x25262728},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x999a9b9c},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x9d9e9f90},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x31323334},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x35363738},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0xa9aaabac},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0xadaeafa0},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x41424344},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x45464748},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0xb9babbbc},
+        { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0xbdbebfb0}
 };
 
 __attribute__ ((noinline))
@@ -117,46 +117,46 @@ int main (int argc, char *argv [])
 
    if (verbose) {
           printf("input buffer:\n");
-          for (int k=0;k<64;k++) {
-                  printf("%x ",initbuffer[k]);
-                  if (k && (k+1)%16==0) printf("\n");
+          for (int k=0;k<16;k++) {
+                  printf("%8x ",initbuffer[k]);
+                  if (k && (k+1)%2==0) printf("\n");
           }
           printf("signed_expected:\n");
           for (int k=0;k<ITERS;k++) {
-               printf("%llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("%llx",(unsigned long long)(signed_expected[k][0] >> 
64));
+               printf(" %llx \n",(unsigned long long)(signed_expected[k][0]));
                   printf("\n");
           }
           printf("unsigned_expected:\n");
           for (int k=0;k<ITERS;k++) {
-               printf("%llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("%llx ",(unsigned long 
long)(unsigned_expected[k][0]>>64));
+               printf(" %llx \n",(unsigned long 
long)(unsigned_expected[k][0]));
                   printf("\n");
           }
    }
 
    for (iteration = 0; iteration < ITERS ; iteration++ ) {
-      signed_result_v = test_sign_extended_load (iteration, (signed 
int*)buffer);
+      signed_result_v = test_sign_extended_load (iteration*4, (signed 
int*)buffer);
       if (signed_result_v[0] != signed_expected[iteration][0] ) {
                mismatch++;
                printf("Unexpected results from signed load. i=%d \n", 
iteration);
-               printf("got:      %llx ",signed_result_v[0]>>64);
-               printf(" %llx \n",signed_result_v[0]&0xffffffffffffffff);
-               printf("expected: %llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("got:      %llx ",(unsigned long 
long)(signed_result_v[0] >> 64));
+               printf(" %llx \n",(unsigned long long)(signed_result_v[0]));
+               printf("expected: %llx ",(unsigned long 
long)(signed_expected[iteration][0] >> 64));
+               printf(" %llx \n",(unsigned long 
long)(signed_expected[iteration][0]));
                fflush(stdout);
       }
    }
 
    for (iteration = 0; iteration < ITERS ; iteration++ ) {
-      unsigned_result_v = test_zero_extended_unsigned_load (iteration, 
(unsigned int*)buffer);
+      unsigned_result_v = test_zero_extended_unsigned_load (iteration*4, 
(unsigned int*)buffer);
       if (unsigned_result_v[0] != unsigned_expected[iteration][0]) {
                mismatch++;
                printf("Unexpected results from unsigned load. i=%d \n", 
iteration);
-               printf("got:      %llx ",unsigned_result_v[0]>>64);
-               printf(" %llx \n",unsigned_result_v[0]&0xffffffffffffffff);
-               printf("expected: %llx ",unsigned_expected[iteration][0]>>64);
-               printf(" %llx 
\n",unsigned_expected[iteration][0]&0xffffffffffffffff);
+               printf("got:      %llx ",(unsigned long 
long)(unsigned_result_v[0]>>64));
+               printf(" %llx \n",(unsigned long long)(unsigned_result_v[0]));
+               printf("expected: %llx ",(unsigned long 
long)(unsigned_expected[iteration][0]>>64));
+               printf(" %llx \n",(unsigned long 
long)(unsigned_expected[iteration][0]));
                fflush(stdout);
       }
    }
diff --git 
a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
index 405b4245f8e..a414c5c7213 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-longlong.c
@@ -15,7 +15,7 @@
 /* { dg-final { scan-assembler-times {\mlvdx\M} 0 } } */
 
 #define NUM_VEC_ELEMS 2
-#define ITERS 16
+#define ITERS 8
 
 /*
 Codegen at time of writing uses lxvrdx for both sign and
@@ -44,53 +44,37 @@ mfvsr*d, mtvsrdd, vextsd2q.
 long long buffer[8];
 unsigned long verbose=0;
 
-char initbuffer[64] = {
-       0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
-                       0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x80,
-       0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
-                       0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x90,
-       0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
-                       0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xa0,
-       0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
-                       0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xb0
+long long initbuffer[8] = {
+       0x1112131415161718,
+       0x898a8b8c8d8e8f80,
+       0x2122232425262728,
+       0x999a9b9c9d9e9f90,
+       0x3132333435363738,
+       0xa9aaabacadaeafa0,
+       0x4142434445464748,
+       0xb9babbbcbdbebfb0
 };
 
-vector signed __int128 signed_expected[16] = {
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x1817161514131211},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8918171615141312},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8a89181716151413},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8b8a891817161514},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8c8b8a8918171615},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8d8c8b8a89181716},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8e8d8c8b8a891817},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x8f8e8d8c8b8a8918},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x808f8e8d8c8b8a89},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x21808f8e8d8c8b8a},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x2221808f8e8d8c8b},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x232221808f8e8d8c},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x24232221808f8e8d},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x2524232221808f8e},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x262524232221808f},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x2726252423222180}
+vector signed __int128 signed_expected[8] = {
+       { (__int128) 0x0 << 64 | (__int128) 0x1112131415161718},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x898a8b8c8d8e8f80},
+       { (__int128) 0x0 << 64 | (__int128) 0x2122232425262728},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0x999a9b9c9d9e9f90},
+       { (__int128) 0x0 << 64 | (__int128) 0x3132333435363738},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xa9aaabacadaeafa0},
+       { (__int128) 0x0 << 64 | (__int128) 0x4142434445464748},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xb9babbbcbdbebfb0}
 };
 
-vector unsigned __int128 unsigned_expected[16] = {
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x1817161514131211},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x8918171615141312},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x8a89181716151413},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x8b8a891817161514},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x8c8b8a8918171615},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x8d8c8b8a89181716},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x8e8d8c8b8a891817},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x8f8e8d8c8b8a8918},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x808f8e8d8c8b8a89},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x21808f8e8d8c8b8a},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x2221808f8e8d8c8b},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x232221808f8e8d8c},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x24232221808f8e8d},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x2524232221808f8e},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x262524232221808f},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x2726252423222180}
+vector unsigned __int128 unsigned_expected[8] = {
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 
0x1112131415161718},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 
0x898a8b8c8d8e8f80},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 
0x2122232425262728},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 
0x999a9b9c9d9e9f90},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 
0x3132333435363738},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 
0xa9aaabacadaeafa0},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 
0x4142434445464748},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 
0xb9babbbcbdbebfb0}
 };
 
 __attribute__ ((noinline))
@@ -118,46 +102,46 @@ int main (int argc, char *argv [])
 
    if (verbose) {
           printf("input buffer:\n");
-          for (int k=0;k<64;k++) {
-                  printf("%x ",initbuffer[k]);
-                  if (k && (k+1)%16==0) printf("\n");
+          for (int k=0;k<8;k++) {
+                  printf("%llx ",initbuffer[k]);
+                  printf("\n");
           }
           printf("signed_expected:\n");
           for (int k=0;k<ITERS;k++) {
-               printf("%llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("%llx",(unsigned long long)(signed_expected[k][0] >> 
64));
+               printf(" %llx \n",(unsigned long long)(signed_expected[k][0]));
                   printf("\n");
           }
           printf("unsigned_expected:\n");
           for (int k=0;k<ITERS;k++) {
-               printf("%llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("%llx ",(unsigned long 
long)(unsigned_expected[k][0]>>64));
+               printf(" %llx \n",(unsigned long 
long)(unsigned_expected[k][0]));
                   printf("\n");
           }
    }
 
    for (iteration = 0; iteration < ITERS ; iteration++ ) {
-      signed_result_v = test_sign_extended_load (iteration, (signed long 
long*)buffer);
+      signed_result_v = test_sign_extended_load (iteration*8, (signed long 
long*)buffer);
       if (signed_result_v[0] != signed_expected[iteration][0] ) {
                mismatch++;
                printf("Unexpected results from signed load. i=%d \n", 
iteration);
-               printf("got:      %llx ",signed_result_v[0]>>64);
-               printf(" %llx \n",signed_result_v[0]&0xffffffffffffffff);
-               printf("expected: %llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("got:      %llx ",(unsigned long 
long)(signed_result_v[0] >> 64));
+               printf(" %llx \n",(unsigned long long)(signed_result_v[0]));
+               printf("expected: %llx ",(unsigned long 
long)(signed_expected[iteration][0] >> 64));
+               printf(" %llx \n",(unsigned long 
long)(signed_expected[iteration][0]));
                fflush(stdout);
       }
    }
 
    for (iteration = 0; iteration < ITERS ; iteration++ ) {
-      unsigned_result_v = test_zero_extended_unsigned_load (iteration, 
(unsigned long long*)buffer);
+      unsigned_result_v = test_zero_extended_unsigned_load (iteration*8, 
(unsigned long long*)buffer);
       if (unsigned_result_v[0] != unsigned_expected[iteration][0]) {
                mismatch++;
                printf("Unexpected results from unsigned load. i=%d \n", 
iteration);
-               printf("got:      %llx ",unsigned_result_v[0]>>64);
-               printf(" %llx \n",unsigned_result_v[0]&0xffffffffffffffff);
-               printf("expected: %llx ",unsigned_expected[iteration][0]>>64);
-               printf(" %llx 
\n",unsigned_expected[iteration][0]&0xffffffffffffffff);
+               printf("got:      %llx ",(unsigned long 
long)(unsigned_result_v[0]>>64));
+               printf(" %llx \n",(unsigned long long)(unsigned_result_v[0]));
+               printf("expected: %llx ",(unsigned long 
long)(unsigned_expected[iteration][0]>>64));
+               printf(" %llx \n",(unsigned long 
long)(unsigned_expected[iteration][0]));
                fflush(stdout);
       }
    }
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c
index 837ba79c9ab..33fdb0035f6 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-load-element-extend-short.c
@@ -43,53 +43,53 @@ sign extended test.
 long long buffer[8];
 unsigned long verbose=0;
 
-char initbuffer[64] = {
-       0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
-                       0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x80,
-       0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
-                       0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x90,
-       0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
-                       0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xa0,
-       0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
-                       0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xb0
+unsigned short initbuffer[32] = {
+       0x1112, 0x1314, 0x1516, 0x1718,
+                       0x898a, 0x8b8c, 0x8d8e, 0x8f80,
+       0x2122, 0x2324, 0x2526, 0x2728,
+                       0x999a, 0x9b9c, 0x9d9e, 0x9f90,
+       0x3132, 0x3334, 0x3536, 0x3738,
+                       0xa9aa, 0xabac, 0xadae, 0xafa0,
+       0x4142, 0x4344, 0x4546, 0x4748,
+                       0xb9ba, 0xbbbc, 0xbdbe, 0xbfb0
 };
 
 vector signed __int128 signed_expected[16] = {
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001211},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001312},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001413},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001514},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001615},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001716},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000001817},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8918},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8a89},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8b8a},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8c8b},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8d8c},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8e8d},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8f8e},
-       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff808f},
-       { (__int128) 0x0000000000000000 << 64 | (__int128) 0x0000000000002180}
+       { (__int128) 0x0 << 64 | (__int128) 0x1112},
+       { (__int128) 0x0 << 64 | (__int128) 0x1314},
+       { (__int128) 0x0 << 64 | (__int128) 0x1516},
+       { (__int128) 0x0 << 64 | (__int128) 0x1718},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff898a},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8b8c},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8d8e},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff8f80},
+       { (__int128) 0x0 << 64 | (__int128) 0x2122},
+       { (__int128) 0x0 << 64 | (__int128) 0x2324},
+       { (__int128) 0x0 << 64 | (__int128) 0x2526},
+       { (__int128) 0x0 << 64 | (__int128) 0x2728},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff999a},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff9b9c},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff9d9e},
+       { (__int128) 0xffffffffffffffff << 64 | (__int128) 0xffffffffffff9f90}
 };
 
 vector unsigned __int128 unsigned_expected[16] = {
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000001211},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000001312},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000001413},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000001514},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000001615},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000001716},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000001817},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000008918},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000008a89},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000008b8a},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000008c8b},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000008d8c},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000008e8d},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000008f8e},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x0000000000000808f},
-       { (unsigned __int128) 0x0000000000000000  << 64 | (unsigned __int128) 
0x00000000000002180}
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x1112},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x1314},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x1516},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x1718},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x898a},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x8b8c},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x8d8e},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x8f80},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x2122},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x2324},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x2526},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x2728},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x999a},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x9b9c},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x9d9e},
+       { (unsigned __int128) 0x0 << 64 | (unsigned __int128) 0x9f90}
 };
 
 __attribute__ ((noinline))
@@ -117,46 +117,46 @@ int main (int argc, char *argv [])
 
    if (verbose) {
           printf("input buffer:\n");
-          for (int k=0;k<64;k++) {
-                  printf("%x ",initbuffer[k]);
-                  if (k && (k+1)%16==0) printf("\n");
+          for (int k=0;k<32;k++) {
+                  printf("%4x ",(unsigned short)initbuffer[k]);
+                  if (k && (k+1)%4==0) printf("\n");
           }
           printf("signed_expected:\n");
           for (int k=0;k<ITERS;k++) {
-               printf("%llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("%llx",(unsigned long long)(signed_expected[k][0] >> 
64));
+               printf(" %llx \n",(unsigned long long)(signed_expected[k][0]));
                   printf("\n");
           }
           printf("unsigned_expected:\n");
           for (int k=0;k<ITERS;k++) {
-               printf("%llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("%llx ",(unsigned long 
long)(unsigned_expected[k][0]>>64));
+               printf(" %llx \n",(unsigned long 
long)(unsigned_expected[k][0]));
                   printf("\n");
           }
    }
 
    for (iteration = 0; iteration < ITERS ; iteration++ ) {
-      signed_result_v = test_sign_extended_load (iteration, (signed 
short*)buffer);
+      signed_result_v = test_sign_extended_load (iteration*2, (signed 
short*)buffer);
       if (signed_result_v[0] != signed_expected[iteration][0] ) {
                mismatch++;
                printf("Unexpected results from signed load. i=%d \n", 
iteration);
-               printf("got:      %llx ",signed_result_v[0]>>64);
-               printf(" %llx \n",signed_result_v[0]&0xffffffffffffffff);
-               printf("expected: %llx ",signed_expected[iteration][0]>>64);
-               printf(" %llx 
\n",signed_expected[iteration][0]&0xffffffffffffffff);
+               printf("got:      %llx ",(unsigned long 
long)(signed_result_v[0] >> 64));
+               printf(" %llx \n",(unsigned long long)(signed_result_v[0]));
+               printf("expected: %llx ",(unsigned long 
long)(signed_expected[iteration][0] >> 64));
+               printf(" %llx \n",(unsigned long 
long)(signed_expected[iteration][0]));
                fflush(stdout);
       }
    }
 
    for (iteration = 0; iteration < ITERS ; iteration++ ) {
-      unsigned_result_v = test_zero_extended_unsigned_load (iteration, 
(unsigned short*)buffer);
+      unsigned_result_v = test_zero_extended_unsigned_load (iteration*2, 
(unsigned short*)buffer);
       if (unsigned_result_v[0] != unsigned_expected[iteration][0]) {
                mismatch++;
                printf("Unexpected results from unsigned load. i=%d \n", 
iteration);
-               printf("got:      %llx ",unsigned_result_v[0]>>64);
-               printf(" %llx \n",unsigned_result_v[0]&0xffffffffffffffff);
-               printf("expected: %llx ",unsigned_expected[iteration][0]>>64);
-               printf(" %llx 
\n",unsigned_expected[iteration][0]&0xffffffffffffffff);
+               printf("got:      %llx ",(unsigned long 
long)(unsigned_result_v[0]>>64));
+               printf(" %llx \n",(unsigned long long)(unsigned_result_v[0]));
+               printf("expected: %llx ",(unsigned long 
long)(unsigned_expected[iteration][0]>>64));
+               printf(" %llx \n",(unsigned long 
long)(unsigned_expected[iteration][0]));
                fflush(stdout);
       }
    }
diff --git 
a/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c 
b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c
index e1bd0216611..f9854d61f6d 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-store-element-truncate-longlong.c
@@ -37,17 +37,17 @@ vector unsigned __int128 store_this_us[4] = {
 
 #define NUM_VEC_ELEMS 2
 
-vector signed long long signed_expected[5] = {
-       { 0x123456789abcdef8,                0x0},
-       { 0x7654321700000000,         0xfedcba98},
-       { 0x0000000000000000, 0xcccccccccccccccc},
-       { 0x0000000000000000, 0xaaaaaaaa00000000}  /*note that some data 
written into the next word */
+vector signed long long signed_expected[8] = {
+       { 0x123456789abcdef8,                0x0}, {                0x0,        
        0x0},
+       {                0x0, 0xfedcba9876543217}, {                0x0,        
        0x0},
+       {                0x0,                0x0}, { 0xcccccccccccccccc,        
        0x0},
+       {                0x0,                0x0}, {                0x0, 
0xaaaaaaaaaaaaaaaa},
 };
-vector unsigned long long unsigned_expected[5] = {
-       { 0x123456789abcdef8,                0x0},
-       { 0x7654321700000000,         0xfedcba98},
-       { 0x0000000000000000, 0xeeeeeeeeeeeeeeee},
-       { 0x0000000000000000, 0x5555555500000000}
+vector unsigned long long unsigned_expected[8] = {
+       { 0x123456789abcdef8,                0x0}, {                0x0,        
        0x0},
+       {                0x0, 0xfedcba9876543217}, {                0x0,        
        0x0},
+       {                0x0,                0x0}, { 0xeeeeeeeeeeeeeeee,        
        0x0},
+       {                0x0,                0x0}, {                0x0, 
0x5555555555555555},
 };
 
 unsigned long long rawbuffer[32];
@@ -91,14 +91,15 @@ int main (int argc, char *argv [])
 
    for (i = 0; i < 4 ; i++ ) {
       reset_buffer();
-      test_signed_store (store_this_s[i], 4*i, vsbuffer);
-      memcmpresult = memcmp(rawbuffer,&signed_expected[i],sizeof(vector long 
long));
+      test_signed_store (store_this_s[i], 8*i, vsbuffer);
+      memcmpresult = memcmp(rawbuffer,&signed_expected[2*i],2*sizeof(vector 
long long));
       if (memcmpresult) {
         printf("mismatch signed buffer, i %d (memcmpresult:%d) 
\n",i,memcmpresult);
         mismatch++;
         if (verbose) {
            printf("results: ");
            PRINT_VEC(vsbuffer);
+           PRINT_VEC((vsbuffer + 2));
            printf("\n");
         }
       }
@@ -106,14 +107,15 @@ int main (int argc, char *argv [])
 
    for (i = 0; i < 4 ; i++ ) {
       reset_buffer();
-      test_unsigned_store (store_this_us[i], 4*i, vubuffer);
-      memcmpresult = memcmp(rawbuffer,&unsigned_expected[i],sizeof(vector long 
long));
+      test_unsigned_store (store_this_us[i], 8*i, vubuffer);
+      memcmpresult = memcmp(rawbuffer,&unsigned_expected[2*i],2*sizeof(vector 
long long));
       if (memcmpresult) {
         printf("mismatch unsigned buffer, i %d (memcmpresult:%d) 
\n",i,memcmpresult);
         mismatch++;
         if (verbose) {
            printf("results :");
            PRINT_VEC(vubuffer);
+           PRINT_VEC((vubuffer + 2));
            printf("\n");
         }
       }
-- 
2.54.0

Reply via email to