1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck --check-prefix=SSE %s 2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck --check-prefix=AVX %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; Every GPR should be saved - except r11 5*9880d681SAndroid Build Coastguard Workerdefine preserve_mostcc void @preserve_mostcc1() nounwind { 6*9880d681SAndroid Build Coastguard Workerentry: 7*9880d681SAndroid Build Coastguard Worker;SSE-LABEL: preserve_mostcc1 8*9880d681SAndroid Build Coastguard Worker;SSE: pushq %r10 9*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %r9 10*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %r8 11*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %rdi 12*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %rsi 13*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %rdx 14*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %rcx 15*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %rax 16*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %rbp 17*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %r15 18*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %r14 19*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %r13 20*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %r12 21*9880d681SAndroid Build Coastguard Worker;SSE-NEXT: pushq %rbx 22*9880d681SAndroid Build Coastguard Worker;AVX-LABEL: preserve_mostcc1 23*9880d681SAndroid Build Coastguard Worker;AVX: pushq %r10 24*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %r9 25*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %r8 26*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %rdi 27*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %rsi 28*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %rdx 29*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %rcx 30*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %rax 31*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %rbp 32*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %r15 33*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %r14 34*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %r13 35*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %r12 36*9880d681SAndroid Build Coastguard Worker;AVX-NEXT: pushq %rbx 37*9880d681SAndroid Build Coastguard Worker call void asm sideeffect "", "~{rax},~{rbx},~{rcx},~{rdx},~{rsi},~{rdi},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{rbp},~{xmm0},~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15}"() 38*9880d681SAndroid Build Coastguard Worker ret void 39*9880d681SAndroid Build Coastguard Worker} 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker; Make sure R11 and XMMs are saved before the call 42*9880d681SAndroid Build Coastguard Workerdeclare preserve_mostcc void @foo(i64, i64, double, double) 43*9880d681SAndroid Build Coastguard Workerdefine void @preserve_mostcc2() nounwind { 44*9880d681SAndroid Build Coastguard Workerentry: 45*9880d681SAndroid Build Coastguard Worker;SSE-LABEL: preserve_mostcc2 46*9880d681SAndroid Build Coastguard Worker;SSE: movq %r11, [[REG:%[a-z0-9]+]] 47*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm2 48*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm3 49*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm4 50*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm5 51*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm6 52*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm7 53*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm8 54*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm9 55*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm10 56*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm11 57*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm12 58*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm13 59*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm14 60*9880d681SAndroid Build Coastguard Worker;SSE: movaps %xmm15 61*9880d681SAndroid Build Coastguard Worker;SSE: movq [[REG]], %r11 62*9880d681SAndroid Build Coastguard Worker %a0 = call i64 asm sideeffect "", "={rax}"() nounwind 63*9880d681SAndroid Build Coastguard Worker %a1 = call i64 asm sideeffect "", "={rcx}"() nounwind 64*9880d681SAndroid Build Coastguard Worker %a2 = call i64 asm sideeffect "", "={rdx}"() nounwind 65*9880d681SAndroid Build Coastguard Worker %a3 = call i64 asm sideeffect "", "={r8}"() nounwind 66*9880d681SAndroid Build Coastguard Worker %a4 = call i64 asm sideeffect "", "={r9}"() nounwind 67*9880d681SAndroid Build Coastguard Worker %a5 = call i64 asm sideeffect "", "={r10}"() nounwind 68*9880d681SAndroid Build Coastguard Worker %a6 = call i64 asm sideeffect "", "={r11}"() nounwind 69*9880d681SAndroid Build Coastguard Worker %a10 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind 70*9880d681SAndroid Build Coastguard Worker %a11 = call <2 x double> asm sideeffect "", "={xmm3}"() nounwind 71*9880d681SAndroid Build Coastguard Worker %a12 = call <2 x double> asm sideeffect "", "={xmm4}"() nounwind 72*9880d681SAndroid Build Coastguard Worker %a13 = call <2 x double> asm sideeffect "", "={xmm5}"() nounwind 73*9880d681SAndroid Build Coastguard Worker %a14 = call <2 x double> asm sideeffect "", "={xmm6}"() nounwind 74*9880d681SAndroid Build Coastguard Worker %a15 = call <2 x double> asm sideeffect "", "={xmm7}"() nounwind 75*9880d681SAndroid Build Coastguard Worker %a16 = call <2 x double> asm sideeffect "", "={xmm8}"() nounwind 76*9880d681SAndroid Build Coastguard Worker %a17 = call <2 x double> asm sideeffect "", "={xmm9}"() nounwind 77*9880d681SAndroid Build Coastguard Worker %a18 = call <2 x double> asm sideeffect "", "={xmm10}"() nounwind 78*9880d681SAndroid Build Coastguard Worker %a19 = call <2 x double> asm sideeffect "", "={xmm11}"() nounwind 79*9880d681SAndroid Build Coastguard Worker %a20 = call <2 x double> asm sideeffect "", "={xmm12}"() nounwind 80*9880d681SAndroid Build Coastguard Worker %a21 = call <2 x double> asm sideeffect "", "={xmm13}"() nounwind 81*9880d681SAndroid Build Coastguard Worker %a22 = call <2 x double> asm sideeffect "", "={xmm14}"() nounwind 82*9880d681SAndroid Build Coastguard Worker %a23 = call <2 x double> asm sideeffect "", "={xmm15}"() nounwind 83*9880d681SAndroid Build Coastguard Worker call preserve_mostcc void @foo(i64 1, i64 2, double 3.0, double 4.0) 84*9880d681SAndroid Build Coastguard Worker call void asm sideeffect "", "{rax},{rcx},{rdx},{r8},{r9},{r10},{r11},{xmm2},{xmm3},{xmm4},{xmm5},{xmm6},{xmm7},{xmm8},{xmm9},{xmm10},{xmm11},{xmm12},{xmm13},{xmm14},{xmm15}"(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, i64 %a5, i64 %a6, <2 x double> %a10, <2 x double> %a11, <2 x double> %a12, <2 x double> %a13, <2 x double> %a14, <2 x double> %a15, <2 x double> %a16, <2 x double> %a17, <2 x double> %a18, <2 x double> %a19, <2 x double> %a20, <2 x double> %a21, <2 x double> %a22, <2 x double> %a23) 85*9880d681SAndroid Build Coastguard Worker ret void 86*9880d681SAndroid Build Coastguard Worker} 87