xref: /llvm-project/llvm/test/CodeGen/X86/preserve_mostcc64_win.ll (revision f6c7baea098aac03687f5041fc860ca95f070e4e)
1; RUN: sed -e "s/RETTYPE/void/;s/RETVAL//" %s | llc -mtriple=x86_64-win32 -mcpu=corei7 | FileCheck --check-prefixes=ALL,VOID %s
2; RUN: sed -e "s/RETTYPE/i32/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-win32 -mcpu=corei7 | FileCheck --check-prefixes=ALL,INT %s
3; RUN: sed -e "s/RETTYPE/\{i64\,i64\}/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-win32 -mcpu=corei7 | FileCheck --check-prefixes=ALL,INT128 %s
4
5; Every GPR should be saved, except r11 and return registers.
6; XMM registers 6-15 should also be saved.
7define preserve_mostcc RETTYPE @preserve_mostcc1(i64, i64, double, double) nounwind {
8entry:
9;ALL-LABEL:   preserve_mostcc1
10;ALL:         pushq %r10
11;ALL-NEXT:    pushq %r9
12;ALL-NEXT:    pushq %r8
13;ALL-NEXT:    pushq %rdi
14;ALL-NEXT:    pushq %rsi
15;VOID-NEXT:   pushq %rdx
16;INT-NEXT:    pushq %rdx
17;INT128-NOT:  pushq %rdx
18;ALL-NEXT:    pushq %rcx
19;VOID-NEXT:   pushq %rax
20;INT-NOT:     pushq %rax
21;INT128-NOT:  pushq %rax
22;ALL-NEXT:    pushq %rbp
23;ALL-NEXT:    pushq %r15
24;ALL-NEXT:    pushq %r14
25;ALL-NEXT:    pushq %r13
26;ALL-NEXT:    pushq %r12
27;ALL-NEXT:    pushq %rbx
28;ALL:         movaps %xmm15
29;ALL-NEXT:    movaps %xmm14
30;ALL-NEXT:    movaps %xmm13
31;ALL-NEXT:    movaps %xmm12
32;ALL-NEXT:    movaps %xmm11
33;ALL-NEXT:    movaps %xmm10
34;ALL-NEXT:    movaps %xmm9
35;ALL-NEXT:    movaps %xmm8
36;ALL-NEXT:    movaps %xmm7
37;ALL-NEXT:    movaps %xmm6
38;ALL-NOT:     movaps %xmm5
39;ALL-NOT:     movaps %xmm4
40;ALL-NOT:     movaps %xmm3
41;ALL-NOT:     movaps %xmm2
42;ALL-NOT:     movaps %xmm1
43;ALL-NOT:     movaps %xmm0
44;ALL-NOT:     movaps {{.*}} %xmm0
45;ALL-NOT:     movaps {{.*}} %xmm1
46;ALL-NOT:     movaps {{.*}} %xmm2
47;ALL-NOT:     movaps {{.*}} %xmm3
48;ALL-NOT:     movaps {{.*}} %xmm4
49;ALL-NOT:     movaps {{.*}} %xmm5
50;ALL:         movaps {{.*}} %xmm6
51;ALL-NEXT:    movaps {{.*}} %xmm7
52;ALL-NEXT:    movaps {{.*}} %xmm8
53;ALL-NEXT:    movaps {{.*}} %xmm9
54;ALL-NEXT:    movaps {{.*}} %xmm10
55;ALL-NEXT:    movaps {{.*}} %xmm11
56;ALL-NEXT:    movaps {{.*}} %xmm12
57;ALL-NEXT:    movaps {{.*}} %xmm13
58;ALL-NEXT:    movaps {{.*}} %xmm14
59;ALL-NEXT:    movaps {{.*}} %xmm15
60;ALL:         popq    %rbx
61;ALL-NEXT:    popq    %r12
62;ALL-NEXT:    popq    %r13
63;ALL-NEXT:    popq    %r14
64;ALL-NEXT:    popq    %r15
65;ALL-NEXT:    popq    %rbp
66;VOID-NEXT:   popq    %rax
67;INT-NOT:     popq    %rax
68;INT128-NOT:  popq    %rax
69;ALL-NEXT:    popq    %rcx
70;VOID-NEXT:   popq    %rdx
71;INT-NEXT:    popq    %rdx
72;INT128-NOT:  popq    %rdx
73;ALL-NEXT:    popq    %rsi
74;ALL-NEXT:    popq    %rdi
75;ALL-NEXT:    popq    %r8
76;ALL-NEXT:    popq    %r9
77;ALL-NEXT:    popq    %r10
78  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}"()
79  ret RETTYPE RETVAL
80}
81
82; Make sure XMMs are not saved before the call
83declare preserve_mostcc RETTYPE @foo(i64, i64, double, double)
84define void @preserve_mostcc2() nounwind {
85entry:
86;ALL-LABEL: preserve_mostcc2
87;ALL-NOT:   movaps
88;ALL-NOT:   {{.*xmm[0-1,4-9].*}}
89  call preserve_mostcc RETTYPE @foo(i64 1, i64 2, double 3.0, double 4.0)
90  ret void
91}
92