Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / torture / pr16104-1.c
blob4cafbe718aa4f17ce6b7cb8ec9a67909f1942568
1 /* PR rtl-optimization/16104 */
2 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
3 /* { dg-options "-msse2" } */
5 #include "../i386-cpuid.h"
7 extern void abort (void);
9 typedef int V2SI __attribute__ ((vector_size (8)));
10 typedef unsigned int V2USI __attribute__ ((vector_size (8)));
11 typedef short V2HI __attribute__ ((vector_size (4)));
12 typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
14 int
15 test1 (void)
17 return (long long) (V2SI) 0LL;
20 int
21 test2 (V2SI x)
23 return (long long) x;
26 V2SI
27 test3 (void)
29 return (V2SI) (long long) (int) (V2HI) 0;
32 V2SI
33 test4 (V2HI x)
35 return (V2SI) (long long) (int) x;
38 V2SI
39 test5 (V2USI x)
41 return (V2SI) x;
44 int
45 __attribute__ ((noinline))
46 do_test (void)
48 if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
49 return 0;
51 if (test1 () != 0)
52 abort ();
54 V2SI x = { 2, 2 };
55 if (test2 (x) != 2)
56 abort ();
58 union { V2SI x; int y[2]; V2USI z; long long l; } u;
59 u.x = test3 ();
60 if (u.y[0] != 0 || u.y[1] != 0)
61 abort ();
63 V2HI y = { 4, 4 };
64 union { V2SI x; long long y; } v;
65 v.x = test4 (y);
66 if (v.y != 0x40004)
67 abort ();
69 V2USI z = { 6, 6 };
70 u.x = test5 (z);
71 if (u.y[0] != 6 || u.y[1] != 6)
72 abort ();
73 return 0;
76 int
77 main (void)
79 unsigned long cpu_facilities;
81 cpu_facilities = i386_cpuid ();
83 if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV | bit_SSE2))
84 != (bit_MMX | bit_SSE | bit_CMOV | bit_SSE2))
85 return 0;
87 return do_test ();