brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 814de5a Raw
45 lines · plain
1; RUN: llc < %s -tailcallopt -mtriple=i686-linux-gnu | FileCheck %s2 3; Test the GHC call convention works (x86-32)4 5@base = external dso_local global i32 ; assigned to register: ebx6@sp   = external dso_local global i32 ; assigned to register: ebp7@hp   = external dso_local global i32 ; assigned to register: edi8@r1   = external dso_local global i32 ; assigned to register: esi9 10define void @zap(i32 %a, i32 %b) nounwind {11entry:12  ; CHECK: movl {{[0-9]*}}(%esp), %ebx13  ; CHECK-NEXT: movl {{[0-9]*}}(%esp), %ebp14  ; CHECK-NEXT: calll addtwo15  %0 = call ghccc i32 @addtwo(i32 %a, i32 %b)16  ; CHECK: calll foo17  call void @foo() nounwind18  ret void19}20 21define ghccc i32 @addtwo(i32 %x, i32 %y) nounwind {22entry:23  ; CHECK: leal (%ebx,%ebp), %eax24  %0 = add i32 %x, %y25  ; CHECK-NEXT: ret26  ret i32 %027}28 29define ghccc void @foo() nounwind {30entry:31  ; CHECK:      movl r1, %esi32  ; CHECK-NEXT: movl hp, %edi33  ; CHECK-NEXT: movl sp, %ebp34  ; CHECK-NEXT: movl base, %ebx35  %0 = load i32, ptr @r136  %1 = load i32, ptr @hp37  %2 = load i32, ptr @sp38  %3 = load i32, ptr @base39  ; CHECK: jmp bar40  tail call ghccc void @bar( i32 %3, i32 %2, i32 %1, i32 %0 ) nounwind41  ret void42}43 44declare ghccc void @bar(i32, i32, i32, i32)45