summaryrefslogtreecommitdiff
path: root/test/MC
diff options
context:
space:
mode:
authorJack Carter <jack.carter@imgtec.com>2014-01-25 00:24:07 +0000
committerJack Carter <jack.carter@imgtec.com>2014-01-25 00:24:07 +0000
commit998052555a65c42ac3cecc9262ef6bb31ea56ee8 (patch)
treeb14b91dcbd91bf7087a90d7241d8cdc651295b9f /test/MC
parentf1f5a434ad9319195eeaf4a4f36d8a6ce085a7b3 (diff)
downloadllvm-998052555a65c42ac3cecc9262ef6bb31ea56ee8.tar.gz
llvm-998052555a65c42ac3cecc9262ef6bb31ea56ee8.tar.bz2
llvm-998052555a65c42ac3cecc9262ef6bb31ea56ee8.tar.xz
[Mips] TargetStreamer ELF flag Support for default and commandline options.
This patch uses a common MipsTargetSteamer interface for both MipsAsmPrinter and MipsAsmParser for recording default and commandline driven directives that affect ELF header flags. It has been noted that the .ll tests affected by this patch belong in test/Codegen/Mips. I will move them in a separate patch. Also, a number of directives do not get expressed by AsmPrinter in the resultant .s assembly such as setting the correct ASI. I have noted this in the tests and they will be addressed in later patches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC')
-rw-r--r--test/MC/Mips/elf_eflags.ll102
-rw-r--r--test/MC/Mips/elf_eflags.s20
-rw-r--r--test/MC/Mips/elf_st_other.ll5
3 files changed, 93 insertions, 34 deletions
diff --git a/test/MC/Mips/elf_eflags.ll b/test/MC/Mips/elf_eflags.ll
index 8216a90aa3..c7cb590a31 100644
--- a/test/MC/Mips/elf_eflags.ll
+++ b/test/MC/Mips/elf_eflags.ll
@@ -1,6 +1,5 @@
-; This tests ELF EFLAGS setting with direct object.
-; When the assembler is ready a .s file for it will
-; be created.
+; This tests for directives that will result in
+; ELF EFLAGS setting with direct object.
; Non-shared (static) is the absence of pic and or cpic.
@@ -16,52 +15,105 @@
; Note that EF_MIPS_CPIC is set by -mabicalls which is the default on Linux
; TODO need to support -mno-abicalls
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE32 %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32_PIC %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE32R2 %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2_PIC %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -relocation-model=static -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS_PIC %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 \
+; RUN: -relocation-model=static %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE32 %s
+;
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32 %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE32_PIC %s
+;
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 \
+; RUN: -relocation-model=static %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE32R2 %s
+;
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE32R2_PIC %s
+;
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 \
+; RUN: -mattr=+micromips -relocation-model=static %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS %s
+;
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 \
+; RUN: -mattr=+micromips %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE32R2-MICROMIPS_PIC %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 -relocation-model=static %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE64 %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 %s -print-hack-directives -o - | FileCheck -check-prefix=CHECK-BE64_PIC %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 -relocation-model=static -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE64R2 %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-BE64R2_PIC %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 \
+; RUN: -relocation-model=static %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE64 %s
+;
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64 %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE64_PIC %s
+;
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 \
+; RUN: -relocation-model=static %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE64R2 %s
+;
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips64r2 %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-BE64R2_PIC %s
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+mips16 -relocation-model=pic -print-hack-directives %s -o - | FileCheck -check-prefix=CHECK-LE32R2-MIPS16 %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 \
+; RUN: -mattr=+mips16 -relocation-model=pic %s -o - | \
+; RUN: FileCheck -check-prefix=CHECK-LE32R2-MIPS16 %s
; 32(R1) bit with NO_REORDER and static
-; CHECK-BE32: .mips_hack_elf_flags 0x50001005
+; CHECK-BE32: .abicalls
+; CHECK-BE32: .option pic0
+; CHECK-BE32: .set noreorder
+; TODO: Need .set mips32
;
; 32(R1) bit with NO_REORDER and PIC
-; CHECK-BE32_PIC: .mips_hack_elf_flags 0x50001007
+; CHECK-BE32_PIC: .abicalls
+; CHECK-BE32_PIC: .set noreorder
+; TODO: Need .set mips32 and check absence of .option pic0
;
; 32R2 bit with NO_REORDER and static
-; CHECK-BE32R2: .mips_hack_elf_flags 0x70001005
+; CHECK-BE32R2: .abicalls
+; CHECK-BE32R2: .option pic0
+; CHECK-BE32R2: .set noreorder
+; TODO: Need .set mips32r2
;
; 32R2 bit with NO_REORDER and PIC
-; CHECK-BE32R2_PIC: .mips_hack_elf_flags 0x70001007
+; CHECK-BE32R2_PIC:.abicalls
+; CHECK-BE32R2_PIC:.set noreorder
+; TODO: Need .set mips32r2 and check absence of .option pic0
;
; 32R2 bit MICROMIPS with NO_REORDER and static
-; CHECK-BE32R2-MICROMIPS: .mips_hack_elf_flags 0x72001005
+; CHECK-BE32R2-MICROMIPS: .abicalls
+; CHECK-BE32R2-MICROMIPS: .option pic0
+; CHECK-BE32R2-MICROMIPS: .set micromips
+; CHECK-BE32R2-MICROMIPS: .set noreorder
+; TODO: Need .set mips32r2
;
; 32R2 bit MICROMIPS with NO_REORDER and PIC
-; CHECK-BE32R2-MICROMIPS_PIC: .mips_hack_elf_flags 0x72001007
+; CHECK-BE32R2-MICROMIPS_PIC: .abicalls
+; CHECK-BE32R2-MICROMIPS_PIC: .set micromips
+; CHECK-BE32R2-MICROMIPS_PIC: .set noreorder
+; TODO: Need .set mips32r2 and check absence of .option pic0
;
; 64(R1) bit with NO_REORDER and static
-; CHECK-BE64: .mips_hack_elf_flags 0x60000005
+; CHECK-BE64: .abicalls
+; CHECK-BE64: .set noreorder
+; TODO: Need .set mips64 and .option pic0
;
; 64(R1) bit with NO_REORDER and PIC
-; CHECK-BE64_PIC: .mips_hack_elf_flags 0x60000007
+; CHECK-BE64_PIC: .abicalls
+; CHECK-BE64_PIC: .set noreorder
+; TODO: Need .set mips64 and check absence of .option pic0
;
; 64R2 bit with NO_REORDER and static
-; CHECK-BE64R2: .mips_hack_elf_flags 0x80000005
+; CHECK-BE64R2: .abicalls
+; CHECK-BE64R2: .set noreorder
+; TODO: Need .set mips64r2 and .option pic0
;
; 64R2 bit with NO_REORDER and PIC
-; CHECK-BE64R2_PIC: .mips_hack_elf_flags 0x80000007
+; CHECK-BE64R2_PIC: .abicalls
+; CHECK-BE64R2_PIC: .set noreorder
+; TODO: Need .set mips64r2 and check absence of .option pic0
;
; 32R2 bit MIPS16 with PIC
-; CHECK-LE32R2-MIPS16: .mips_hack_elf_flags 0x74001006
+; CHECK-LE32R2-MIPS16: .abicalls
+; CHECK-LE32R2-MIPS16: .set mips16
+; TODO: Need .set mips32r2 and check absence of .option pic0 and noreorder
define i32 @main() nounwind {
entry:
diff --git a/test/MC/Mips/elf_eflags.s b/test/MC/Mips/elf_eflags.s
index f459689bb9..c2849a5efc 100644
--- a/test/MC/Mips/elf_eflags.s
+++ b/test/MC/Mips/elf_eflags.s
@@ -1,15 +1,21 @@
-// RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o -| llvm-readobj -h | FileCheck %s
-// The initial value will be set at 0x50001003 and
-// we will override that with the negation of 0x2 (option pic0
-// the addition of 0x4 (.abicalls)
+// RUN: llvm-mc -filetype=obj -triple mipsel-unknown-linux %s -o - | \
+// RUN: llvm-readobj -h | FileCheck %s
- .mips_hack_elf_flags 0x50001003
+// From the commandline and defaults the following should be set:
+// EF_MIPS_ARCH_32 (0x50000000)
+// EF_MIPS_ABI_O32 (0x00001000)
+// EF_MIPS_NOREORDER (0x00000001)
+// EF_MIPS_PIC (0x00000002)
+
+// Inline directives should set or unset the following:
+// EF_MIPS_CPIC (0x00000004) : .abicalls
+// EF_MIPS_ARCH_ASE_M16 (0x04000000) : .set mips16
+// The negation of EF_MIPS_PIC : .option pic0
// CHECK: Flags [ (0x54001005)
.abicalls
.option pic0
-
- // Set EF_MIPS_ARCH_ASE_M16 (0x04000000)
+
.set mips16
diff --git a/test/MC/Mips/elf_st_other.ll b/test/MC/Mips/elf_st_other.ll
index 68cad48ffd..47828fe4b4 100644
--- a/test/MC/Mips/elf_st_other.ll
+++ b/test/MC/Mips/elf_st_other.ll
@@ -1,12 +1,13 @@
; This tests value of ELF st_other field for function symbol table entries.
; For microMIPS value should be equal to STO_MIPS_MICROMIPS.
-; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips -print-hack-directives %s -o - | FileCheck %s
+; RUN: llc -mtriple mipsel-unknown-linux -mcpu=mips32r2 -mattr=+micromips %s \
+; RUN: -o - | FileCheck %s
define i32 @main() nounwind {
entry:
ret i32 0
}
-; CHECK: .set micromips
+; CHECK: .set micromips
; CHECK: main: