mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-26 23:29:22 +00:00
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
81 lines
2.0 KiB
LLVM
81 lines
2.0 KiB
LLVM
; RUN: llc -fast-isel -O0 -mcpu=generic -mtriple=i386-apple-darwin10 -relocation-model=pic < %s | FileCheck %s
|
|
|
|
; This should use flds to set the return value.
|
|
; CHECK-LABEL: test0:
|
|
; CHECK: flds
|
|
; CHECK: retl
|
|
@G = external global float
|
|
define float @test0() nounwind {
|
|
%t = load float, float* @G
|
|
ret float %t
|
|
}
|
|
|
|
; This should pop 4 bytes on return.
|
|
; CHECK-LABEL: test1:
|
|
; CHECK: retl $4
|
|
define void @test1({i32, i32, i32, i32}* sret %p) nounwind {
|
|
store {i32, i32, i32, i32} zeroinitializer, {i32, i32, i32, i32}* %p
|
|
ret void
|
|
}
|
|
|
|
; Properly initialize the pic base.
|
|
; CHECK-LABEL: test2:
|
|
; CHECK-NOT: HHH
|
|
; CHECK: call{{.*}}L2$pb
|
|
; CHECK-NEXT: L2$pb:
|
|
; CHECK-NEXT: pop
|
|
; CHECK: HHH
|
|
; CHECK: retl
|
|
@HHH = external global i32
|
|
define i32 @test2() nounwind {
|
|
%t = load i32, i32* @HHH
|
|
ret i32 %t
|
|
}
|
|
|
|
; Check that we fast-isel sret, and handle the callee-pops behavior correctly.
|
|
%struct.a = type { i64, i64, i64 }
|
|
define void @test3() nounwind ssp {
|
|
entry:
|
|
%tmp = alloca %struct.a, align 8
|
|
call void @test3sret(%struct.a* sret %tmp)
|
|
ret void
|
|
; CHECK-LABEL: test3:
|
|
; CHECK: subl $44
|
|
; CHECK: leal 16(%esp)
|
|
; CHECK: calll _test3sret
|
|
; CHECK: addl $40
|
|
}
|
|
declare void @test3sret(%struct.a* sret)
|
|
|
|
; Check that fast-isel sret works with fastcc (and does not callee-pop)
|
|
define void @test4() nounwind ssp {
|
|
entry:
|
|
%tmp = alloca %struct.a, align 8
|
|
call fastcc void @test4fastccsret(%struct.a* sret %tmp)
|
|
ret void
|
|
; CHECK-LABEL: test4:
|
|
; CHECK: subl $28
|
|
; CHECK: leal (%esp), %ecx
|
|
; CHECK: calll _test4fastccsret
|
|
; CHECK: addl $28
|
|
}
|
|
declare fastcc void @test4fastccsret(%struct.a* sret)
|
|
|
|
|
|
; Check that fast-isel cleans up when it fails to lower a call instruction.
|
|
define void @test5() {
|
|
entry:
|
|
%call = call i32 @test5dllimport(i32 42)
|
|
ret void
|
|
; CHECK-LABEL: test5:
|
|
; Local value area is still there:
|
|
; CHECK: movl $42, {{%[a-z]+}}
|
|
; Fast-ISel's arg push is not here:
|
|
; CHECK-NOT: movl $42, (%esp)
|
|
; SDag-ISel's arg push:
|
|
; CHECK: movl %esp, [[REGISTER:%[a-z]+]]
|
|
; CHECK: movl $42, ([[REGISTER]])
|
|
; CHECK: movl __imp__test5dllimport
|
|
}
|
|
declare dllimport i32 @test5dllimport(i32)
|