FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / gcc.dg / tls / opt-2.c
blob713fb7f360c2944ddcac3851bc3d7671881dd848
1 /* This testcase generated invalid assembly on IA-32,
2 since %gs:0 memory load was not exposed to the compiler
3 as memory load and mem to mem moves are not possible
4 on IA-32. */
5 /* { dg-do link } */
6 /* { dg-options "-O2 -ftls-model=initial-exec" } */
7 /* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target i?86-*-* } } */
9 __thread int thr;
11 struct A
13 unsigned int a, b, c, d, e;
16 int bar (int x, unsigned long y, void *z)
18 return 0;
21 int
22 foo (int x, int y, const struct A *z)
24 struct A b;
25 int d;
27 b = *z;
28 d = bar (x, y, &b);
29 if (d == 0 && y == 0x5402)
31 int e = thr;
32 d = bar (x, 0x5401, &b);
33 if (d)
35 thr = e;
36 d = 0;
38 else if ((z->c & 0600) != (b.c & 0600)
39 || ((z->c & 060) && ((z->c & 060) != (b.c & 060))))
41 thr = 22;
42 d = -1;
46 return d;
49 int main (void)
51 foo (1, 2, 0);
52 return 0;