1 /* { dg-do compile } */
2 /* { dg-require-effective-target tls } */
3 /* { dg-options "-O2" } */
4 /* { dg-final { scan-assembler-not "ldw\tr., %lo" } } */
5 /* { dg-final { scan-assembler-not "stw\tr., %lo" } } */
6 
7 /* Check that address transformations for symbolic constants do NOT
8    apply to TLS variables.  */
9 
10 #define TYPE int
11 
12 struct ss
13 {
14   TYPE x1,x2;
15 };
16 
17 extern __thread TYPE S1;
18 extern __thread TYPE S2[];
19 
20 extern __thread struct ss S3;
21 extern __thread struct ss S4[];
22 
addr1(void)23 TYPE *addr1 (void) { return &S1; }
get1(void)24 TYPE get1 (void) { return S1; }
set1(TYPE value)25 void set1 (TYPE value) { S1 = value; }
26 
addr2(int i)27 TYPE *addr2 (int i) { return &(S2[i]); }
get2(int i)28 TYPE get2 (int i) { return S2[i]; }
set2(int i,TYPE value)29 void set2 (int i, TYPE value) { S2[i] = value; }
30 
addr3(void)31 TYPE *addr3 (void) { return &(S3.x2); }
get3(void)32 TYPE get3 (void) { return S3.x2; }
set3(TYPE value)33 void set3 (TYPE value) { S3.x2 = value; }
34 
addr4(int i)35 TYPE *addr4 (int i) { return &(S4[i].x2); }
get4(int i)36 TYPE get4 (int i) { return S4[i].x2; }
set4(int i,TYPE value)37 void set4 (int i, TYPE value) { S4[i].x2 = value; }
38 
39