Home | History | Annotate | Download | only in ARM
      1 ; RUN: llc -march=arm -mtriple=arm-linux-gnueabi < %s | FileCheck -check-prefix=CHECK-NONPIC %s
      2 ; RUN: llc -march=arm -mtriple=arm-linux-gnueabi -relocation-model=pic < %s | FileCheck -check-prefix=CHECK-PIC %s
      3 
      4 
      5 @external_gd = external thread_local global i32
      6 @internal_gd = internal thread_local global i32 42
      7 
      8 @external_ld = external thread_local(localdynamic) global i32
      9 @internal_ld = internal thread_local(localdynamic) global i32 42
     10 
     11 @external_ie = external thread_local(initialexec) global i32
     12 @internal_ie = internal thread_local(initialexec) global i32 42
     13 
     14 @external_le = external thread_local(localexec) global i32
     15 @internal_le = internal thread_local(localexec) global i32 42
     16 
     17 ; ----- no model specified -----
     18 
     19 define i32* @f1() {
     20 entry:
     21   ret i32* @external_gd
     22 
     23   ; Non-PIC code can use initial-exec, PIC code has to use general dynamic.
     24   ; CHECK-NONPIC-LABEL:   f1:
     25   ; CHECK-NONPIC:   external_gd(GOTTPOFF)
     26   ; CHECK-PIC-LABEL:      f1:
     27   ; CHECK-PIC:      external_gd(TLSGD)
     28 }
     29 
     30 define i32* @f2() {
     31 entry:
     32   ret i32* @internal_gd
     33 
     34   ; Non-PIC code can use local exec, PIC code can use local dynamic,
     35   ; but that is not implemented, so falls back to general dynamic.
     36   ; CHECK-NONPIC-LABEL:   f2:
     37   ; CHECK-NONPIC:   internal_gd(TPOFF)
     38   ; CHECK-PIC-LABEL:      f2:
     39   ; CHECK-PIC:      internal_gd(TLSGD)
     40 }
     41 
     42 
     43 ; ----- localdynamic specified -----
     44 
     45 define i32* @f3() {
     46 entry:
     47   ret i32* @external_ld
     48 
     49   ; Non-PIC code can use initial exec, PIC should use local dynamic,
     50   ; but that is not implemented, so falls back to general dynamic.
     51   ; CHECK-NONPIC-LABEL:   f3:
     52   ; CHECK-NONPIC:   external_ld(GOTTPOFF)
     53   ; CHECK-PIC-LABEL:      f3:
     54   ; CHECK-PIC:      external_ld(TLSGD)
     55 }
     56 
     57 define i32* @f4() {
     58 entry:
     59   ret i32* @internal_ld
     60 
     61   ; Non-PIC code can use local exec, PIC code can use local dynamic,
     62   ; but that is not implemented, so it falls back to general dynamic.
     63   ; CHECK-NONPIC-LABEL:   f4:
     64   ; CHECK-NONPIC:   internal_ld(TPOFF)
     65   ; CHECK-PIC-LABEL:      f4:
     66   ; CHECK-PIC:      internal_ld(TLSGD)
     67 }
     68 
     69 
     70 ; ----- initialexec specified -----
     71 
     72 define i32* @f5() {
     73 entry:
     74   ret i32* @external_ie
     75 
     76   ; Non-PIC and PIC code will use initial exec as specified.
     77   ; CHECK-NONPIC-LABEL:   f5:
     78   ; CHECK-NONPIC:   external_ie(GOTTPOFF)
     79   ; CHECK-PIC-LABEL:      f5:
     80   ; CHECK-PIC:      external_ie(GOTTPOFF)
     81 }
     82 
     83 define i32* @f6() {
     84 entry:
     85   ret i32* @internal_ie
     86 
     87   ; Non-PIC code can use local exec, PIC code use initial exec as specified.
     88   ; CHECK-NONPIC-LABEL:   f6:
     89   ; CHECK-NONPIC:   internal_ie(TPOFF)
     90   ; CHECK-PIC-LABEL:      f6:
     91   ; CHECK-PIC:      internal_ie(GOTTPOFF)
     92 }
     93 
     94 
     95 ; ----- localexec specified -----
     96 
     97 define i32* @f7() {
     98 entry:
     99   ret i32* @external_le
    100 
    101   ; Non-PIC and PIC code will use local exec as specified.
    102   ; CHECK-NONPIC-LABEL:   f7:
    103   ; CHECK-NONPIC:   external_le(TPOFF)
    104   ; CHECK-PIC-LABEL:      f7:
    105   ; CHECK-PIC:      external_le(TPOFF)
    106 }
    107 
    108 define i32* @f8() {
    109 entry:
    110   ret i32* @internal_le
    111 
    112   ; Non-PIC and PIC code will use local exec as specified.
    113   ; CHECK-NONPIC-LABEL:   f8:
    114   ; CHECK-NONPIC:   internal_le(TPOFF)
    115   ; CHECK-PIC-LABEL:      f8:
    116   ; CHECK-PIC:      internal_le(TPOFF)
    117 }
    118