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