diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-01-03 23:47:14 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-01-03 23:47:14 +0000 |
commit | bbdcd443614fc1ac012227d9975201c18b9e2ab4 (patch) | |
tree | 9a4c80e4fcf8e16b708553210367563512ca35f2 /test/MC/ELF | |
parent | e508dd4c75705f325764e1197854c0e83266a7ea (diff) | |
download | external_llvm-bbdcd443614fc1ac012227d9975201c18b9e2ab4.zip external_llvm-bbdcd443614fc1ac012227d9975201c18b9e2ab4.tar.gz external_llvm-bbdcd443614fc1ac012227d9975201c18b9e2ab4.tar.bz2 |
Convert MC tests to .s so codegen changes won't break them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/ELF')
-rw-r--r-- | test/MC/ELF/basic-elf-32.s | 78 | ||||
-rw-r--r-- | test/MC/ELF/basic-elf-64.s | 82 | ||||
-rw-r--r-- | test/MC/ELF/basic-elf.ll | 111 | ||||
-rw-r--r-- | test/MC/ELF/call-abs.ll | 16 | ||||
-rw-r--r-- | test/MC/ELF/call-abs.s | 24 |
5 files changed, 184 insertions, 127 deletions
diff --git a/test/MC/ELF/basic-elf-32.s b/test/MC/ELF/basic-elf-32.s new file mode 100644 index 0000000..fa97da4 --- /dev/null +++ b/test/MC/ELF/basic-elf-32.s @@ -0,0 +1,78 @@ +// RUN: llvm-mc -filetype=obj -triple i686-pc-linux-gnu %s -o - | elf-dump | FileCheck %s + + .text + .globl main + .align 16, 0x90 + .type main,@function +main: # @main +# BB#0: + subl $4, %esp + movl $.L.str1, (%esp) + calll puts + movl $.L.str2, (%esp) + calll puts + xorl %eax, %eax + addl $4, %esp + ret +.Ltmp0: + .size main, .Ltmp0-main + + .type .L.str1,@object # @.str1 + .section .rodata.str1.1,"aMS",@progbits,1 +.L.str1: + .asciz "Hello" + .size .L.str1, 6 + + .type .L.str2,@object # @.str2 +.L.str2: + .asciz "World!" + .size .L.str2, 7 + + .section .note.GNU-stack,"",@progbits + +// CHECK: ('e_indent[EI_CLASS]', 0x00000001) +// CHECK: ('e_indent[EI_DATA]', 0x00000001) +// CHECK: ('e_indent[EI_VERSION]', 0x00000001) +// CHECK: ('_sections', [ +// CHECK: # Section 0 +// CHECK: (('sh_name', 0x00000000) # '' + +// CHECK: # '.text' + +// CHECK: ('st_bind', 0x00000000) +// CHECK: ('st_type', 0x00000003) + +// CHECK: ('st_bind', 0x00000000) +// CHECK: ('st_type', 0x00000003) + +// CHECK: ('st_bind', 0x00000000) +// CHECK: ('st_type', 0x00000003) + +// CHECK: # 'main' +// CHECK: ('st_bind', 0x00000001) +// CHECK-NEXT: ('st_type', 0x00000002) + +// CHECK: # 'puts' +// CHECK: ('st_bind', 0x00000001) +// CHECK-NEXT: ('st_type', 0x00000000) + +// CHECK: # '.rel.text' + +// CHECK: ('_relocations', [ +// CHECK: # Relocation 0x00000000 +// CHECK: (('r_offset', 0x00000006) +// CHECK: ('r_type', 0x00000001) +// CHECK: ), +// CHECK: # Relocation 0x00000001 +// CHECK: (('r_offset', 0x0000000b) +// CHECK: ('r_type', 0x00000002) +// CHECK: ), +// CHECK: # Relocation 0x00000002 +// CHECK: (('r_offset', 0x00000012) +// CHECK: ('r_type', 0x00000001) +// CHECK: ), +// CHECK: # Relocation 0x00000003 +// CHECK: (('r_offset', 0x00000017) +// CHECK: ('r_type', 0x00000002) +// CHECK: ), +// CHECK: ]) diff --git a/test/MC/ELF/basic-elf-64.s b/test/MC/ELF/basic-elf-64.s new file mode 100644 index 0000000..7fc40b7 --- /dev/null +++ b/test/MC/ELF/basic-elf-64.s @@ -0,0 +1,82 @@ +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck %s + + .text + .globl main + .align 16, 0x90 + .type main,@function +main: # @main +# BB#0: + subq $8, %rsp + movl $.L.str1, %edi + callq puts + movl $.L.str2, %edi + callq puts + xorl %eax, %eax + addq $8, %rsp + ret +.Ltmp0: + .size main, .Ltmp0-main + + .type .L.str1,@object # @.str1 + .section .rodata.str1.1,"aMS",@progbits,1 +.L.str1: + .asciz "Hello" + .size .L.str1, 6 + + .type .L.str2,@object # @.str2 +.L.str2: + .asciz "World!" + .size .L.str2, 7 + + .section .note.GNU-stack,"",@progbits + +// CHECK: ('e_indent[EI_CLASS]', 0x00000002) +// CHECK: ('e_indent[EI_DATA]', 0x00000001) +// CHECK: ('e_indent[EI_VERSION]', 0x00000001) +// CHECK: ('_sections', [ +// CHECK: # Section 0 +// CHECK: (('sh_name', 0x00000000) # '' + +// CHECK: # '.text' + +// CHECK: ('st_bind', 0x00000000) +// CHECK: ('st_type', 0x00000003) + +// CHECK: ('st_bind', 0x00000000) +// CHECK: ('st_type', 0x00000003) + +// CHECK: ('st_bind', 0x00000000) +// CHECK: ('st_type', 0x00000003) + +// CHECK: # 'main' +// CHECK-NEXT: ('st_bind', 0x00000001) +// CHECK-NEXT: ('st_type', 0x00000002) + +// CHECK: # 'puts' +// CHECK-NEXT: ('st_bind', 0x00000001) +// CHECK-NEXT: ('st_type', 0x00000000) + +// CHECK: # '.rela.text' + +// CHECK: ('_relocations', [ +// CHECK: # Relocation 0x00000000 +// CHECK: (('r_offset', 0x00000005) +// CHECK: ('r_type', 0x0000000a) +// CHECK: ('r_addend', 0x00000000) +// CHECK: ), +// CHECK: # Relocation 0x00000001 +// CHECK: (('r_offset', 0x0000000a) +// CHECK: ('r_type', 0x00000002) +// CHECK: ('r_addend', 0xfffffffc) +// CHECK: ), +// CHECK: # Relocation 0x00000002 +// CHECK: (('r_offset', 0x0000000f) +// CHECK: ('r_type', 0x0000000a) +// CHECK: ('r_addend', 0x00000006) +// CHECK: ), +// CHECK: # Relocation 0x00000003 +// CHECK: (('r_offset', 0x00000014) +// CHECK: ('r_type', 0x00000002) +// CHECK: ('r_addend', 0xfffffffc) +// CHECK: ), +// CHECK: ]) diff --git a/test/MC/ELF/basic-elf.ll b/test/MC/ELF/basic-elf.ll deleted file mode 100644 index f478b32..0000000 --- a/test/MC/ELF/basic-elf.ll +++ /dev/null @@ -1,111 +0,0 @@ -; RUN: llc -filetype=obj -mtriple i686-pc-linux-gnu %s -o - | elf-dump | FileCheck -check-prefix=32 %s -; RUN: llc -filetype=obj -mtriple x86_64-pc-linux-gnu %s -o - | elf-dump | FileCheck -check-prefix=64 %s - -@.str1 = private constant [6 x i8] c"Hello\00" -@.str2 = private constant [7 x i8] c"World!\00" - -define i32 @main() nounwind { - %1 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str1, i32 0, i32 0)) - %2 = call i32 @puts(i8* getelementptr inbounds ([7 x i8]* @.str2, i32 0, i32 0)) - ret i32 0 -} - -declare i32 @puts(i8* nocapture) nounwind - -; 32: ('e_indent[EI_CLASS]', 0x00000001) -; 32: ('e_indent[EI_DATA]', 0x00000001) -; 32: ('e_indent[EI_VERSION]', 0x00000001) -; 32: ('_sections', [ -; 32: # Section 0 -; 32: (('sh_name', 0x00000000) # '' - -; 32: # '.text' - -; 32: ('st_bind', 0x00000000) -; 32: ('st_type', 0x00000003) - -; 32: ('st_bind', 0x00000000) -; 32: ('st_type', 0x00000003) - -; 32: ('st_bind', 0x00000000) -; 32: ('st_type', 0x00000003) - -; 32: # 'main' -; 32: ('st_bind', 0x00000001) -; 32-NEXT: ('st_type', 0x00000002) - -; 32: # 'puts' -; 32: ('st_bind', 0x00000001) -; 32-NEXT: ('st_type', 0x00000000) - -; 32: # '.rel.text' - -; 32: ('_relocations', [ -; 32: # Relocation 0x00000000 -; 32: (('r_offset', 0x00000006) -; 32: ('r_type', 0x00000001) -; 32: ), -; 32: # Relocation 0x00000001 -; 32: (('r_offset', 0x0000000b) -; 32: ('r_type', 0x00000002) -; 32: ), -; 32: # Relocation 0x00000002 -; 32: (('r_offset', 0x00000012) -; 32: ('r_type', 0x00000001) -; 32: ), -; 32: # Relocation 0x00000003 -; 32: (('r_offset', 0x00000017) -; 32: ('r_type', 0x00000002) -; 32: ), -; 32: ]) - -; 64: ('e_indent[EI_CLASS]', 0x00000002) -; 64: ('e_indent[EI_DATA]', 0x00000001) -; 64: ('e_indent[EI_VERSION]', 0x00000001) -; 64: ('_sections', [ -; 64: # Section 0 -; 64: (('sh_name', 0x00000000) # '' - -; 64: # '.text' - -; 64: ('st_bind', 0x00000000) -; 64: ('st_type', 0x00000003) - -; 64: ('st_bind', 0x00000000) -; 64: ('st_type', 0x00000003) - -; 64: ('st_bind', 0x00000000) -; 64: ('st_type', 0x00000003) - -; 64: # 'main' -; 64-NEXT: ('st_bind', 0x00000001) -; 64-NEXT: ('st_type', 0x00000002) - -; 64: # 'puts' -; 64-NEXT: ('st_bind', 0x00000001) -; 64-NEXT: ('st_type', 0x00000000) - -; 64: # '.rela.text' - -; 64: ('_relocations', [ -; 64: # Relocation 0x00000000 -; 64: (('r_offset', 0x00000005) -; 64: ('r_type', 0x0000000a) -; 64: ('r_addend', 0x00000000) -; 64: ), -; 64: # Relocation 0x00000001 -; 64: (('r_offset', 0x0000000a) -; 64: ('r_type', 0x00000002) -; 64: ('r_addend', 0xfffffffc) -; 64: ), -; 64: # Relocation 0x00000002 -; 64: (('r_offset', 0x0000000f) -; 64: ('r_type', 0x0000000a) -; 64: ('r_addend', 0x00000006) -; 64: ), -; 64: # Relocation 0x00000003 -; 64: (('r_offset', 0x00000014) -; 64: ('r_type', 0x00000002) -; 64: ('r_addend', 0xfffffffc) -; 64: ), -; 64: ]) diff --git a/test/MC/ELF/call-abs.ll b/test/MC/ELF/call-abs.ll deleted file mode 100644 index 6ebd17f..0000000 --- a/test/MC/ELF/call-abs.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: llc -filetype=obj -mtriple i686-pc-linux-gnu %s -o - | elf-dump | FileCheck %s - -define i32 @f() nounwind optsize ssp { -entry: - %call = tail call i32 inttoptr (i64 42 to i32 ()*)() nounwind optsize - %add = add nsw i32 %call, 1 - ret i32 %add -} - -; CHECK: ('_relocations', [ -; CHECK-NEXT: # Relocation 0x00000000 -; CHECK-NEXT: (('r_offset', 0x00000004) -; CHECK-NEXT: ('r_sym', 0x00000000) -; CHECK-NEXT: ('r_type', 0x00000002) -; CHECK-NEXT: ), -; CHECK-NEXT: ]) diff --git a/test/MC/ELF/call-abs.s b/test/MC/ELF/call-abs.s new file mode 100644 index 0000000..885c2d1 --- /dev/null +++ b/test/MC/ELF/call-abs.s @@ -0,0 +1,24 @@ +// RUN: llvm-mc -filetype=obj -triple i686-pc-linux-gnu %s -o - | elf-dump | FileCheck %s + + .text + .globl f + .type f,@function +f: # @f +# BB#0: # %entry + subl $4, %esp + calll 42 + incl %eax + addl $4, %esp + ret +.Ltmp0: + .size f, .Ltmp0-f + + .section .note.GNU-stack,"",@progbits + +// CHECK: ('_relocations', [ +// CHECK-NEXT: # Relocation 0x00000000 +// CHECK-NEXT: (('r_offset', 0x00000004) +// CHECK-NEXT: ('r_sym', 0x00000000) +// CHECK-NEXT: ('r_type', 0x00000002) +// CHECK-NEXT: ), +// CHECK-NEXT: ]) |