Home | History | Annotate | Download | only in Windows
      1 ; RUN: llc -mtriple thumbv7--windows-itanium %s -o - | FileCheck %s
      2 
      3 @i = thread_local global i32 0
      4 @j = external thread_local global i32
      5 @k = internal thread_local global i32 0
      6 @l = hidden thread_local global i32 0
      7 @m = external hidden thread_local global i32
      8 @n = thread_local global i16 0
      9 @o = thread_local global i8 0
     10 
     11 define i32 @f() {
     12   %1 = load i32, i32* @i
     13   ret i32 %1
     14 }
     15 
     16 ; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
     17 
     18 ; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
     19 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
     20 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
     21 
     22 ; CHECK:      ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
     23 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
     24 
     25 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:LCPI[0-9]+_[0-9]+]]
     26 
     27 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
     28 
     29 ; CHECK: [[CPI]]:
     30 ; CHECK-NEXT: .long i(SECREL32)
     31 
     32 define i32 @e() {
     33   %1 = load i32, i32* @j
     34   ret i32 %1
     35 }
     36 
     37 ; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
     38 
     39 ; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
     40 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
     41 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
     42 
     43 ; CHECK:      ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
     44 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
     45 
     46 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:LCPI[0-9]+_[0-9]+]]
     47 
     48 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
     49 
     50 ; CHECK: [[CPI]]:
     51 ; CHECK-NEXT: .long j(SECREL32)
     52 
     53 define i32 @d() {
     54   %1 = load i32, i32* @k
     55   ret i32 %1
     56 }
     57 
     58 ; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
     59 
     60 ; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
     61 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
     62 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
     63 
     64 ; CHECK:      ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
     65 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
     66 
     67 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:LCPI[0-9]+_[0-9]+]]
     68 
     69 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
     70 
     71 ; CHECK: [[CPI]]:
     72 ; CHECK-NEXT: .long k(SECREL32)
     73 
     74 define i32 @c() {
     75   %1 = load i32, i32* @l
     76   ret i32 %1
     77 }
     78 
     79 ; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
     80 
     81 ; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
     82 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
     83 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
     84 
     85 ; CHECK:      ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
     86 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
     87 
     88 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:LCPI[0-9]+_[0-9]+]]
     89 
     90 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
     91 
     92 ; CHECK: [[CPI]]:
     93 ; CHECK-NEXT: .long l(SECREL32)
     94 
     95 define i32 @b() {
     96   %1 = load i32, i32* @m
     97   ret i32 %1
     98 }
     99 
    100 ; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
    101 
    102 ; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
    103 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
    104 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
    105 
    106 ; CHECK:      ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
    107 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
    108 
    109 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:LCPI[0-9]+_[0-9]+]]
    110 
    111 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
    112 
    113 ; CHECK: [[CPI]]:
    114 ; CHECK: .long m(SECREL32)
    115 
    116 define i16 @a() {
    117   %1 = load i16, i16* @n
    118   ret i16 %1
    119 }
    120 
    121 ; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
    122 
    123 ; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
    124 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
    125 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
    126 
    127 ; CHECK:      ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
    128 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
    129 
    130 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:LCPI[0-9]+_[0-9]+]]
    131 
    132 ; CHECK-NEXT: ldrh r0, {{\[}}[[TLS]], [[SLOT]]]
    133 
    134 ; CHECK: [[CPI]]:
    135 ; CHECK: .long n(SECREL32)
    136 
    137 define i8 @Z() {
    138   %1 = load i8, i8* @o
    139   ret i8 %1
    140 }
    141 
    142 ; CHECK:      mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
    143 
    144 ; CHECK:      movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
    145 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
    146 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
    147 
    148 ; CHECK:      ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
    149 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
    150 
    151 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:LCPI[0-9]+_[0-9]+]]
    152 
    153 ; CHECK-NEXT: ldrb r0, {{\[}}[[TLS]], [[SLOT]]]
    154 
    155 ; CHECK: [[CPI]]:
    156 ; CHECK-NEXT: .long o(SECREL32)
    157 
    158