Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / arm-thumb-interwork-thunk-v5.s
blob4722cd4e0204dfa464463c97624f0a3936d701c4
1 // REQUIRES: arm
2 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv5-none-linux-gnueabi %s -o %t
3 // RUN: ld.lld %t -o %t2
4 // RUN: llvm-objdump --no-print-imm-hex -d %t2 --triple=armv5-none-linux-gnueabi | FileCheck %s
5 // RUN: ld.lld %t -o %t3 --shared
6 // RUN: llvm-objdump --no-print-imm-hex -d %t3 --triple=armv5-none-linux-gnueabi | FileCheck --check-prefix=CHECK-PI %s
8 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv5eb-none-linux-gnueabi %s -o %t
9 // RUN: ld.lld %t -o %t2
10 // RUN: llvm-objdump --no-print-imm-hex -d %t2 --triple=armv5eb-none-linux-gnueabi | FileCheck --check-prefix=CHECK-EB %s
11 // RUN: ld.lld %t -o %t3 --shared
12 // RUN: llvm-objdump --no-print-imm-hex -d %t3 --triple=armv5eb-none-linux-gnueabi | FileCheck --check-prefix=CHECK-EB-PI %s
14 // Test ARM Thumb Interworking on older Arm architectures using Thunks that do
15 // not use MOVT/MOVW instructions.
16 // For pure interworking (not considering range extension) there is only the
17 // case of an Arm B to a Thumb Symbol to consider as in older Arm architectures
18 // there is no Thumb B.w that we can intercept with a Thunk and we still assume
19 // support for the blx instruction for Thumb BL and BLX to an Arm symbol.
20 .arm
21 .text
22 .syntax unified
23 .cpu arm10tdmi
25 .text
26 .globl _start
27 .type _start, %function
28 .balign 0x1000
29 _start:
30 b thumb_func
31 bl thumb_func
32 blx thumb_func
33 bx lr
35 // CHECK: <_start>:
36 // CHECK-NEXT: 21000: ea000003 b 0x21014 <__ARMv5LongLdrPcThunk_thumb_func>
37 // CHECK-NEXT: 21004: fa000001 blx 0x21010 <thumb_func>
38 // CHECK-NEXT: 21008: fa000000 blx 0x21010 <thumb_func>
39 // CHECK-NEXT: 2100c: e12fff1e bx lr
41 // CHECK: <thumb_func>:
42 // CHECK-NEXT: 21010: 4770 bx lr
44 // CHECK: <__ARMv5LongLdrPcThunk_thumb_func>:
45 // CHECK-NEXT: 21014: e51ff004 ldr pc, [pc, #-4]
46 // CHECK-NEXT: 21018: 11 10 02 00 .word 0x00021011
48 // CHECK-EB: <_start>:
49 // CHECK-EB-NEXT: 21000: ea000003 b 0x21014 <__ARMv5LongLdrPcThunk_thumb_func>
50 // CHECK-EB-NEXT: 21004: fa000001 blx 0x21010 <thumb_func>
51 // CHECK-EB-NEXT: 21008: fa000000 blx 0x21010 <thumb_func>
52 // CHECK-EB-NEXT: 2100c: e12fff1e bx lr
54 // CHECK-EB: <thumb_func>:
55 // CHECK-EB-NEXT: 21010: 4770 bx lr
57 // CHECK-EB: <__ARMv5LongLdrPcThunk_thumb_func>:
58 // CHECK-EB-NEXT: 21014: e51ff004 ldr pc, [pc, #-4]
59 // CHECK-EB-NEXT: 21018: 00 02 10 11 .word 0x00021011
61 // CHECK-PI: <_start>:
62 // CHECK-PI-NEXT: 11000: ea000003 b 0x11014 <__ARMv4PILongBXThunk_thumb_func>
63 // CHECK-PI-NEXT: 11004: fa000001 blx 0x11010 <thumb_func>
64 // CHECK-PI-NEXT: 11008: fa000000 blx 0x11010 <thumb_func>
65 // CHECK-PI-NEXT: 1100c: e12fff1e bx lr
67 // CHECK-PI: <thumb_func>:
68 // CHECK-PI-NEXT: 11010: 4770 bx lr
70 // CHECK-PI: <__ARMv4PILongBXThunk_thumb_func>:
71 // CHECK-PI-NEXT: 11014: e59fc004 ldr r12, [pc, #4]
72 // CHECK-PI-NEXT: 11018: e08fc00c add r12, pc, r12
73 // CHECK-PI-NEXT: 1101c: e12fff1c bx r12
74 // CHECK-PI-NEXT: 11020: f1 ff ff ff .word 0xfffffff1
76 // CHECK-EB-PI: <_start>:
77 // CHECK-EB-PI-NEXT: 11000: ea000003 b 0x11014 <__ARMv4PILongBXThunk_thumb_func>
78 // CHECK-EB-PI-NEXT: 11004: fa000001 blx 0x11010 <thumb_func>
79 // CHECK-EB-PI-NEXT: 11008: fa000000 blx 0x11010 <thumb_func>
80 // CHECK-EB-PI-NEXT: 1100c: e12fff1e bx lr
82 // CHECK-EB-PI: <thumb_func>:
83 // CHECK-EB-PI-NEXT: 11010: 4770 bx lr
85 // CHECK-EB-PI: <__ARMv4PILongBXThunk_thumb_func>:
86 // CHECK-EB-PI-NEXT: 11014: e59fc004 ldr r12, [pc, #4]
87 // CHECK-EB-PI-NEXT: 11018: e08fc00c add r12, pc, r12
88 // CHECK-EB-PI-NEXT: 1101c: e12fff1c bx r12
89 // CHECK-EB-PI-NEXT: 11020: ff ff ff f1 .word 0xfffffff1
90 .section .text.1, "ax", %progbits
91 .thumb
92 .hidden thumb_func
93 .type thumb_func, %function
94 thumb_func:
95 bx lr