136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ This test has a partner (ltorg-darwin.s) that contains matching
236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ tests for the .ltorg on darwin targets. We need separate files
336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ because the syntax for switching sections and temporary labels differs
436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ between darwin and linux. Any tests added here should have a matching
536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ test added there.
636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@RUN: llvm-mc -triple   armv7-unknown-linux-gnueabi %s | FileCheck %s
836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@RUN: llvm-mc -triple thumbv5-unknown-linux-gnueabi %s | FileCheck %s
936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@RUN: llvm-mc -triple thumbv7-unknown-linux-gnueabi %s | FileCheck %s
1036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
1136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ check that ltorg dumps the constant pool at the current location
1236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.section a,"ax",%progbits
1336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f2:
1436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf2:
15de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  ldr r0, =0x10002
1636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: ldr r0, .Ltmp[[TMP0:[0-9+]]]
1736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
1836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
1936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  b f3
2036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.ltorg
2136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ constant pool
22de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .p2align 2
2336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: .Ltmp[[TMP0]]
24de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .long 65538
2536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
2636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f3:
2736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf3:
2836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
2936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
3036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
3136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ check that ltorg clears the constant pool after dumping it
3236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.section b,"ax",%progbits
3336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f4:
3436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf4:
35de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  ldr r0, =0x10003
3636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: ldr r0, .Ltmp[[TMP1:[0-9+]]]
3736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
3836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
3936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  b f5
4036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.ltorg
4136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ constant pool
42de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .p2align 2
4336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: .Ltmp[[TMP1]]
44de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .long 65539
4536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
4636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f5:
4736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf5:
4836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
4936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
50de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  ldr r0, =0x10004
5136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: ldr r0, .Ltmp[[TMP2:[0-9+]]]
5236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
5336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  b f6
5436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.ltorg
5536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ constant pool
56de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .p2align 2
5736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: .Ltmp[[TMP2]]
58de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .long 65540
5936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
6036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f6:
6136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf6:
6236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
6336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
6436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
6536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ check that ltorg does not issue an error if there is no constant pool
6636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.section c,"ax",%progbits
6736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f7:
6836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf7:
6936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
7036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  b f8
7136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  .ltorg
7236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf8:
7336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
7436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
7536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ check that ltorg works for labels
7636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.section d,"ax",%progbits
7736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f9:
7836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf9:
7936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
8036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
8136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  ldr r0, =bar
8236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: ldr r0, .Ltmp[[TMP3:[0-9+]]]
8336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
8436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
8536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
8636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  b f10
8736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.ltorg
8836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ constant pool
89de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .p2align 2
9036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: .Ltmp[[TMP3]]
9136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: .long bar
9236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
9336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f10:
9436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf10:
9536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
9636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
9736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
9836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ check that use of ltorg does not prevent dumping non-empty constant pools at end of section
9936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.section e,"ax",%progbits
10036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f11:
10136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf11:
10236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
10336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
104de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  ldr r0, =0x10005
10536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: ldr r0, .Ltmp[[TMP4:[0-9+]]]
10636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  b f12
10736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  .ltorg
10836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ constant pool
109de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .p2align 2
11036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: .Ltmp[[TMP4]]
111de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .long 65541
11236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f12:
11336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf12:
11436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
115de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar  ldr r0, =0x10006
11636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: ldr r0, .Ltmp[[TMP5:[0-9+]]]
11736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
11836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines.section f,"ax",%progbits
11936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-LABEL: f13
12036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hinesf13:
12136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
12236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  adds r0, r0, #1
12336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
12436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ should not have a constant pool at end of section with empty constant pools
12536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-NOT: .section a,"ax",%progbits
12636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-NOT: .section b,"ax",%progbits
12736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-NOT: .section c,"ax",%progbits
12836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-NOT: .section d,"ax",%progbits
12936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
13036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ should have a non-empty constant pool at end of this section
13136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: .section e,"ax",%progbits
13236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ constant pool
133de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .p2align 2
13436b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK: .Ltmp[[TMP5]]
135de2d8694e25a814696358e95141f4b1aa4d8847ePirama Arumuga Nainar@ CHECK: .long 65542
13636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines
13736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ should not have a constant pool at end of section with empty constant pools
13836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines@ CHECK-NOT: .section f,"ax",%progbits
139