Mercurial > hg > CbC > CbC_llvm
diff test/CodeGen/X86/musttail-varargs.ll @ 95:afa8332a0e37 LLVM3.8
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | 60c9769439b8 |
children | 7d135dc70f03 |
line wrap: on
line diff
--- a/test/CodeGen/X86/musttail-varargs.ll Wed Feb 18 14:56:07 2015 +0900 +++ b/test/CodeGen/X86/musttail-varargs.ll Tue Oct 13 17:48:58 2015 +0900 @@ -1,4 +1,5 @@ ; RUN: llc < %s -enable-tail-merge=0 -mtriple=x86_64-linux | FileCheck %s --check-prefix=LINUX +; RUN: llc < %s -enable-tail-merge=0 -mtriple=x86_64-linux-gnux32 | FileCheck %s --check-prefix=LINUX-X32 ; RUN: llc < %s -enable-tail-merge=0 -mtriple=x86_64-windows | FileCheck %s --check-prefix=WINDOWS ; RUN: llc < %s -enable-tail-merge=0 -mtriple=i686-windows | FileCheck %s --check-prefix=X86 @@ -16,8 +17,8 @@ %ap_i8 = bitcast [4 x i8*]* %ap to i8* call void @llvm.va_start(i8* %ap_i8) - %fptr = call void(i8*, ...)*(i8*)* @get_f(i8* %this) - musttail call void (i8*, ...)* %fptr(i8* %this, ...) + %fptr = call void(i8*, ...)*(i8*) @get_f(i8* %this) + musttail call void (i8*, ...) %fptr(i8* %this, ...) ret void } @@ -57,6 +58,40 @@ ; LINUX-DAG: movb {{.*}}, %al ; LINUX: jmpq *{{.*}} # TAILCALL +; LINUX-X32-LABEL: f_thunk: +; LINUX-X32-DAG: movl %edi, {{.*}} +; LINUX-X32-DAG: movq %rsi, {{.*}} +; LINUX-X32-DAG: movq %rdx, {{.*}} +; LINUX-X32-DAG: movq %rcx, {{.*}} +; LINUX-X32-DAG: movq %r8, {{.*}} +; LINUX-X32-DAG: movq %r9, {{.*}} +; LINUX-X32-DAG: movb %al, {{.*}} +; LINUX-X32-DAG: movaps %xmm0, {{[0-9]*}}(%esp) +; LINUX-X32-DAG: movaps %xmm1, {{[0-9]*}}(%esp) +; LINUX-X32-DAG: movaps %xmm2, {{[0-9]*}}(%esp) +; LINUX-X32-DAG: movaps %xmm3, {{[0-9]*}}(%esp) +; LINUX-X32-DAG: movaps %xmm4, {{[0-9]*}}(%esp) +; LINUX-X32-DAG: movaps %xmm5, {{[0-9]*}}(%esp) +; LINUX-X32-DAG: movaps %xmm6, {{[0-9]*}}(%esp) +; LINUX-X32-DAG: movaps %xmm7, {{[0-9]*}}(%esp) +; LINUX-X32: callq get_f +; LINUX-X32-DAG: movaps {{[0-9]*}}(%esp), %xmm0 +; LINUX-X32-DAG: movaps {{[0-9]*}}(%esp), %xmm1 +; LINUX-X32-DAG: movaps {{[0-9]*}}(%esp), %xmm2 +; LINUX-X32-DAG: movaps {{[0-9]*}}(%esp), %xmm3 +; LINUX-X32-DAG: movaps {{[0-9]*}}(%esp), %xmm4 +; LINUX-X32-DAG: movaps {{[0-9]*}}(%esp), %xmm5 +; LINUX-X32-DAG: movaps {{[0-9]*}}(%esp), %xmm6 +; LINUX-X32-DAG: movaps {{[0-9]*}}(%esp), %xmm7 +; LINUX-X32-DAG: movl {{.*}}, %edi +; LINUX-X32-DAG: movq {{.*}}, %rsi +; LINUX-X32-DAG: movq {{.*}}, %rdx +; LINUX-X32-DAG: movq {{.*}}, %rcx +; LINUX-X32-DAG: movq {{.*}}, %r8 +; LINUX-X32-DAG: movq {{.*}}, %r9 +; LINUX-X32-DAG: movb {{.*}}, %al +; LINUX-X32: jmpq *{{.*}} # TAILCALL + ; WINDOWS-LABEL: f_thunk: ; WINDOWS-NOT: mov{{.}}ps ; WINDOWS-DAG: movq %rdx, {{.*}} @@ -84,7 +119,7 @@ define void @g_thunk(i8* %fptr_i8, ...) { %fptr = bitcast i8* %fptr_i8 to void (i8*, ...)* - musttail call void (i8*, ...)* %fptr(i8* %fptr_i8, ...) + musttail call void (i8*, ...) %fptr(i8* %fptr_i8, ...) ret void } @@ -92,6 +127,10 @@ ; LINUX-NOT: movq ; LINUX: jmpq *%rdi # TAILCALL +; LINUX-X32-LABEL: g_thunk: +; LINUX-X32-DAG: movl %edi, %[[REG:e[abcd]x|ebp|esi|edi|r8|r9|r1[0-5]]] +; LINUX-X32-DAG: jmpq *%[[REG]] # TAILCALL + ; WINDOWS-LABEL: g_thunk: ; WINDOWS-NOT: movq ; WINDOWS: jmpq *%rcx # TAILCALL @@ -106,23 +145,23 @@ @g = external global i32 define void @h_thunk(%struct.Foo* %this, ...) { - %cond_p = getelementptr %struct.Foo* %this, i32 0, i32 0 - %cond = load i1* %cond_p + %cond_p = getelementptr %struct.Foo, %struct.Foo* %this, i32 0, i32 0 + %cond = load i1, i1* %cond_p br i1 %cond, label %then, label %else then: - %a_p = getelementptr %struct.Foo* %this, i32 0, i32 1 - %a_i8 = load i8** %a_p + %a_p = getelementptr %struct.Foo, %struct.Foo* %this, i32 0, i32 1 + %a_i8 = load i8*, i8** %a_p %a = bitcast i8* %a_i8 to void (%struct.Foo*, ...)* - musttail call void (%struct.Foo*, ...)* %a(%struct.Foo* %this, ...) + musttail call void (%struct.Foo*, ...) %a(%struct.Foo* %this, ...) ret void else: - %b_p = getelementptr %struct.Foo* %this, i32 0, i32 2 - %b_i8 = load i8** %b_p + %b_p = getelementptr %struct.Foo, %struct.Foo* %this, i32 0, i32 2 + %b_i8 = load i8*, i8** %b_p %b = bitcast i8* %b_i8 to void (%struct.Foo*, ...)* store i32 42, i32* @g - musttail call void (%struct.Foo*, ...)* %b(%struct.Foo* %this, ...) + musttail call void (%struct.Foo*, ...) %b(%struct.Foo* %this, ...) ret void } @@ -130,6 +169,10 @@ ; LINUX: jne ; LINUX: jmpq *{{.*}} # TAILCALL ; LINUX: jmpq *{{.*}} # TAILCALL +; LINUX-X32-LABEL: h_thunk: +; LINUX-X32: jne +; LINUX-X32: jmpq *{{.*}} # TAILCALL +; LINUX-X32: jmpq *{{.*}} # TAILCALL ; WINDOWS-LABEL: h_thunk: ; WINDOWS: jne ; WINDOWS: jmpq *{{.*}} # TAILCALL