xref: /llvm-project/llvm/test/CodeGen/X86/preserve_nonecc64.ll (revision c166a43c6e6157b1309ea757324cc0a71c078e66)
1; RUN: sed -e "s/RETTYPE/void/;s/RETVAL//" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck --check-prefixes=ALL %s
2; RUN: sed -e "s/RETTYPE/i32/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck --check-prefixes=ALL %s
3; RUN: sed -e "s/RETTYPE/\{i64\,i64\}/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck --check-prefixes=ALL %s
4;
5; RUN: sed -e "s/RETTYPE/void/;s/RETVAL//" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck --check-prefixes=ALL %s
6; RUN: sed -e "s/RETTYPE/i32/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck --check-prefixes=ALL %s
7; RUN: sed -e "s/RETTYPE/\{i64\,i64\}/;s/RETVAL/undef/" %s | llc -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck --check-prefixes=ALL %s
8
9; We don't need to save registers before using them inside preserve_none function.
10define preserve_nonecc RETTYPE @preserve_nonecc1(i64, i64, double, double) nounwind {
11entry:
12;ALL-LABEL:   preserve_nonecc1
13;ALL:         pushq %rbp
14;ALL-NEXT:    InlineAsm Start
15;ALL-NEXT:    InlineAsm End
16;ALL-NEXT:    popq %rbp
17;ALL-NEXT:    retq
18  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}"()
19  ret RETTYPE RETVAL
20}
21
22; When calling a preserve_none function, all live registers must be saved and
23; restored around the function call.
24declare preserve_nonecc RETTYPE @bar(i64, i64, double, double)
25define void @preserve_nonecc2() nounwind {
26entry:
27;ALL-LABEL: preserve_nonecc2
28;ALL:       movq %rax
29;ALL:       movq %rdx
30;ALL:       movq %r11
31;ALL:       movaps %xmm2
32;ALL:       movaps %xmm3
33;ALL:       movaps %xmm4
34;ALL:       movaps %xmm5
35;ALL:       movaps %xmm6
36;ALL:       movaps %xmm7
37;ALL:       movaps %xmm8
38;ALL:       movaps %xmm9
39;ALL:       movaps %xmm10
40;ALL:       movaps %xmm11
41;ALL:       movaps %xmm12
42;ALL:       movaps %xmm13
43;ALL:       movaps %xmm14
44;ALL:       movaps %xmm15
45;ALL:       movq {{.*}}, %rax
46;ALL:       movq {{.*}}, %rdx
47;ALL:       movq {{.*}}, %r11
48;ALL:       movaps {{.*}} %xmm2
49;ALL:       movaps {{.*}} %xmm3
50;ALL:       movaps {{.*}} %xmm4
51;ALL:       movaps {{.*}} %xmm5
52;ALL:       movaps {{.*}} %xmm6
53;ALL:       movaps {{.*}} %xmm7
54;ALL:       movaps {{.*}} %xmm8
55;ALL:       movaps {{.*}} %xmm9
56;ALL:       movaps {{.*}} %xmm10
57;ALL:       movaps {{.*}} %xmm11
58;ALL:       movaps {{.*}} %xmm12
59;ALL:       movaps {{.*}} %xmm13
60;ALL:       movaps {{.*}} %xmm14
61;ALL:       movaps {{.*}} %xmm15
62  %a0 = call i64 asm sideeffect "", "={rax}"() nounwind
63  %a1 = call i64 asm sideeffect "", "={rcx}"() nounwind
64  %a2 = call i64 asm sideeffect "", "={rdx}"() nounwind
65  %a3 = call i64 asm sideeffect "", "={r8}"() nounwind
66  %a4 = call i64 asm sideeffect "", "={r9}"() nounwind
67  %a5 = call i64 asm sideeffect "", "={r10}"() nounwind
68  %a6 = call i64 asm sideeffect "", "={r11}"() nounwind
69  %a10 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
70  %a11 = call <2 x double> asm sideeffect "", "={xmm3}"() nounwind
71  %a12 = call <2 x double> asm sideeffect "", "={xmm4}"() nounwind
72  %a13 = call <2 x double> asm sideeffect "", "={xmm5}"() nounwind
73  %a14 = call <2 x double> asm sideeffect "", "={xmm6}"() nounwind
74  %a15 = call <2 x double> asm sideeffect "", "={xmm7}"() nounwind
75  %a16 = call <2 x double> asm sideeffect "", "={xmm8}"() nounwind
76  %a17 = call <2 x double> asm sideeffect "", "={xmm9}"() nounwind
77  %a18 = call <2 x double> asm sideeffect "", "={xmm10}"() nounwind
78  %a19 = call <2 x double> asm sideeffect "", "={xmm11}"() nounwind
79  %a20 = call <2 x double> asm sideeffect "", "={xmm12}"() nounwind
80  %a21 = call <2 x double> asm sideeffect "", "={xmm13}"() nounwind
81  %a22 = call <2 x double> asm sideeffect "", "={xmm14}"() nounwind
82  %a23 = call <2 x double> asm sideeffect "", "={xmm15}"() nounwind
83  call preserve_nonecc RETTYPE @bar(i64 1, i64 2, double 3.0, double 4.0)
84  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  ret void
86}
87