Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/20050604-1.c

raw
1 /* PR regression/21897 */
2 /* This testcase generates MMX instructions together with x87 instructions.
3 Currently, there is no "emms" generated to switch between register sets,
4 so the testcase fails for targets where MMX insns are enabled. */
5 /* { dg-options "-mno-mmx" { target { x86_64-*-* i?86-*-* } } } */
6
7 extern void abort (void);
8
9 typedef unsigned short v4hi __attribute__ ((vector_size (8)));
10 typedef float v4sf __attribute__ ((vector_size (16)));
11
12 union
13 {
14 v4hi v;
15 short s[4];
16 } u;
17
18 union
19 {
20 v4sf v;
21 float f[4];
22 } v;
23
24 void
25 foo (void)
26 {
27 unsigned int i;
28 for (i = 0; i < 2; i++)
29 u.v += (v4hi) { 12, 32768 };
30 for (i = 0; i < 2; i++)
31 v.v += (v4sf) { 18.0, 20.0, 22 };
32 }
33
34 int
35 main (void)
36 {
37 foo ();
38 if (u.s[0] != 24 || u.s[1] != 0 || u.s[2] || u.s[3])
39 abort ();
40 if (v.f[0] != 36.0 || v.f[1] != 40.0 || v.f[2] != 44.0 || v.f[3] != 0.0)
41 abort ();
42 return 0;
43 }