This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add a testcase for PR target/15301


On Fri, May 07, 2004 at 03:53:59PM -0700, H. J. Lu wrote:
> I am not sure if gcc.dg/compat is the right place.
> 
> 

The last patch will fail on non-x86-64 targets. Here is the new one.

H.J.
2004-05-07  H.J. Lu  <hongjiu.lu@intel.com>

	* gcc.dg/compat/union-m128-1.h: New file.  Add a test for
	PR target/15301.
	* gcc.dg/compat/union-m128-1_main.c: Likewise.
	* gcc.dg/compat/union-m128-1_x.c: Likewise.
	* gcc.dg/compat/union-m128-1_y.c: Likewise.

--- gcc/testsuite/gcc.dg/compat/union-m128-1.h.m128	2004-05-07 15:42:21.000000000 -0700
+++ gcc/testsuite/gcc.dg/compat/union-m128-1.h	2004-05-07 15:19:25.000000000 -0700
@@ -0,0 +1,17 @@
+#include <xmmintrin.h>
+
+typedef struct
+{
+  __m128 x;
+} SS_struct_mi128;
+
+typedef union
+{
+  __m128 x;
+} SS_union_mi128;
+
+typedef union
+{
+  __m128 x;
+  unsigned long long u[2];
+} union_mi128;
--- gcc/testsuite/gcc.dg/compat/union-m128-1_main.c.m128	2004-05-07 15:42:21.000000000 -0700
+++ gcc/testsuite/gcc.dg/compat/union-m128-1_main.c	2004-05-08 14:45:32.000000000 -0700
@@ -0,0 +1,21 @@
+/* { dg-options "-O" } */
+
+#ifdef __x86_64__
+/* Test function argument passing.  PR target/15301.  */
+
+extern void union_m128_1_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+  union_m128_1_x ();
+  exit (0);
+}
+#else
+int
+main ()
+{
+  return 0;
+}
+#endif
--- gcc/testsuite/gcc.dg/compat/union-m128-1_x.c.m128	2004-05-07 15:42:21.000000000 -0700
+++ gcc/testsuite/gcc.dg/compat/union-m128-1_x.c	2004-05-07 15:43:30.000000000 -0700
@@ -0,0 +1,26 @@
+/* { dg-options "-O" } */
+
+#ifdef __x86_64__
+#include "union-m128-1.h"
+
+SS_union_mi128 un;
+SS_struct_mi128 st;
+
+extern void bar ();
+extern void foo ();
+
+void
+union_m128_1_x ()
+{
+  union_mi128 x;
+
+  x.u [0] = 0x123456789abcedf0LL;
+  x.u [1] = 0xfedcba9876543210LL;
+  un.x = x.x;
+  st.x = x.x;
+  bar(un);
+  bar(st);
+  foo(un);
+  foo(st);
+}
+#endif
--- gcc/testsuite/gcc.dg/compat/union-m128-1_y.c.m128	2004-05-07 15:42:21.000000000 -0700
+++ gcc/testsuite/gcc.dg/compat/union-m128-1_y.c	2004-05-07 15:43:33.000000000 -0700
@@ -0,0 +1,29 @@
+/* { dg-options "-O" } */
+
+#ifdef __x86_64__
+#include <stdlib.h>
+
+#include "union-m128-1.h"
+
+void
+bar (SS_union_mi128 un)
+{
+  union_mi128 x;
+  
+  x.x = un.x;
+  if (x.u [0] != 0x123456789abcedf0LL
+      || x.u [1] != 0xfedcba9876543210LL)
+    abort ();
+}
+
+void
+foo (SS_struct_mi128 st)
+{
+  union_mi128 x;
+  
+  x.x = st.x;
+  if (x.u [0] != 0x123456789abcedf0LL
+      || x.u [1] != 0xfedcba9876543210LL)
+    abort ();
+}
+#endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]