summaryrefslogtreecommitdiff
path: root/test/MC/ARM/eh-directive-multiple-offsets.s
diff options
context:
space:
mode:
authorLogan Chien <tzuhsiang.chien@gmail.com>2013-06-09 12:22:30 +0000
committerLogan Chien <tzuhsiang.chien@gmail.com>2013-06-09 12:22:30 +0000
commit18cba562c8016f8095643b5dd8c4b34b294b62dd (patch)
tree5aad10d696d68909871a4743f444591b07007324 /test/MC/ARM/eh-directive-multiple-offsets.s
parent40e071c1eb3a6a57579f80b910ff7323048bbc09 (diff)
downloadllvm-18cba562c8016f8095643b5dd8c4b34b294b62dd.tar.gz
llvm-18cba562c8016f8095643b5dd8c4b34b294b62dd.tar.bz2
llvm-18cba562c8016f8095643b5dd8c4b34b294b62dd.tar.xz
Fix ARM unwind opcode assembler in several cases.
Changes to ARM unwind opcode assembler: * Fix multiple .save or .vsave directives. Besides, the order is preserved now. * For the directives which will generate multiple opcodes, such as ".save {r0-r11}", the order of the unwind opcode is fixed now, i.e. the registers with less encoding value are popped first. * Fix the $sp offset calculation. Now, we can use the .setfp, .pad, .save, and .vsave directives at any order. Changes to test cases: * Add test cases to check the order of multiple opcodes for the .save directive. * Fix the incorrect $sp offset in the test case. The stack pointer offset specified in the test case was incorrect. (Changed test cases: ehabi-mc-section.ll and ehabi-mc.ll) * The opcode to restore $sp are slightly reordered. The behavior are not changed, and the new output is same as the output of GNU as. (Changed test cases: eh-directive-pad.s and eh-directive-setfp.s) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183627 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/ARM/eh-directive-multiple-offsets.s')
-rw-r--r--test/MC/ARM/eh-directive-multiple-offsets.s168
1 files changed, 168 insertions, 0 deletions
diff --git a/test/MC/ARM/eh-directive-multiple-offsets.s b/test/MC/ARM/eh-directive-multiple-offsets.s
new file mode 100644
index 0000000000..6e81f41665
--- /dev/null
+++ b/test/MC/ARM/eh-directive-multiple-offsets.s
@@ -0,0 +1,168 @@
+@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
+@ RUN: | llvm-readobj -s -sd | FileCheck %s
+
+@ Check for different combination of .setfp, .pad, .save and .vsave.
+
+ .syntax unified
+
+@-------------------------------------------------------------------------------
+@ TEST1: Check .pad before .setfp directive.
+@-------------------------------------------------------------------------------
+ .section .TEST1
+ .globl func1
+ .type func1,%function
+ .align 2
+ .fnstart
+func1:
+ .pad #12
+ sub sp, sp, #12
+ .setfp fp, sp, #8
+ add fp, sp, #8
+ sub sp, fp, #8
+ add sp, sp, #12
+ bx lr
+ .personality __gxx_personality_v0
+ .handlerdata
+ .fnend
+
+@ CHECK: Section {
+@ CHECK: Name: .ARM.extab.TEST1
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 B0009B00 |........|
+@ CHECK: )
+@ CHECK: }
+
+
+
+@-------------------------------------------------------------------------------
+@ TEST2: Check .pad after .setfp directive.
+@-------------------------------------------------------------------------------
+ .section .TEST2
+ .globl func2
+ .type func2,%function
+ .align 2
+ .fnstart
+func2:
+ .setfp fp, sp, #8
+ add fp, sp, #8
+ .pad #12
+ sub sp, sp, #12
+ add sp, sp, #12
+ sub sp, fp, #8
+ bx lr
+ .personality __gxx_personality_v0
+ .handlerdata
+ .fnend
+
+@ CHECK: Section {
+@ CHECK: Name: .ARM.extab.TEST2
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 B0419B00 |.....A..|
+@ CHECK: )
+@ CHECK: }
+
+
+
+@-------------------------------------------------------------------------------
+@ TEST3: Check .setfp, .pad, .setfp directive.
+@-------------------------------------------------------------------------------
+ .section .TEST3
+ .globl func3
+ .type func3,%function
+ .align 2
+ .fnstart
+func3:
+ @ prologue:
+ .setfp fp, sp, #4
+ add fp, sp, #4
+ .pad #8
+ sub sp, sp, #8
+ .setfp fp, sp, #4
+ add fp, sp, #4
+
+ @ epilogue:
+ add sp, fp, #4
+ bx lr
+ .personality __gxx_personality_v0
+ .handlerdata
+ .fnend
+
+@ CHECK: Section {
+@ CHECK: Name: .ARM.extab.TEST3
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 B0009B00 |........|
+@ CHECK: )
+@ CHECK: }
+
+
+
+@-------------------------------------------------------------------------------
+@ TEST4: Check ".setfp fp, sp" and ".setfp fp, fp" directive.
+@-------------------------------------------------------------------------------
+ .section .TEST4
+ .globl func4
+ .type func4,%function
+ .align 2
+ .fnstart
+func4:
+ @ prologue:
+ .setfp fp, sp, #8
+ add fp, sp, #8
+ .setfp fp, fp, #8
+ add fp, fp, #8
+
+ @ epilogue:
+ sub sp, fp, #16
+ bx lr
+ .personality __gxx_personality_v0
+ .handlerdata
+ .fnend
+
+@ CHECK: Section {
+@ CHECK: Name: .ARM.extab.TEST4
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 B0439B00 |.....C..|
+@ CHECK: )
+@ CHECK: }
+
+
+
+@-------------------------------------------------------------------------------
+@ TEST5: Check .setfp, .save, .setfp directive.
+@-------------------------------------------------------------------------------
+ .section .TEST5
+ .globl func5
+ .type func5,%function
+ .align 2
+ .fnstart
+func5:
+ @ prologue:
+ .setfp fp, sp, #16
+ add fp, sp, #16
+ .save {r4, r5, r6, r7, r8}
+ push {r4, r5, r6, r7, r8}
+ .pad #8
+ add sp, sp, #8
+ .pad #8
+ sub sp, sp, #8
+ .save {r9, r10}
+ push {r9, r10}
+ .setfp fp, sp, #24
+ add fp, sp, #24
+
+ @ epilogue:
+ sub sp, fp, #24
+ pop {r9, r10}
+ add sp, sp, #16
+ pop {r4, r5, r6, r7, r8}
+ bx lr
+ .personality __gxx_personality_v0
+ .handlerdata
+ .fnend
+
+@ CHECK: Section {
+@ CHECK: Name: .ARM.extab.TEST5
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 80459B01 B0A40360 |.....E.....`|
+@ CHECK: )
+@ CHECK: }