1 ; RUN: llc < %s -tailcallopt -mtriple=i686-linux-gnu | FileCheck %s 2 3 ; Test the GHC call convention works (x86-32) 4 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 9 10 define void @zap(i32 %a, i32 %b) nounwind { 11 entry: 12 ; CHECK: movl {{[0-9]*}}(%esp), %ebx 13 ; CHECK-NEXT: movl {{[0-9]*}}(%esp), %ebp 14 ; CHECK-NEXT: calll addtwo 15 %0 = call cc 10 i32 @addtwo(i32 %a, i32 %b) 16 ; CHECK: calll foo 17 call void @foo() nounwind 18 ret void 19 } 20 21 define cc 10 i32 @addtwo(i32 %x, i32 %y) nounwind { 22 entry: 23 ; CHECK: leal (%ebx,%ebp), %eax 24 %0 = add i32 %x, %y 25 ; CHECK-NEXT: ret 26 ret i32 %0 27 } 28 29 define cc 10 void @foo() nounwind { 30 entry: 31 ; CHECK: movl base, %ebx 32 ; CHECK-NEXT: movl sp, %ebp 33 ; CHECK-NEXT: movl hp, %edi 34 ; CHECK-NEXT: movl r1, %esi 35 %0 = load i32* @r1 36 %1 = load i32* @hp 37 %2 = load i32* @sp 38 %3 = load i32* @base 39 ; CHECK: jmp bar 40 tail call cc 10 void @bar( i32 %3, i32 %2, i32 %1, i32 %0 ) nounwind 41 ret void 42 } 43 44 declare cc 10 void @bar(i32, i32, i32, i32) 45 46