1 /* PR rtl-optimization/16104 */ 2 /* { dg-do run { target i?86-*-* x86_64-*-* } } */ 3 /* { dg-options "-msse2" } */ 4 /* { dg-require-effective-target sse2_runtime } */ 5 6 extern void abort (void); 7 8 typedef int V2SI __attribute__ ((vector_size (8))); 9 typedef unsigned int V2USI __attribute__ ((vector_size (8))); 10 typedef short V2HI __attribute__ ((vector_size (4))); 11 typedef unsigned int V2UHI __attribute__ ((vector_size (4))); 12 13 int test1(void)14test1 (void) 15 { 16 return (long long) (V2SI) 0LL; 17 } 18 19 int test2(V2SI x)20test2 (V2SI x) 21 { 22 return (long long) x; 23 } 24 25 V2SI test3(void)26test3 (void) 27 { 28 return (V2SI) (long long) (int) (V2HI) 0; 29 } 30 31 V2SI test4(V2HI x)32test4 (V2HI x) 33 { 34 return (V2SI) (long long) (int) x; 35 } 36 37 V2SI test5(V2USI x)38test5 (V2USI x) 39 { 40 return (V2SI) x; 41 } 42 43 void 44 __attribute__ ((noinline)) do_test(void)45do_test (void) 46 { 47 if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8) 48 return; 49 50 if (test1 () != 0) 51 abort (); 52 53 V2SI x = { 2, 2 }; 54 if (test2 (x) != 2) 55 abort (); 56 57 union { V2SI x; int y[2]; V2USI z; long long l; } u; 58 u.x = test3 (); 59 if (u.y[0] != 0 || u.y[1] != 0) 60 abort (); 61 62 V2HI y = { 4, 4 }; 63 union { V2SI x; long long y; } v; 64 v.x = test4 (y); 65 if (v.y != 0x40004) 66 abort (); 67 68 V2USI z = { 6, 6 }; 69 u.x = test5 (z); 70 if (u.y[0] != 6 || u.y[1] != 6) 71 abort (); 72 } 73 74 int main(void)75main (void) 76 { 77 do_test (); 78 return 0; 79 } 80