summaryrefslogtreecommitdiff
path: root/test/MC/ARM/ltorg.s
blob: 094329ad3c5588ab273c65fa39cc700109f44083 (plain)
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
@ This test has a partner (ltorg-darwin.s) that contains matching
@ tests for the .ltorg on darwin targets. We need separate files
@ because the syntax for switching sections and temporary labels differs
@ between darwin and linux. Any tests added here should have a matching
@ test added there.

@RUN: llvm-mc -triple   armv7-unknown-linux-gnueabi %s | FileCheck %s
@RUN: llvm-mc -triple thumbv5-unknown-linux-gnueabi %s | FileCheck %s
@RUN: llvm-mc -triple thumbv7-unknown-linux-gnueabi %s | FileCheck %s

@ check that ltorg dumps the constant pool at the current location
.section a,"ax",%progbits
@ CHECK-LABEL: f2:
f2:
  ldr r0, =0x10001
@ CHECK: ldr r0, .Ltmp0
  adds r0, r0, #1
  adds r0, r0, #1
  b f3
.ltorg
@ constant pool
@ CHECK: .align 2
@ CHECK-LABEL: .Ltmp0:
@ CHECK: .long 65537

@ CHECK-LABEL: f3:
f3:
  adds r0, r0, #1
  adds r0, r0, #1

@ check that ltorg clears the constant pool after dumping it
.section b,"ax",%progbits
@ CHECK-LABEL: f4:
f4:
  ldr r0, =0x10002
@ CHECK: ldr r0, .Ltmp1
  adds r0, r0, #1
  adds r0, r0, #1
  b f5
.ltorg
@ constant pool
@ CHECK: .align 2
@ CHECK-LABEL: .Ltmp1:
@ CHECK: .long 65538

@ CHECK-LABEL: f5:
f5:
  adds r0, r0, #1
  adds r0, r0, #1
  ldr r0, =0x10003
@ CHECK: ldr r0, .Ltmp2
  adds r0, r0, #1
  b f6
.ltorg
@ constant pool
@ CHECK: .align 2
@ CHECK-LABEL: .Ltmp2:
@ CHECK: .long 65539

@ CHECK-LABEL: f6:
f6:
  adds r0, r0, #1
  adds r0, r0, #1

@ check that ltorg does not issue an error if there is no constant pool
.section c,"ax",%progbits
@ CHECK-LABEL: f7:
f7:
  adds r0, r0, #1
  b f8
  .ltorg
f8:
  adds r0, r0, #1

@ check that ltorg works for labels
.section d,"ax",%progbits
@ CHECK-LABEL: f9:
f9:
  adds r0, r0, #1
  adds r0, r0, #1
  ldr r0, =bar
@ CHECK: ldr r0, .Ltmp3
  adds r0, r0, #1
  adds r0, r0, #1
  adds r0, r0, #1
  b f10
.ltorg
@ constant pool
@ CHECK: .align 2
@ CHECK-LABEL: .Ltmp3:
@ CHECK: .long bar

@ CHECK-LABEL: f10:
f10:
  adds r0, r0, #1
  adds r0, r0, #1

@ check that use of ltorg does not prevent dumping non-empty constant pools at end of section
.section e,"ax",%progbits
@ CHECK-LABEL: f11:
f11:
  adds r0, r0, #1
  adds r0, r0, #1
  ldr r0, =0x10004
@ CHECK: ldr r0, .Ltmp4
  b f12
  .ltorg
@ constant pool
@ CHECK: .align 2
@ CHECK-LABEL: .Ltmp4:
@ CHECK: .long 65540
@ CHECK-LABEL: f12:
f12:
  adds r0, r0, #1
  ldr r0, =0x10005
@ CHECK: ldr r0, .Ltmp5

.section f,"ax",%progbits
@ CHECK-LABEL: f13
f13:
  adds r0, r0, #1
  adds r0, r0, #1

@ should not have a constant pool at end of section with empty constant pools
@ CHECK-NOT: .section a,"ax",%progbits
@ CHECK-NOT: .section b,"ax",%progbits
@ CHECK-NOT: .section c,"ax",%progbits
@ CHECK-NOT: .section d,"ax",%progbits

@ should have a non-empty constant pool at end of this section
@ CHECK: .section e,"ax",%progbits
@ constant pool
@ CHECK: .align 2
@ CHECK-LABEL: .Ltmp5:
@ CHECK: .long 65541

@ should not have a constant pool at end of section with empty constant pools
@ CHECK-NOT: .section f,"ax",%progbits