summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Chien <tzuhsiang.chien@gmail.com>2013-06-09 12:36:57 +0000
committerLogan Chien <tzuhsiang.chien@gmail.com>2013-06-09 12:36:57 +0000
commitc8ecf5308266acb7b11ce33be0a1ce434858b9ad (patch)
treebb007c6d6c7157085a3778fc32ce412c0b4a57af
parent18cba562c8016f8095643b5dd8c4b34b294b62dd (diff)
downloadllvm-c8ecf5308266acb7b11ce33be0a1ce434858b9ad.tar.gz
llvm-c8ecf5308266acb7b11ce33be0a1ce434858b9ad.tar.bz2
llvm-c8ecf5308266acb7b11ce33be0a1ce434858b9ad.tar.xz
Refine the ARM EHABI test cases.
Since we have ARM unwind directive parser and assembler, we can check the correctness in two stages: 1. From LLVM assembly (.ll) to ARM assembly (.s) 2. From ARM assembly (.s) to ELF object file (.o) We already have several "*.s to *.o" test cases. This CL adds some "*.ll to *.s" test cases and removes the redundant "*.ll to *.o" test cases. New test cases to check "*.ll to *.s" code generator: - ehabi.ll: Check the correctness of the generated unwind directives. - section-name.ll: Check the section name of functions. Removed test cases: - ehabi-mc-cantunwind.ll (Covered by ehabi-cantunwind.ll, and eh-directive-cantunwind.s) - ehabi-mc-compact-pr0.ll (Covered by ehabi.ll, eh-compact-pr0.s, eh-directive-save.s, and eh-directive-setfp.s) - ehabi-mc-compact-pr1.ll (Covered by ehabi.ll, eh-compact-pr1.s, eh-directive-save.s, and eh-directive-setfp.s) - ehabi-mc.ll (Covered by ehabi.ll, and eh-directive-integrated-test.s) - ehabi-mc-section-group.ll (Covered by section-name.ll, and eh-directive-section-comdat.s) - ehabi-mc-section.ll (Covered by section-name.ll, and eh-directive-section.s) - ehabi-mc-sh_link.ll (Covered by eh-directive-text-section.s, and eh-directive-section.s) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183628 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGen/ARM/ehabi-mc-cantunwind.ll14
-rw-r--r--test/CodeGen/ARM/ehabi-mc-compact-pr0.ll49
-rw-r--r--test/CodeGen/ARM/ehabi-mc-compact-pr1.ll62
-rw-r--r--test/CodeGen/ARM/ehabi-mc-section-group.ll88
-rw-r--r--test/CodeGen/ARM/ehabi-mc-section.ll71
-rw-r--r--test/CodeGen/ARM/ehabi-mc-sh_link.ll58
-rw-r--r--test/CodeGen/ARM/ehabi-mc.ll71
-rw-r--r--test/CodeGen/ARM/ehabi.ll298
-rw-r--r--test/CodeGen/ARM/section-name.ll25
9 files changed, 323 insertions, 413 deletions
diff --git a/test/CodeGen/ARM/ehabi-mc-cantunwind.ll b/test/CodeGen/ARM/ehabi-mc-cantunwind.ll
deleted file mode 100644
index 698d76e565..0000000000
--- a/test/CodeGen/ARM/ehabi-mc-cantunwind.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: llc -mtriple arm-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s
-
-define void @test() nounwind {
-entry:
- ret void
-}
-
-; CHECK: section .text
-; CHECK: section .ARM.exidx
-; CHECK-NEXT: 0000 00000000 01000000
diff --git a/test/CodeGen/ARM/ehabi-mc-compact-pr0.ll b/test/CodeGen/ARM/ehabi-mc-compact-pr0.ll
deleted file mode 100644
index 637a989240..0000000000
--- a/test/CodeGen/ARM/ehabi-mc-compact-pr0.ll
+++ /dev/null
@@ -1,49 +0,0 @@
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -disable-fp-elim -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s --check-prefix=CHECK
-
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s --check-prefix=CHECK-FP-ELIM
-
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -disable-fp-elim -filetype=obj -o - %s \
-; RUN: | llvm-objdump -r - \
-; RUN: | FileCheck %s --check-prefix=CHECK-RELOC
-
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-objdump -r - \
-; RUN: | FileCheck %s --check-prefix=CHECK-RELOC
-
-define void @_Z4testv() {
-entry:
- tail call void @_Z15throw_exceptionv()
- ret void
-}
-
-declare void @_Z15throw_exceptionv()
-
-; CHECK-NOT: section .ARM.extab
-; CHECK: section .text
-; CHECK-NOT: section .ARM.extab
-; CHECK: section .ARM.exidx
-; CHECK-NEXT: 0000 00000000 80849b80
-; CHECK-NOT: section .ARM.extab
-
-; CHECK-FP-ELIM-NOT: section .ARM.extab
-; CHECK-FP-ELIM: section .text
-; CHECK-FP-ELIM-NOT: section .ARM.extab
-; CHECK-FP-ELIM: section .ARM.exidx
-; CHECK-FP-ELIM-NEXT: 0000 00000000 b0808480
-; CHECK-FP-ELIM-NOT: section .ARM.extab
-
-; CHECK-RELOC: RELOCATION RECORDS FOR [.rel.ARM.exidx]
-; CHECK-RELOC-NEXT: 0 R_ARM_PREL31 .text
-; CHECK-RELOC-NEXT: 0 R_ARM_NONE __aeabi_unwind_cpp_pr0
diff --git a/test/CodeGen/ARM/ehabi-mc-compact-pr1.ll b/test/CodeGen/ARM/ehabi-mc-compact-pr1.ll
deleted file mode 100644
index 5a54889d6a..0000000000
--- a/test/CodeGen/ARM/ehabi-mc-compact-pr1.ll
+++ /dev/null
@@ -1,62 +0,0 @@
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -disable-fp-elim -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s --check-prefix=CHECK
-
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s --check-prefix=CHECK-FP-ELIM
-
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -disable-fp-elim -filetype=obj -o - %s \
-; RUN: | llvm-objdump -r - \
-; RUN: | FileCheck %s --check-prefix=CHECK-RELOC
-
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-objdump -r - \
-; RUN: | FileCheck %s --check-prefix=CHECK-FP-ELIM-RELOC
-
-define i32 @_Z3addiiiiiiii(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h) {
-entry:
- %add = add nsw i32 %b, %a
- %add1 = add nsw i32 %add, %c
- %add2 = add nsw i32 %add1, %d
- tail call void @_Z15throw_exceptioni(i32 %add2)
- %add3 = add nsw i32 %f, %e
- %add4 = add nsw i32 %add3, %g
- %add5 = add nsw i32 %add4, %h
- tail call void @_Z15throw_exceptioni(i32 %add5)
- %add6 = add nsw i32 %add5, %add2
- ret i32 %add6
-}
-
-declare void @_Z15throw_exceptioni(i32)
-
-; CHECK-NOT: section .ARM.extab
-; CHECK: section .text
-; CHECK: section .ARM.extab
-; CHECK-NEXT: 0000 419b0181 b0b08384
-; CHECK: section .ARM.exidx
-; CHECK-NEXT: 0000 00000000 00000000
-; CHECK-NOT: section .ARM.extab
-
-; CHECK-FP-ELIM-NOT: section .ARM.extab
-; CHECK-FP-ELIM: section .text
-; CHECK-FP-ELIM-NOT: section .ARM.extab
-; CHECK-FP-ELIM: section .ARM.exidx
-; CHECK-FP-ELIM-NEXT: 0000 00000000 b0838480
-; CHECK-FP-ELIM-NOT: section .ARM.extab
-
-; CHECK-RELOC: RELOCATION RECORDS FOR [.rel.ARM.exidx]
-; CHECK-RELOC-NEXT: 0 R_ARM_PREL31 .text
-; CHECK-RELOC-NEXT: 0 R_ARM_NONE __aeabi_unwind_cpp_pr1
-
-; CHECK-FP-ELIM-RELOC: RELOCATION RECORDS FOR [.rel.ARM.exidx]
-; CHECK-FP-ELIM-RELOC-NEXT: 0 R_ARM_PREL31 .text
-; CHECK-FP-ELIM-RELOC-NEXT: 0 R_ARM_NONE __aeabi_unwind_cpp_pr0
diff --git a/test/CodeGen/ARM/ehabi-mc-section-group.ll b/test/CodeGen/ARM/ehabi-mc-section-group.ll
deleted file mode 100644
index 616aa1ba46..0000000000
--- a/test/CodeGen/ARM/ehabi-mc-section-group.ll
+++ /dev/null
@@ -1,88 +0,0 @@
-; Test section group of the function with linkonce_odr
-
-; The instantiation of C++ function template will come with linkonce_odr,
-; which indicates that the linker can remove the duplicated instantiation.
-; However, to make this feature work, we have to group the section properly.
-; .text, .ARM.extab, and .ARM.exidx should be grouped together.
-
-; RUN: llc -mtriple arm-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-readobj -s -sd \
-; RUN: | FileCheck %s
-
-target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64"
-target triple = "armv4t--linux-gnueabi"
-
-define void @_Z11instantiatev() {
-entry:
- tail call void @_Z4testIidEvT_S0_S0_S0_S0_T0_S1_S1_S1_S1_(i32 1, i32 2, i32 3, i32 4, i32 5, double 1.000000e-01, double 2.000000e-01, double 3.000000e-01, double 4.000000e-01, double 5.000000e-01)
- ret void
-}
-
-define linkonce_odr void @_Z4testIidEvT_S0_S0_S0_S0_T0_S1_S1_S1_S1_(i32 %u1, i32 %u2, i32 %u3, i32 %u4, i32 %u5, double %v1, double %v2, double %v3, double %v4, double %v5) {
-entry:
- invoke void @_Z5printiiiii(i32 %u1, i32 %u2, i32 %u3, i32 %u4, i32 %u5)
- to label %try.cont unwind label %lpad
-
-lpad: ; preds = %entry
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- catch i8* null
- %1 = extractvalue { i8*, i32 } %0, 0
- %2 = tail call i8* @__cxa_begin_catch(i8* %1) nounwind
- invoke void @_Z5printddddd(double %v1, double %v2, double %v3, double %v4, double %v5)
- to label %invoke.cont2 unwind label %lpad1
-
-invoke.cont2: ; preds = %lpad
- tail call void @__cxa_end_catch()
- br label %try.cont
-
-try.cont: ; preds = %entry, %invoke.cont2
- ret void
-
-lpad1: ; preds = %lpad
- %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- cleanup
- invoke void @__cxa_end_catch()
- to label %eh.resume unwind label %terminate.lpad
-
-eh.resume: ; preds = %lpad1
- resume { i8*, i32 } %3
-
-terminate.lpad: ; preds = %lpad1
- %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- catch i8* null
- tail call void @_ZSt9terminatev() noreturn nounwind
- unreachable
-}
-
-declare void @_Z5printiiiii(i32, i32, i32, i32, i32)
-
-declare i32 @__gxx_personality_v0(...)
-
-declare i8* @__cxa_begin_catch(i8*)
-
-declare void @_Z5printddddd(double, double, double, double, double)
-
-declare void @__cxa_end_catch()
-
-declare void @_ZSt9terminatev()
-
-; CHECK: Section {
-; CHECK: Index: 1
-; CHECK-NEXT: Name: .group (47)
-; CHECK: SectionData (
-; CHECK-NEXT: 0000: 01000000 09000000 0B000000 0D000000
-; CHECK-NEXT: )
-
-; CHECK: Section {
-; CHECK: Index: 9
-; CHECK-NEXT: Name: .text._Z4testIidEvT_S0_S0_S0_S0_T0_S1_S1_S1_S1_ (214)
-
-; CHECK: Section {
-; CHECK: Index: 11
-; CHECK-NEXT: Name: .ARM.extab.text._Z4testIidEvT_S0_S0_S0_S0_T0_S1_S1_S1_S1_ (204)
-
-; CHECK: Section {
-; CHECK: Index: 13
-; CHECK-NEXT: Name: .ARM.exidx.text._Z4testIidEvT_S0_S0_S0_S0_T0_S1_S1_S1_S1_ (90)
diff --git a/test/CodeGen/ARM/ehabi-mc-section.ll b/test/CodeGen/ARM/ehabi-mc-section.ll
deleted file mode 100644
index 51ae25a3be..0000000000
--- a/test/CodeGen/ARM/ehabi-mc-section.ll
+++ /dev/null
@@ -1,71 +0,0 @@
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -disable-fp-elim -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s --check-prefix=CHECK
-
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s --check-prefix=CHECK-FP-ELIM
-
-define void @_Z4testiiiiiddddd(i32 %u1, i32 %u2, i32 %u3, i32 %u4, i32 %u5, double %v1, double %v2, double %v3, double %v4, double %v5) section ".test_section" {
-entry:
- invoke void @_Z5printiiiii(i32 %u1, i32 %u2, i32 %u3, i32 %u4, i32 %u5)
- to label %try.cont unwind label %lpad
-
-lpad: ; preds = %entry
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- catch i8* null
- %1 = extractvalue { i8*, i32 } %0, 0
- %2 = tail call i8* @__cxa_begin_catch(i8* %1) nounwind
- invoke void @_Z5printddddd(double %v1, double %v2, double %v3, double %v4, double %v5)
- to label %invoke.cont2 unwind label %lpad1
-
-invoke.cont2: ; preds = %lpad
- tail call void @__cxa_end_catch()
- br label %try.cont
-
-try.cont: ; preds = %entry, %invoke.cont2
- ret void
-
-lpad1: ; preds = %lpad
- %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- cleanup
- invoke void @__cxa_end_catch()
- to label %eh.resume unwind label %terminate.lpad
-
-eh.resume: ; preds = %lpad1
- resume { i8*, i32 } %3
-
-terminate.lpad: ; preds = %lpad1
- %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- catch i8* null
- tail call void @_ZSt9terminatev() noreturn nounwind
- unreachable
-}
-
-declare void @_Z5printiiiii(i32, i32, i32, i32, i32)
-
-declare i32 @__gxx_personality_v0(...)
-
-declare i8* @__cxa_begin_catch(i8*)
-
-declare void @_Z5printddddd(double, double, double, double, double)
-
-declare void @__cxa_end_catch()
-
-declare void @_ZSt9terminatev()
-
-; CHECK: section .test_section
-; CHECK: section .ARM.extab.test_section
-; CHECK-NEXT: 0000 00000000 c94a9b01 b0818484
-; CHECK: section .ARM.exidx.test_section
-; CHECK-NEXT: 0000 00000000 00000000
-
-; CHECK-FP-ELIM: section .test_section
-; CHECK-FP-ELIM: section .ARM.extab.test_section
-; CHECK-FP-ELIM-NEXT: 0000 00000000 84c90501 b0b0b0a8
-; CHECK-FP-ELIM: section .ARM.exidx.test_section
-; CHECK-FP-ELIM-NEXT: 0000 00000000 00000000
diff --git a/test/CodeGen/ARM/ehabi-mc-sh_link.ll b/test/CodeGen/ARM/ehabi-mc-sh_link.ll
deleted file mode 100644
index ac0a0fc930..0000000000
--- a/test/CodeGen/ARM/ehabi-mc-sh_link.ll
+++ /dev/null
@@ -1,58 +0,0 @@
-; Test the sh_link in Elf32_Shdr.
-
-; The .ARM.exidx section should be linked with corresponding text section.
-; The sh_link in Elf32_Shdr should be filled with the section index of
-; the text section.
-
-; RUN: llc -mtriple arm-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-readobj -s \
-; RUN: | FileCheck %s
-
-define void @test1() nounwind {
-entry:
- ret void
-}
-
-define void @test2() nounwind section ".test_section" {
-entry:
- ret void
-}
-
-; CHECK: Sections [
-; CHECK: Section {
-; CHECK: Index: 1
-; CHECK-NEXT: Name: .text (16)
-
-; CHECK: Section {
-; CHECK: Name: .ARM.exidx (5)
-; CHECK-NEXT: Type: SHT_ARM_EXIDX
-; CHECK-NEXT: Flags [ (0x82)
-; CHECK-NEXT: SHF_ALLOC
-; CHECK-NEXT: SHF_LINK_ORDER
-; CHECK-NEXT: ]
-; CHECK-NEXT: Address: 0x0
-; CHECK-NEXT: Offset: 0x5C
-; CHECK-NEXT: Size: 8
-; CHECK-NEXT: Link: 1
-; CHECK-NEXT: Info: 0
-; CHECK-NEXT: AddressAlignment: 4
-
-; CHECK: Section {
-; CHECK: Index: 7
-; CHECK-NEXT: Name: .test_section (57)
-
-; CHECK: Section {
-; CHECK: Name: .ARM.exidx.test_section (47)
-; CHECK-NEXT: Type: SHT_ARM_EXIDX
-; CHECK-NEXT: Flags [ (0x82)
-; CHECK-NEXT: SHF_ALLOC
-; CHECK-NEXT: SHF_LINK_ORDER
-; CHECK-NEXT: ]
-; CHECK-NEXT: Address: 0x0
-; CHECK-NEXT: Offset: 0x68
-; CHECK-NEXT: Size: 8
-; CHECK-NEXT: Link: 7
-; CHECK-NEXT: Info: 0
-; CHECK-NEXT: AddressAlignment: 4
diff --git a/test/CodeGen/ARM/ehabi-mc.ll b/test/CodeGen/ARM/ehabi-mc.ll
deleted file mode 100644
index b0fc81e5f9..0000000000
--- a/test/CodeGen/ARM/ehabi-mc.ll
+++ /dev/null
@@ -1,71 +0,0 @@
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -disable-fp-elim -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s --check-prefix=CHECK
-
-; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
-; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
-; RUN: -filetype=obj -o - %s \
-; RUN: | llvm-objdump -s - \
-; RUN: | FileCheck %s --check-prefix=CHECK-FP-ELIM
-
-define void @_Z4testiiiiiddddd(i32 %u1, i32 %u2, i32 %u3, i32 %u4, i32 %u5, double %v1, double %v2, double %v3, double %v4, double %v5) {
-entry:
- invoke void @_Z5printiiiii(i32 %u1, i32 %u2, i32 %u3, i32 %u4, i32 %u5)
- to label %try.cont unwind label %lpad
-
-lpad: ; preds = %entry
- %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- catch i8* null
- %1 = extractvalue { i8*, i32 } %0, 0
- %2 = tail call i8* @__cxa_begin_catch(i8* %1) nounwind
- invoke void @_Z5printddddd(double %v1, double %v2, double %v3, double %v4, double %v5)
- to label %invoke.cont2 unwind label %lpad1
-
-invoke.cont2: ; preds = %lpad
- tail call void @__cxa_end_catch()
- br label %try.cont
-
-try.cont: ; preds = %entry, %invoke.cont2
- ret void
-
-lpad1: ; preds = %lpad
- %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- cleanup
- invoke void @__cxa_end_catch()
- to label %eh.resume unwind label %terminate.lpad
-
-eh.resume: ; preds = %lpad1
- resume { i8*, i32 } %3
-
-terminate.lpad: ; preds = %lpad1
- %4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
- catch i8* null
- tail call void @_ZSt9terminatev() noreturn nounwind
- unreachable
-}
-
-declare void @_Z5printiiiii(i32, i32, i32, i32, i32)
-
-declare i32 @__gxx_personality_v0(...)
-
-declare i8* @__cxa_begin_catch(i8*)
-
-declare void @_Z5printddddd(double, double, double, double, double)
-
-declare void @__cxa_end_catch()
-
-declare void @_ZSt9terminatev()
-
-; CHECK: section .text
-; CHECK: section .ARM.extab
-; CHECK-NEXT: 0000 00000000 c94a9b01 b0818484
-; CHECK: section .ARM.exidx
-; CHECK-NEXT: 0000 00000000 00000000
-
-; CHECK-FP-ELIM: section .text
-; CHECK-FP-ELIM: section .ARM.extab
-; CHECK-FP-ELIM-NEXT: 0000 00000000 84c90501 b0b0b0a8
-; CHECK-FP-ELIM: section .ARM.exidx
-; CHECK-FP-ELIM-NEXT: 0000 00000000 00000000
diff --git a/test/CodeGen/ARM/ehabi.ll b/test/CodeGen/ARM/ehabi.ll
new file mode 100644
index 0000000000..b05d4beee8
--- /dev/null
+++ b/test/CodeGen/ARM/ehabi.ll
@@ -0,0 +1,298 @@
+; ARM EHABI integrated test
+
+; This test case checks whether the ARM unwind directives are properly
+; generated or not.
+
+; The purpose of the test:
+; (1) .fnstart and .fnend directives should wrap the function.
+; (2) .setfp directive should be available if frame pointer is not eliminated.
+; (3) .save directive should come with push instruction.
+; (4) .vsave directive should come with vpush instruction.
+; (5) .pad directive should come with stack pointer adjustment.
+; (6) .cantunwind directive should be available if the function is marked with
+; nounwind function attribute.
+
+; We have to check several cases:
+; (1) arm with -disable-fp-elim
+; (2) arm without -disable-fp-elim
+; (3) armv7 with -disable-fp-elim
+; (4) armv7 without -disable-fp-elim
+
+; RUN: llc -mtriple arm-unknown-linux-gnueabi \
+; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
+; RUN: -disable-fp-elim -filetype=asm -o - %s \
+; RUN: | FileCheck %s --check-prefix=CHECK-FP
+
+; RUN: llc -mtriple arm-unknown-linux-gnueabi \
+; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
+; RUN: -filetype=asm -o - %s \
+; RUN: | FileCheck %s --check-prefix=CHECK-FP-ELIM
+
+; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
+; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
+; RUN: -disable-fp-elim -filetype=asm -o - %s \
+; RUN: | FileCheck %s --check-prefix=CHECK-V7-FP
+
+; RUN: llc -mtriple armv7-unknown-linux-gnueabi \
+; RUN: -arm-enable-ehabi -arm-enable-ehabi-descriptors \
+; RUN: -filetype=asm -o - %s \
+; RUN: | FileCheck %s --check-prefix=CHECK-V7-FP-ELIM
+
+;-------------------------------------------------------------------------------
+; Test 1
+;-------------------------------------------------------------------------------
+; This is the LLVM assembly generated from following C++ code:
+;
+; extern void print(int, int, int, int, int);
+; extern void print(double, double, double, double, double);
+;
+; void test(int a, int b, int c, int d, int e,
+; double m, double n, double p, double q, double r) {
+; try {
+; print(a, b, c, d, e);
+; } catch (...) {
+; print(m, n, p, q, r);
+; }
+; }
+
+declare void @_Z5printiiiii(i32, i32, i32, i32, i32)
+
+declare void @_Z5printddddd(double, double, double, double, double)
+
+define void @_Z4testiiiiiddddd(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e,
+ double %m, double %n, double %p,
+ double %q, double %r) {
+entry:
+ invoke void @_Z5printiiiii(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e)
+ to label %try.cont unwind label %lpad
+
+lpad:
+ %0 = landingpad { i8*, i32 }
+ personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ catch i8* null
+ %1 = extractvalue { i8*, i32 } %0, 0
+ %2 = tail call i8* @__cxa_begin_catch(i8* %1)
+ invoke void @_Z5printddddd(double %m, double %n, double %p,
+ double %q, double %r)
+ to label %invoke.cont2 unwind label %lpad1
+
+invoke.cont2:
+ tail call void @__cxa_end_catch()
+ br label %try.cont
+
+try.cont:
+ ret void
+
+lpad1:
+ %3 = landingpad { i8*, i32 }
+ personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ cleanup
+ invoke void @__cxa_end_catch()
+ to label %eh.resume unwind label %terminate.lpad
+
+eh.resume:
+ resume { i8*, i32 } %3
+
+terminate.lpad:
+ %4 = landingpad { i8*, i32 }
+ personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+ catch i8* null
+ %5 = extractvalue { i8*, i32 } %4, 0
+ tail call void @__clang_call_terminate(i8* %5)
+ unreachable
+}
+
+declare void @__clang_call_terminate(i8*)
+
+declare i32 @__gxx_personality_v0(...)
+
+declare i8* @__cxa_begin_catch(i8*)
+
+declare void @__cxa_end_catch()
+
+declare void @_ZSt9terminatev()
+
+; CHECK-FP: _Z4testiiiiiddddd:
+; CHECK-FP: .fnstart
+; CHECK-FP: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr}
+; CHECK-FP: push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
+; CHECK-FP: .setfp r11, sp, #28
+; CHECK-FP: add r11, sp, #28
+; CHECK-FP: .pad #28
+; CHECK-FP: sub sp, sp, #28
+; CHECK-FP: .personality __gxx_personality_v0
+; CHECK-FP: .handlerdata
+; CHECK-FP: .fnend
+
+; CHECK-FP-ELIM: _Z4testiiiiiddddd:
+; CHECK-FP-ELIM: .fnstart
+; CHECK-FP-ELIM: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr}
+; CHECK-FP-ELIM: push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
+; CHECK-FP-ELIM: .pad #28
+; CHECK-FP-ELIM: sub sp, sp, #28
+; CHECK-FP-ELIM: .personality __gxx_personality_v0
+; CHECK-FP-ELIM: .handlerdata
+; CHECK-FP-ELIM: .fnend
+
+; CHECK-V7-FP: _Z4testiiiiiddddd:
+; CHECK-V7-FP: .fnstart
+; CHECK-V7-FP: .save {r4, r11, lr}
+; CHECK-V7-FP: push {r4, r11, lr}
+; CHECK-V7-FP: .setfp r11, sp, #4
+; CHECK-V7-FP: add r11, sp, #4
+; CHECK-V7-FP: .vsave {d8, d9, d10, d11, d12}
+; CHECK-V7-FP: vpush {d8, d9, d10, d11, d12}
+; CHECK-V7-FP: .pad #28
+; CHECK-V7-FP: sub sp, sp, #28
+; CHECK-V7-FP: .personality __gxx_personality_v0
+; CHECK-V7-FP: .handlerdata
+; CHECK-V7-FP: .fnend
+
+; CHECK-V7-FP-ELIM: _Z4testiiiiiddddd:
+; CHECK-V7-FP-ELIM: .fnstart
+; CHECK-V7-FP-ELIM: .save {r4, lr}
+; CHECK-V7-FP-ELIM: push {r4, lr}
+; CHECK-V7-FP-ELIM: .vsave {d8, d9, d10, d11, d12}
+; CHECK-V7-FP-ELIM: vpush {d8, d9, d10, d11, d12}
+; CHECK-V7-FP-ELIM: .pad #24
+; CHECK-V7-FP-ELIM: sub sp, sp, #24
+; CHECK-V7-FP-ELIM: .personality __gxx_personality_v0
+; CHECK-V7-FP-ELIM: .handlerdata
+; CHECK-V7-FP-ELIM: .fnend
+
+
+;-------------------------------------------------------------------------------
+; Test 2
+;-------------------------------------------------------------------------------
+
+declare void @throw_exception_2()
+
+define void @test2() {
+entry:
+ tail call void @throw_exception_2()
+ ret void
+}
+
+; CHECK-FP: test2:
+; CHECK-FP: .fnstart
+; CHECK-FP: .save {r11, lr}
+; CHECK-FP: push {r11, lr}
+; CHECK-FP: .setfp r11, sp
+; CHECK-FP: mov r11, sp
+; CHECK-FP: pop {r11, lr}
+; CHECK-FP: mov pc, lr
+; CHECK-FP: .fnend
+
+; CHECK-FP-ELIM: test2:
+; CHECK-FP-ELIM: .fnstart
+; CHECK-FP-ELIM: .save {r11, lr}
+; CHECK-FP-ELIM: push {r11, lr}
+; CHECK-FP-ELIM: pop {r11, lr}
+; CHECK-FP-ELIM: mov pc, lr
+; CHECK-FP-ELIM: .fnend
+
+; CHECK-V7-FP: test2:
+; CHECK-V7-FP: .fnstart
+; CHECK-V7-FP: .save {r11, lr}
+; CHECK-V7-FP: push {r11, lr}
+; CHECK-V7-FP: .setfp r11, sp
+; CHECK-V7-FP: mov r11, sp
+; CHECK-V7-FP: pop {r11, pc}
+; CHECK-V7-FP: .fnend
+
+; CHECK-V7-FP-ELIM: test2:
+; CHECK-V7-FP-ELIM: .fnstart
+; CHECK-V7-FP-ELIM: .save {r11, lr}
+; CHECK-V7-FP-ELIM: push {r11, lr}
+; CHECK-V7-FP-ELIM: pop {r11, pc}
+; CHECK-V7-FP-ELIM: .fnend
+
+
+;-------------------------------------------------------------------------------
+; Test 3
+;-------------------------------------------------------------------------------
+
+declare void @throw_exception_3(i32)
+
+define i32 @test3(i32 %a, i32 %b, i32 %c, i32 %d,
+ i32 %e, i32 %f, i32 %g, i32 %h) {
+entry:
+ %add = add nsw i32 %b, %a
+ %add1 = add nsw i32 %add, %c
+ %add2 = add nsw i32 %add1, %d
+ tail call void @throw_exception_3(i32 %add2)
+ %add3 = add nsw i32 %f, %e
+ %add4 = add nsw i32 %add3, %g
+ %add5 = add nsw i32 %add4, %h
+ tail call void @throw_exception_3(i32 %add5)
+ %add6 = add nsw i32 %add5, %add2
+ ret i32 %add6
+}
+
+; CHECK-FP: test3:
+; CHECK-FP: .fnstart
+; CHECK-FP: .save {r4, r5, r11, lr}
+; CHECK-FP: push {r4, r5, r11, lr}
+; CHECK-FP: .setfp r11, sp, #8
+; CHECK-FP: add r11, sp, #8
+; CHECK-FP: pop {r4, r5, r11, lr}
+; CHECK-FP: mov pc, lr
+; CHECK-FP: .fnend
+
+; CHECK-FP-ELIM: test3:
+; CHECK-FP-ELIM: .fnstart
+; CHECK-FP-ELIM: .save {r4, r5, r11, lr}
+; CHECK-FP-ELIM: push {r4, r5, r11, lr}
+; CHECK-FP-ELIM: pop {r4, r5, r11, lr}
+; CHECK-FP-ELIM: mov pc, lr
+; CHECK-FP-ELIM: .fnend
+
+; CHECK-V7-FP: test3:
+; CHECK-V7-FP: .fnstart
+; CHECK-V7-FP: .save {r4, r5, r11, lr}
+; CHECK-V7-FP: push {r4, r5, r11, lr}
+; CHECK-V7-FP: .setfp r11, sp, #8
+; CHECK-V7-FP: add r11, sp, #8
+; CHECK-V7-FP: pop {r4, r5, r11, pc}
+; CHECK-V7-FP: .fnend
+
+; CHECK-V7-FP-ELIM: test3:
+; CHECK-V7-FP-ELIM: .fnstart
+; CHECK-V7-FP-ELIM: .save {r4, r5, r11, lr}
+; CHECK-V7-FP-ELIM: push {r4, r5, r11, lr}
+; CHECK-V7-FP-ELIM: pop {r4, r5, r11, pc}
+; CHECK-V7-FP-ELIM: .fnend
+
+
+;-------------------------------------------------------------------------------
+; Test 4
+;-------------------------------------------------------------------------------
+
+define void @test4() nounwind {
+entry:
+ ret void
+}
+
+; CHECK-FP: test4:
+; CHECK-FP: .fnstart
+; CHECK-FP: mov pc, lr
+; CHECK-FP: .cantunwind
+; CHECK-FP: .fnend
+
+; CHECK-FP-ELIM: test4:
+; CHECK-FP-ELIM: .fnstart
+; CHECK-FP-ELIM: mov pc, lr
+; CHECK-FP-ELIM: .cantunwind
+; CHECK-FP-ELIM: .fnend
+
+; CHECK-V7-FP: test4:
+; CHECK-V7-FP: .fnstart
+; CHECK-V7-FP: bx lr
+; CHECK-V7-FP: .cantunwind
+; CHECK-V7-FP: .fnend
+
+; CHECK-V7-FP-ELIM: test4:
+; CHECK-V7-FP-ELIM: .fnstart
+; CHECK-V7-FP-ELIM: bx lr
+; CHECK-V7-FP-ELIM: .cantunwind
+; CHECK-V7-FP-ELIM: .fnend
diff --git a/test/CodeGen/ARM/section-name.ll b/test/CodeGen/ARM/section-name.ll
new file mode 100644
index 0000000000..a0aad4733b
--- /dev/null
+++ b/test/CodeGen/ARM/section-name.ll
@@ -0,0 +1,25 @@
+; RUN: llc < %s -mtriple=arm-unknown-linux-gnueabi | FileCheck %s
+
+; CHECK: .text
+; CHECK: .globl test1
+; CHECK: .type test1,%function
+define void @test1() {
+entry:
+ ret void
+}
+
+; CHECK: .section .test2,"ax",%progbits
+; CHECK: .globl test2
+; CHECK: .type test2,%function
+define void @test2() section ".test2" {
+entry:
+ ret void
+}
+
+; CHECK: .section .text.test3,"axG",%progbits,test3,comdat
+; CHECK: .weak test3
+; CHECK: .type test3,%function
+define linkonce_odr void @test3() {
+entry:
+ ret void
+}