ppc64-toc-relax-jumptable.s
1.79 KB
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
# REQUIRES: ppc
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readelf -S %t | FileCheck --check-prefixes=SECTIONS %s
# RUN: llvm-readelf -x .toc %t | FileCheck --check-prefixes=HEX-LE %s
# RUN: llvm-objdump -d %t | FileCheck --check-prefixes=CHECK %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t
# RUN: llvm-readelf -S %t | FileCheck --check-prefixes=SECTIONS %s
# RUN: llvm-readelf -x .toc %t | FileCheck --check-prefixes=HEX-BE %s
# RUN: llvm-objdump -d %t | FileCheck --check-prefixes=CHECK %s
# .LJT is a local symbol (non-preemptable).
# Test we can perform the toc-indirect to toc-relative relaxation.
# SECTIONS: .rodata PROGBITS 00000000100001c8
# HEX-LE: section '.toc':
# HEX-LE-NEXT: 10020228 c8010010 00000000
# HEX-BE: section '.toc':
# HEX-BE-NEXT: 10020228 00000000 100001c8
# CHECK-LABEL: _start
# CHECK: clrldi 3, 3, 62
# CHECK-NEXT: addis 4, 2, -3
# CHECK-NEXT: addi 4, 4, 32680
# CHECK-NEXT: sldi 3, 3, 2
.text
.global _start
.type _start, @function
_start:
.Lstart_gep:
addis 2, 12, .TOC.-.Lstart_gep@ha
addi 2, 2, .TOC.-.Lstart_gep@l
.Lstart_lep:
.localentry _start, .Lstart_lep-.Lstart_gep
rldicl 3, 3, 0, 62
addis 4, 2, .LJTI_TE@toc@ha
ld 4, .LJTI_TE@toc@l(4)
sldi 3, 3, 2
lwax 3, 3, 4
add 3, 3, 4
mtctr 3
bctr
.LBB1:
li 3, 0
blr
.LBB2:
li 3, 10
blr
.LBB3:
li 3, 55
blr
.LBB4:
li 3, 255
blr
.section .rodata,"a",@progbits
.p2align 2
.LJT:
.long .LBB1-.LJT
.long .LBB2-.LJT
.long .LBB3-.LJT
.long .LBB4-.LJT
.section .toc,"aw",@progbits
# TOC entry for the jumptable address.
.LJTI_TE:
.tc .LJT[TC],.LJT