[ARM] More MVE compare vector splat combines for ANDs
[llvm-complete.git] / test / CodeGen / SPARC / tls.ll
blob1b1af2e99c38764bfbf6445b3135f48cb9afba32
1 ; RUN: llc <%s -march=sparc   -relocation-model=static | FileCheck %s --check-prefix=v8abs
2 ; RUN: llc <%s -march=sparcv9 -relocation-model=static | FileCheck %s --check-prefix=v9abs
3 ; RUN: llc <%s -march=sparc   -relocation-model=pic    | FileCheck %s --check-prefix=pic
4 ; RUN: llc <%s -march=sparcv9 -relocation-model=pic    | FileCheck %s --check-prefix=pic
6 ; RUN: llc <%s -march=sparc   -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v8abs-obj
7 ; RUN: llc <%s -march=sparcv9 -relocation-model=static -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=v9abs-obj
8 ; RUN: llc <%s -march=sparc   -relocation-model=pic    -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
9 ; RUN: llc <%s -march=sparcv9 -relocation-model=pic    -filetype=obj | llvm-readobj -r --symbols | FileCheck %s --check-prefix=pic-obj
11 @local_symbol = internal thread_local global i32 0
12 @extern_symbol = external thread_local global i32
14 ; v8abs-LABEL:  test_tls_local
15 ; v8abs:        sethi  %tle_hix22(local_symbol), [[R0:%[goli][0-7]]]
16 ; v8abs:        xor    [[R0]], %tle_lox10(local_symbol), [[R1:%[goli][0-7]]]
17 ; v8abs:        ld     [%g7+[[R1]]]
19 ; v9abs-LABEL:  test_tls_local
20 ; v9abs:        sethi  %tle_hix22(local_symbol), [[R0:%[goli][0-7]]]
21 ; v9abs:        xor    [[R0]], %tle_lox10(local_symbol), [[R1:%[goli][0-7]]]
22 ; v9abs:        ld     [%g7+[[R1]]]
24 ; pic-LABEL:  test_tls_local
25 ; pic:        or     {{%[goli][0-7]}}, %lo(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[PC:%[goli][0-7]]]
26 ; pic:        add    [[PC]], %o7, [[GOTBASE:%[goli][0-7]]]
27 ; pic-DAG:    sethi  %tldm_hi22(local_symbol), [[R0:%[goli][0-7]]]
28 ; pic-DAG:    add    [[R0]], %tldm_lo10(local_symbol), [[R1:%[goli][0-7]]]
29 ; pic-DAG:    add    [[GOTBASE]], [[R1]], %o0, %tldm_add(local_symbol)
30 ; pic-DAG:    call   __tls_get_addr, %tldm_call(local_symbol)
31 ; pic-DAG:    sethi  %tldo_hix22(local_symbol), [[R2:%[goli][0-7]]]
32 ; pic-DAG:    xor    [[R2]], %tldo_lox10(local_symbol), [[R3:%[goli][0-7]]]
33 ; pic:        add    %o0, [[R3]], {{.+}}, %tldo_add(local_symbol)
35 define i32 @test_tls_local() {
36 entry:
37   %0 = load i32, i32* @local_symbol, align 4
38   %1 = add i32 %0, 1
39   store i32 %1, i32* @local_symbol, align 4
40   ret i32 %1
44 ; v8abs-LABEL:  test_tls_extern
45 ; v8abs:        or     {{%[goli][0-7]}}, %lo(_GLOBAL_OFFSET_TABLE_), %[[GOTBASE:[goli][0-7]]]
46 ; v8abs:        sethi  %tie_hi22(extern_symbol), [[R1:%[goli][0-7]]]
47 ; v8abs:        add    [[R1]], %tie_lo10(extern_symbol), %[[R2:[goli][0-7]]]
48 ; v8abs:        ld     [%[[GOTBASE]]+%[[R2]]], [[R3:%[goli][0-7]]], %tie_ld(extern_symbol)
49 ; v8abs:        add    %g7, [[R3]], %[[R4:[goli][0-7]]], %tie_add(extern_symbol)
50 ; v8abs:        ld     [%[[R4]]]
52 ; v9abs-LABEL:  test_tls_extern
53 ; v9abs:        or     {{%[goli][0-7]}}, %l44(_GLOBAL_OFFSET_TABLE_), %[[GOTBASE:[goli][0-7]]]
54 ; v9abs:        sethi  %tie_hi22(extern_symbol), [[R1:%[goli][0-7]]]
55 ; v9abs:        add    [[R1]], %tie_lo10(extern_symbol), %[[R2:[goli][0-7]]]
56 ; v9abs:        ldx    [%[[GOTBASE]]+%[[R2]]], [[R3:%[goli][0-7]]], %tie_ldx(extern_symbol)
57 ; v9abs:        add    %g7, [[R3]], %[[R4:[goli][0-7]]], %tie_add(extern_symbol)
58 ; v9abs:        ld     [%[[R4]]]
60 ; pic-LABEL:  test_tls_extern
61 ; pic:        or     {{%[goli][0-7]}}, %lo(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[PC:%[goli][0-7]]]
62 ; pic:        add    [[PC]], %o7, [[GOTBASE:%[goli][0-7]]]
63 ; pic:        sethi  %tgd_hi22(extern_symbol), [[R0:%[goli][0-7]]]
64 ; pic:        add    [[R0]], %tgd_lo10(extern_symbol), [[R1:%[goli][0-7]]]
65 ; pic:        add    [[GOTBASE]], [[R1]], %o0, %tgd_add(extern_symbol)
66 ; pic:        call   __tls_get_addr, %tgd_call(extern_symbol)
67 ; pic-NEXT:   nop
69 define i32 @test_tls_extern() {
70 entry:
71   %0 = load i32, i32* @extern_symbol, align 4
72   %1 = add i32 %0, 1
73   store i32 %1, i32* @extern_symbol, align 4
74   ret i32 %1
78 ; v8abs-obj: Relocations [
79 ; v8abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_HIX22 local_symbol 0x0
80 ; v8abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_LOX10 local_symbol 0x0
81 ; v8abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_ 0x0
82 ; v8abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_LO10 _GLOBAL_OFFSET_TABLE_ 0x0
83 ; v8abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_IE_HI22 extern_symbol 0x0
84 ; v8abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_IE_LO10 extern_symbol 0x0
85 ; v8abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_IE_LD extern_symbol 0x0
86 ; v8abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_IE_ADD extern_symbol 0x0
87 ; v8abs-obj: ]
89 ; v9abs-obj: Relocations [
90 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_HIX22 local_symbol 0x0
91 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LE_LOX10 local_symbol 0x0
92 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_H44 _GLOBAL_OFFSET_TABLE_ 0x0
93 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_M44 _GLOBAL_OFFSET_TABLE_ 0x0
94 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_L44 _GLOBAL_OFFSET_TABLE_ 0x0
95 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_IE_HI22 extern_symbol 0x0
96 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_IE_LO10 extern_symbol 0x0
97 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_IE_LDX extern_symbol 0x0
98 ; v9abs-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_IE_ADD extern_symbol 0x0
99 ; v9abs-obj: ]
101 ; pic-obj: Relocations [
102 ; pic-obj:  Section {{.*}} .rela.text {
103 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
104 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x8
105 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_HIX22 local_symbol 0x0
106 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_HI22 local_symbol 0x0
107 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_LO10 local_symbol 0x0
108 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_ADD local_symbol 0x0
109 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_LOX10 local_symbol 0x0
110 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LDM_CALL local_symbol 0x0
111 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_LDO_ADD local_symbol 0x0
112 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_ 0x4
113 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_PC10 _GLOBAL_OFFSET_TABLE_ 0x8
114 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_GD_HI22 extern_symbol 0x0
115 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_GD_LO10 extern_symbol 0x0
116 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_GD_ADD extern_symbol 0x0
117 ; pic-obj:    0x{{[0-9,A-F]+}} R_SPARC_TLS_GD_CALL extern_symbol 0x0
118 ; pic-obj: ]
119 ; pic-obj:      Symbols [
120 ; pic-obj:        Symbol {
121 ; pic-obj:          Name: __tls_get_addr ({{[0-9]+}})
122 ; pic-obj-NEXT:     Value: 0x0
123 ; pic-obj-NEXT:     Size: 0
124 ; pic-obj-NEXT:     Binding: Global (0x1)
125 ; pic-obj-NEXT:     Type: None (0x0)
126 ; pic-obj-NEXT:     Other: 0
127 ; pic-obj-NEXT:     Section: Undefined (0x0)
128 ; pic-obj-NEXT:   }
129 ; pic-obj:      ]