diff mbox

[testsuite/rs6000] Adjust two VMX tests for little endian

Message ID 1382987849.6275.184.camel@gnopaine
State New
Headers show

Commit Message

Bill Schmidt Oct. 28, 2013, 7:17 p.m. UTC
Hi,

These two test cases require source changes when compiled on a little
endian target.  Verified on powerpc64{,le}-unknown-linux-gnu.  Ok to
commit?

Thanks,
Bill


2013-10-28  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* gcc.dg/vmx/gcc-bug-i.c: Add little endian variant.
	* gcc.dg/vmx/eg-5.c: Likewise.

Comments

David Edelsohn Oct. 28, 2013, 8:51 p.m. UTC | #1
On Mon, Oct 28, 2013 at 3:17 PM, Bill Schmidt
<wschmidt@linux.vnet.ibm.com> wrote:
> Hi,
>
> These two test cases require source changes when compiled on a little
> endian target.  Verified on powerpc64{,le}-unknown-linux-gnu.  Ok to
> commit?
>
> Thanks,
> Bill
>
>
> 2013-10-28  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
>
>         * gcc.dg/vmx/gcc-bug-i.c: Add little endian variant.
>         * gcc.dg/vmx/eg-5.c: Likewise.

Okay.

Thanks, David
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c
===================================================================
--- gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c	(revision 203979)
+++ gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c	(working copy)
@@ -13,12 +13,27 @@ 
 #define DO_INLINE __attribute__ ((always_inline))
 #define DONT_INLINE __attribute__ ((noinline))
 
+#ifdef __LITTLE_ENDIAN__
+static inline DO_INLINE int inline_me(vector signed short data)
+{
+  union {vector signed short v; signed short s[8];} u;
+  signed short x;
+  unsigned char x1, x2;
+
+  u.v = data;
+  x = u.s[7];
+  x1 = (x >> 8) & 0xff;
+  x2 = x & 0xff;
+  return ((x2 << 8) | x1);
+}
+#else
 static inline DO_INLINE int inline_me(vector signed short data) 
 {
   union {vector signed short v; signed short s[8];} u;
   u.v = data;
   return u.s[7];
 }
+#endif
 
 static DONT_INLINE int foo(vector signed short data)
 {
Index: gcc/testsuite/gcc.dg/vmx/eg-5.c
===================================================================
--- gcc/testsuite/gcc.dg/vmx/eg-5.c	(revision 203979)
+++ gcc/testsuite/gcc.dg/vmx/eg-5.c	(working copy)
@@ -7,10 +7,17 @@  matvecmul4 (vector float c0, vector float c1, vect
   /* Set result to a vector of f32 0's */
   vector float result = ((vector float){0.,0.,0.,0.});
 
+#ifdef __LITTLE_ENDIAN__
+  result  = vec_madd (c0, vec_splat (v, 3), result);
+  result  = vec_madd (c1, vec_splat (v, 2), result);
+  result  = vec_madd (c2, vec_splat (v, 1), result);
+  result  = vec_madd (c3, vec_splat (v, 0), result);
+#else
   result  = vec_madd (c0, vec_splat (v, 0), result);
   result  = vec_madd (c1, vec_splat (v, 1), result);
   result  = vec_madd (c2, vec_splat (v, 2), result);
   result  = vec_madd (c3, vec_splat (v, 3), result);
+#endif
 
   return result;
 }