]> git.pld-linux.org Git - packages/gcc.git/blob - gcc32-tls5.patch
- added nodebug patch, pass GCJFLAGS to build per-cpu optimized libgcj
[packages/gcc.git] / gcc32-tls5.patch
1 2002-08-08  Jakub Jelinek  <jakub@redhat.com>
2
3         * config/i386/i386.c (legitimate_constant_p): UNSPEC_TP is not
4         legitimate constant.
5         (legitimate_pic_operand_p): Neither pic operand.
6         (legitimate_address_p): But legitimate address.
7         (get_thread_pointer): Generate MEM/u instead of CONST around
8         UNSPEC_TP.
9         (print_operand): Remove printing of UNSPEC_TP.
10         (print_operand_address): And print it here.
11
12         * gcc.dg/tls/opt-2.c: New test.
13
14 --- gcc/config/i386/i386.c.jj   2002-08-07 22:18:39.000000000 +0200
15 +++ gcc/config/i386/i386.c      2002-08-08 18:18:18.000000000 +0200
16 @@ -4861,8 +4861,6 @@
17           {
18           case UNSPEC_TPOFF:
19             return local_exec_symbolic_operand (XVECEXP (inner, 0, 0), Pmode);
20 -         case UNSPEC_TP:
21 -           return true;
22           default:
23             return false;
24           }
25 @@ -4921,8 +4919,6 @@
26           {
27           case UNSPEC_TPOFF:
28             return local_exec_symbolic_operand (XVECEXP (inner, 0, 0), Pmode);
29 -         case UNSPEC_TP:
30 -           return true;
31           default:
32             return false;
33           }
34 @@ -5048,6 +5044,13 @@
35        debug_rtx (addr);
36      }
37  
38 +  if (GET_CODE (addr) == UNSPEC && XINT (addr, 1) == UNSPEC_TP)
39 +    {
40 +      if (TARGET_DEBUG_ADDR)
41 +       fprintf (stderr, "Success.\n");
42 +      return TRUE;
43 +    }
44 +
45    if (ix86_decompose_address (addr, &parts) <= 0)
46      {
47        reason = "decomposition failed";
48 @@ -5499,7 +5502,9 @@
49    rtx tp;
50  
51    tp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx), UNSPEC_TP);
52 -  tp = gen_rtx_CONST (Pmode, tp);
53 +  tp = gen_rtx_MEM (Pmode, tp);
54 +  RTX_UNCHANGING_P (tp) = 1;
55 +  set_mem_alias_set (tp, ix86_GOT_alias_set ());
56    tp = force_reg (Pmode, tp);
57  
58    return tp;
59 @@ -6613,17 +6618,6 @@
60        fprintf (file, "%s", dstr);
61      }
62  
63 -  else if (GET_CODE (x) == CONST
64 -          && GET_CODE (XEXP (x, 0)) == UNSPEC
65 -          && XINT (XEXP (x, 0), 1) == UNSPEC_TP)
66 -    {
67 -      if (ASSEMBLER_DIALECT == ASM_INTEL)
68 -       fputs ("DWORD PTR ", file);
69 -      if (ASSEMBLER_DIALECT == ASM_ATT || USER_LABEL_PREFIX[0] == 0)
70 -       putc ('%', file);
71 -      fputs ("gs:0", file);
72 -    }
73 -
74    else
75      {
76        if (code != 'P')
77 @@ -6662,6 +6656,16 @@
78    rtx base, index, disp;
79    int scale;
80  
81 +  if (GET_CODE (addr) == UNSPEC && XINT (addr, 1) == UNSPEC_TP)
82 +    {
83 +      if (ASSEMBLER_DIALECT == ASM_INTEL)
84 +       fputs ("DWORD PTR ", file);
85 +      if (ASSEMBLER_DIALECT == ASM_ATT || USER_LABEL_PREFIX[0] == 0)
86 +       putc ('%', file);
87 +      fputs ("gs:0", file);
88 +      return;
89 +    }
90 +
91    if (! ix86_decompose_address (addr, &parts))
92      {
93        output_operand_lossage ("Wrong address expression or operand constraint");
94 --- gcc/testsuite/gcc.dg/tls/opt-2.c.jj 2002-08-08 18:36:32.000000000 +0200
95 +++ gcc/testsuite/gcc.dg/tls/opt-2.c    2002-08-08 18:34:44.000000000 +0200
96 @@ -0,0 +1,53 @@
97 +/* This testcase generated invalid assembly on IA-32,
98 +   since %gs:0 memory load was not exposed to the compiler
99 +   as memory load and mem to mem moves are not possible
100 +   on IA-32.  */
101 +/* { dg-do link } */
102 +/* { dg-options "-O2 -ftls-model=initial-exec" } */
103 +/* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target i?86-*-* } } */
104 +
105 +__thread int thr;
106 +
107 +struct A
108 +{
109 +  unsigned int a, b, c, d, e;
110 +};
111 +
112 +int bar (int x, unsigned long y, void *z)
113 +{
114 +  return 0;
115 +}
116 +
117 +int
118 +foo (int x, int y, const struct A *z)
119 +{
120 +  struct A b;
121 +  int d;
122 +
123 +  b = *z;
124 +  d = bar (x, y, &b);
125 +  if (d == 0 && y == 0x5402)
126 +    {
127 +      int e = thr;
128 +      d = bar (x, 0x5401, &b);
129 +      if (d)
130 +       {
131 +         thr = e;
132 +         d = 0;
133 +       }
134 +      else if ((z->c & 0600) != (b.c & 0600)
135 +              || ((z->c & 060) && ((z->c & 060) != (b.c & 060))))
136 +       {
137 +         thr = 22;
138 +         d = -1;
139 +       }
140 +    }
141 +
142 +  return d;
143 +}
144 +
145 +int main (void)
146 +{
147 +  foo (1, 2, 0);
148 +  return 0;
149 +}
This page took 0.084226 seconds and 3 git commands to generate.