diff mbox

RFA: Fix test pr32912-2.c for 16-bit targets

Message ID 87d2kufp2w.fsf@redhat.com
State New
Headers show

Commit Message

Nick Clifton Dec. 18, 2013, 10:09 a.m. UTC
Hi Guys,

  The test gcc/testsuite/gcc.dg/pr32912-2.c fails to execute correctly
  on targets that use 16-bit integers, because it assumes at least a
  32-bit integer.  The patch below removes this assumption, and it also
  tidies up the code slightly so that __SIZEOF_INT__ is only tested in
  one place, not three.

  There were no regressions when tested with a i686-pc-linux-gnu or a
  x86_64-pc-linux-gnu toolchain, and the test was fixed for a rl78-elf
  toolchain.

  OK to apply ?

Cheers
  Nick

gcc/testsuite/ChangeLog
2013-12-18  Nick Clifton  <nickc@redhat.com>

	* gcc.dg/pr32912-2.c: Fix for 16-bit targets.

Comments

Jeff Law Dec. 18, 2013, 1:58 p.m. UTC | #1
On 12/18/13 03:09, Nick Clifton wrote:
> Hi Guys,
>
>    The test gcc/testsuite/gcc.dg/pr32912-2.c fails to execute correctly
>    on targets that use 16-bit integers, because it assumes at least a
>    32-bit integer.  The patch below removes this assumption, and it also
>    tidies up the code slightly so that __SIZEOF_INT__ is only tested in
>    one place, not three.
>
>    There were no regressions when tested with a i686-pc-linux-gnu or a
>    x86_64-pc-linux-gnu toolchain, and the test was fixed for a rl78-elf
>    toolchain.
>
>    OK to apply ?
>
> Cheers
>    Nick
>
> gcc/testsuite/ChangeLog
> 2013-12-18  Nick Clifton  <nickc@redhat.com>
>
> 	* gcc.dg/pr32912-2.c: Fix for 16-bit targets.
OK.
Jeff
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/pr32912-2.c
===================================================================
--- gcc/testsuite/gcc.dg/pr32912-2.c	(revision 206082)
+++ gcc/testsuite/gcc.dg/pr32912-2.c	(working copy)
@@ -1,14 +1,24 @@ 
 /* { dg-do run } */
 /* { dg-options "-O2 -w" } */
-/* { dg-skip-if "TImode not supported" { "avr-*-*" } { "*" } { "" } } */
 
 extern void abort (void);
 
 #if(__SIZEOF_INT__ >= 4)
-typedef int __m128i __attribute__ ((__vector_size__ (16)));
+# define TYPE      int
+# define TYPED(a)  a
+
+#elif(__SIZEOF_INT__ > 2)
+# define TYPE      long
+# define TYPED(a)  a##L
+
 #else
-typedef long __m128i __attribute__ ((__vector_size__ (16)));
+# define TYPE      long long
+# define TYPED(a)  a##LL
 #endif
+
+
+typedef TYPE __m128i __attribute__ ((__vector_size__ (16)));
+
 __m128i
 foo (void)
 {
@@ -26,11 +36,7 @@ 
 int
 main (void)
 {
-#if(__SIZEOF_INT__ >= 4)
-  union { __m128i v; int i[sizeof (__m128i) / sizeof (int)]; } u, v;
-#else
-  union { __m128i v; long i[sizeof (__m128i) / sizeof (long)]; } u, v;
-#endif
+  union { __m128i v; TYPE i[sizeof (__m128i) / sizeof (TYPE)]; } u, v;
   int i;
 
   u.v = foo ();
@@ -39,9 +45,10 @@ 
     {
       if (u.i[i] != ~v.i[i])
 	abort ();
+
       if (i < 3)
 	{
-	  if (u.i[i] != (0x11111111 << i))
+	  if (u.i[i] != (TYPED (0x11111111) << i))
 	    abort ();
 	}
       else if (u.i[i])