1 ; RUN: llc < %s -tailcallopt -mtriple=i686-linux-gnu | FileCheck %s
3 ; Test the GHC call convention works (x86-32)
5 @base = external global i32 ; assigned to register: ebx
6 @sp = external global i32 ; assigned to register: ebp
7 @hp = external global i32 ; assigned to register: edi
8 @r1 = external global i32 ; assigned to register: esi
10 define void @zap(i32 %a, i32 %b) nounwind {
12 ; CHECK: movl {{[0-9]*}}(%esp), %ebx
13 ; CHECK-NEXT: movl {{[0-9]*}}(%esp), %ebp
14 ; CHECK-NEXT: calll addtwo
15 %0 = call ghccc i32 @addtwo(i32 %a, i32 %b)
17 call void @foo() nounwind
21 define ghccc i32 @addtwo(i32 %x, i32 %y) nounwind {
23 ; CHECK: leal (%ebx,%ebp), %eax
29 define ghccc void @foo() nounwind {
31 ; CHECK: movl r1, %esi
32 ; CHECK-NEXT: movl hp, %edi
33 ; CHECK-NEXT: movl sp, %ebp
34 ; CHECK-NEXT: movl base, %ebx
35 %0 = load i32, i32* @r1
36 %1 = load i32, i32* @hp
37 %2 = load i32, i32* @sp
38 %3 = load i32, i32* @base
40 tail call ghccc void @bar( i32 %3, i32 %2, i32 %1, i32 %0 ) nounwind
44 declare ghccc void @bar(i32, i32, i32, i32)