[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / MC / ARM / eh-compact-pr0.s
blob0bb246b04a0497346ac4f2fc2d9fc4040c683ee5
1 @ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
2 @ RUN: | llvm-readobj -S --sd --sr - > %t
3 @ RUN: FileCheck %s < %t
4 @ RUN: FileCheck --check-prefixes=RELOC,RELOC-NOAND %s < %t
5 @ RUN: llvm-mc %s -triple=armv7-unknown-linux-androideabi -filetype=obj -o - \
6 @ RUN: | llvm-readobj -S --sd --sr - | FileCheck --check-prefix=RELOC %s
8 @ Check the compact pr0 model
10 .syntax unified
12 .section .TEST1
13 .globl func1
14 .align 2
15 .type func1,%function
16 func1:
17 .fnstart
18 .save {r11, lr}
19 push {r11, lr}
20 .setfp r11, sp
21 mov r11, sp
22 pop {r11, lr}
23 mov pc, lr
24 .fnend
26 .section .TEST2
27 .globl func2
28 .align 2
29 .type func2,%function
30 func2:
31 .fnstart
32 .save {r11, lr}
33 push {r11, lr}
34 pop {r11, pc}
35 .fnend
39 @-------------------------------------------------------------------------------
40 @ Check .TEST1 section
41 @-------------------------------------------------------------------------------
42 @ CHECK: Sections [
43 @ CHECK: Section {
44 @ CHECK: Name: .TEST1
45 @ CHECK: SectionData (
46 @ CHECK: 0000: 00482DE9 0DB0A0E1 0048BDE8 0EF0A0E1 |.H-......H......|
47 @ CHECK: )
48 @ CHECK: }
51 @-------------------------------------------------------------------------------
52 @ Check .ARM.exidx.TEST1 section
53 @-------------------------------------------------------------------------------
54 @ CHECK: Section {
55 @ CHECK: Name: .ARM.exidx.TEST1
56 @-------------------------------------------------------------------------------
57 @ 0x80 = Compact model 0, personality routine: __aeabi_unwind_cpp_pr0
58 @ 0x9B = $sp can be found in $r11
59 @ 0x8480 = pop {r11, r14}
60 @-------------------------------------------------------------------------------
61 @ CHECK: SectionData (
62 @ CHECK: 0000: 00000000 80849B80 |........|
63 @ CHECK: )
64 @ CHECK: }
65 @-------------------------------------------------------------------------------
66 @ The first word should be relocated to .TEST1 section. Besides, on non-Android
67 @ there is another relocation entry for __aeabi_unwind_cpp_pr0, so that the
68 @ linker will keep __aeabi_unwind_cpp_pr0.
69 @-------------------------------------------------------------------------------
70 @ RELOC: Section {
71 @ RELOC: Name: .rel.ARM.exidx.TEST1
72 @ RELOC: Relocations [
73 @ RELOC-NOAND-NEXT: 0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0
74 @ RELOC-NEXT: 0x0 R_ARM_PREL31 .TEST1
75 @ RELOC-NEXT: ]
77 @-------------------------------------------------------------------------------
78 @ Check .TEST2 section
79 @-------------------------------------------------------------------------------
80 @ CHECK: Section {
81 @ CHECK: Name: .TEST2
82 @ CHECK: SectionData (
83 @ CHECK: 0000: 00482DE9 0088BDE8 |.H-.....|
84 @ CHECK: )
85 @ CHECK: }
86 @-------------------------------------------------------------------------------
87 @ Check .ARM.exidx.TEST1 section
88 @-------------------------------------------------------------------------------
89 @ CHECK: Section {
90 @ CHECK: Name: .ARM.exidx.TEST2
91 @-------------------------------------------------------------------------------
92 @ 0x80 = Compact model 0, personality routine: __aeabi_unwind_cpp_pr0
93 @ 0x8480 = pop {r11, r14}
94 @ 0xB0 = finish
95 @-------------------------------------------------------------------------------
96 @ CHECK: SectionData (
97 @ CHECK: 0000: 00000000 B0808480 |........|
98 @ CHECK: )
99 @ CHECK: }
100 @-------------------------------------------------------------------------------
101 @ The first word should be relocated to .TEST2 section. Besides, on non-Android
102 @ there is another relocation entry for __aeabi_unwind_cpp_pr0, so that the
103 @ linker will keep __aeabi_unwind_cpp_pr0.
104 @-------------------------------------------------------------------------------
105 @ RELOC: Section {
106 @ RELOC: Name: .rel.ARM.exidx.TEST2
107 @ RELOC: Relocations [
108 @ RELOC-NOAND-NEXT: 0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0
109 @ RELOC-NEXT: 0x0 R_ARM_PREL31 .TEST2
110 @ RELOC-NEXT: ]