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
This commit is contained in:
Evan Cheng 2011-01-03 23:47:14 +00:00
parent e508dd4c75
commit bbdcd44361
5 changed files with 184 additions and 127 deletions

View File

@ -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: ])

View File

@ -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: ])

View File

@ -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: ])

View File

@ -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: ])

24
test/MC/ELF/call-abs.s Normal file
View File

@ -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: ])