File: reloc.mir

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (322 lines) | stat: -rw-r--r-- 10,586 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# RUN: llc -mattr=+egpr,+ndd -x mir < %s -x86-enable-apx-for-relocation=true -run-pass x86-suppress-apx-for-relocation -verify-machineinstrs -o - | FileCheck %s --check-prefixes=CHECK,APXREL
# RUN: llc -mattr=+egpr,+ndd -x mir < %s -run-pass x86-suppress-apx-for-relocation -verify-machineinstrs -o - | FileCheck %s --check-prefixes=CHECK,NOAPXREL


--- |
  target triple = "x86_64-unknown-linux-gnu"

  @x = external global i64
  @i = external thread_local global i32

  define i32 @mov() {
  entry:
    ret i32 undef
  }

  define i8 @test() {
  entry:
    ret i8 undef
  }
  define i32 @adc() {
  entry:
    ret i32 undef
  }

  define i32 @add() {
  entry:
    ret i32 undef
  }

  define i32 @and() {
  entry:
    ret i32 undef
  }

  define i8 @cmp() {
  entry:
    ret i8 undef
  }

  define i32 @or() {
  entry:
    ret i32 undef
  }

  define i32 @sbb() {
  entry:
    ret i32 undef
  }

  define i32 @sub() {
  entry:
    ret i32 undef
  }

  define i32 @xor() {
  entry:
    ret i32 undef
  }

  define i32 @add64rm_nd_gotpcrel() {
  entry:
    ret i32 undef
  }

  define i32 @add64rm_nd_gottpoff() {
  entry:
    ret i32 undef
  }

  define i32 @add64mr_nd() {
  entry:
    ret i32 undef
  }
...
---
name: mov
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load (s64))
    %1:gr32 = MOV32rm killed %0, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %1
    RET 0, $eax

# CHECK: name: mov
# APXREL: %0:gr64 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load (s64))
# NOAPXREL: %0:gr64_norex2 = MOV64rm $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg :: (load (s64))
...
---
name: test
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr8 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    TEST64mr $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0:gr64, implicit-def $eflags :: (load (s64))
    %1:gr8 = SETCCr 5, implicit $eflags
    $al = COPY %1
    RET 0, $al

# CHECK: name: test
# APXREL: %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
# APXREL-NEXT: TEST64mr $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0, implicit-def $eflags :: (load (s64))
# NOAPXREL: %0:gr64_norex2 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
# NOAPXREL-NEXT: TEST64mr $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0, implicit-def $eflags :: (load (s64))

...
---
name: adc
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr64 }
  - { id: 3, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = OR64ri8 %0, 7, implicit-def $eflags
    %2:gr64 = ADC64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))
    %3:gr32 = MOV32rm killed %2, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %3
    RET 0, $eax

# CHECK: name: adc
# APXREL: %2:gr64 = ADC64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))
# NOAPXREL: %2:gr64_norex2 = ADC64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))
...
---
name: add
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = ADD64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
    %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %2
    RET 0, $eax
# CHECK: name: add
# APXREL: %1:gr64 = ADD64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
# NOAPXREL: %1:gr64_norex2 = ADD64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
...
---
name: and
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = AND64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
    %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %2
    RET 0, $eax

# CHECK: name: and
# APXREL: %1:gr64 = AND64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
# NOAPXREL: %1:gr64_norex2 = AND64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
...
---
name: or
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = OR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
    %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %2
    RET 0, $eax

# CHECK: name: or
# APXREL: %1:gr64 = OR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
# NOAPXREL: %1:gr64_norex2 = OR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
...
---
name: sbb
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr64 }
  - { id: 3, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = OR64ri8 %0, 7, implicit-def $eflags
    %2:gr64 = SBB64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))
    %3:gr32 = MOV32rm killed %2, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %3
    RET 0, $eax

# CHECK: name: sbb
# APXREL: %1:gr64 = OR64ri8 %0, 7, implicit-def $eflags
# APXREL-NEXT: %2:gr64 = SBB64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))
# NOAPXREL: %1:gr64_norex2 = OR64ri8 %0, 7, implicit-def $eflags
# NOAPXREL-NEXT: %2:gr64_norex2 = SBB64rm %1, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags, implicit $eflags :: (load (s64))
...
---
name: sub
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = SUB64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
    %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %2
    RET 0, $eax

# CHECK: name: sub
# APXREL: %1:gr64 = SUB64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
# NOAPXREL: %1:gr64_norex2 = SUB64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
...
---
name: xor
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = XOR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
    %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %2
    RET 0, $eax

# CHECK: name: xor
# APXREL: %1:gr64 = XOR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
# NOAPXREL: %1:gr64_norex2 = XOR64rm %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def $eflags :: (load (s64))
...
---
name: add64rm_nd_gotpcrel
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = ADD64rm_ND %0, $rip, 1, $noreg, target-flags(x86-gotpcrel) @i, $noreg, implicit-def dead $eflags :: (load (s64) from got)
    %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %2
    RET 0, $eax

# CHECK: name: add64rm_nd_gotpcrel
# APXREL: %1:gr64 = ADD64rm_ND %0, $rip, 1, $noreg, target-flags(x86-gotpcrel) @i, $noreg, implicit-def dead $eflags :: (load (s64) from got)
# NOAPXREL: %3:gr64_norex2 = COPY %0
# NOAPXREL: %1:gr64_norex2 = ADD64rm %3, $rip, 1, $noreg, target-flags(x86-gotpcrel) @i, $noreg, implicit-def dead $eflags
...
---
name: add64rm_nd_gottpoff
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = ADD64rm_ND %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def dead $eflags :: (load (s64) from got)
    %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %2
    RET 0, $eax

# CHECK: name: add64rm_nd
# APXREL: %1:gr64 = ADD64rm_ND %0, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def dead $eflags :: (load (s64) from got)
# NOAPXREL: %3:gr64_norex2 = COPY %0
# NOAPXREL: %1:gr64_norex2 = ADD64rm %3, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def dead $eflags
...
---
name: add64mr_nd
alignment: 16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr32 }
body: |
  bb.0.entry:
    %0:gr64 = MOV64rm $rip, 1, $noreg, @x, $noreg :: (load (s64))
    %1:gr64 = ADD64mr_ND $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0, implicit-def dead $eflags :: (load (s64) from got)
    %2:gr32 = MOV32rm killed %1, 1, $noreg, 0, $fs :: (load (s32))
    $eax = COPY %2
    RET 0, $eax

# CHECK: name: add64mr_nd
# APXREL: %1:gr64 = ADD64mr_ND $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, %0, implicit-def dead $eflags :: (load (s64) from got)
# NOAPXREL: %3:gr64_norex2 = COPY %0
# NOAPXREL: %1:gr64_norex2 = ADD64rm %3, $rip, 1, $noreg, target-flags(x86-gottpoff) @i, $noreg, implicit-def dead $eflags
...