xref: /llvm-project/llvm/test/CodeGen/X86/byval4.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-linux -mattr=-avx | FileCheck %s -check-prefix=X64
3; Win64 has not supported byval yet.
4; RUN: llc < %s -mtriple=i686-- -mattr=-avx | FileCheck %s -check-prefix=X86
5
6%struct.s = type { i16, i16, i16, i16, i16, i16, i16, i16,
7                   i16, i16, i16, i16, i16, i16, i16, i16,
8                   i16, i16, i16, i16, i16, i16, i16, i16,
9                   i16, i16, i16, i16, i16, i16, i16, i16,
10                   i16, i16, i16, i16, i16, i16, i16, i16,
11                   i16, i16, i16, i16, i16, i16, i16, i16,
12                   i16, i16, i16, i16, i16, i16, i16, i16,
13                   i16, i16, i16, i16, i16, i16, i16, i16,
14                   i16 }
15
16
17define void @g(i16 signext  %a1, i16 signext  %a2, i16 signext  %a3,
18; X64-LABEL: g:
19; X64:       # %bb.0: # %entry
20; X64-NEXT:    pushq %rbx
21; X64-NEXT:    subq $288, %rsp # imm = 0x120
22; X64-NEXT:    movw %di, {{[0-9]+}}(%rsp)
23; X64-NEXT:    movw %si, {{[0-9]+}}(%rsp)
24; X64-NEXT:    movw %dx, {{[0-9]+}}(%rsp)
25; X64-NEXT:    movw %cx, {{[0-9]+}}(%rsp)
26; X64-NEXT:    movw %r8w, {{[0-9]+}}(%rsp)
27; X64-NEXT:    movw %r9w, {{[0-9]+}}(%rsp)
28; X64-NEXT:    leaq {{[0-9]+}}(%rsp), %rbx
29; X64-NEXT:    movl $16, %ecx
30; X64-NEXT:    movq %rsp, %rdi
31; X64-NEXT:    movq %rbx, %rsi
32; X64-NEXT:    rep;movsq (%rsi), %es:(%rdi)
33; X64-NEXT:    movzwl {{[0-9]+}}(%rsp), %eax
34; X64-NEXT:    movw %ax, {{[0-9]+}}(%rsp)
35; X64-NEXT:    callq f@PLT
36; X64-NEXT:    movl $16, %ecx
37; X64-NEXT:    movq %rsp, %rdi
38; X64-NEXT:    movq %rbx, %rsi
39; X64-NEXT:    rep;movsq (%rsi), %es:(%rdi)
40; X64-NEXT:    movzwl {{[0-9]+}}(%rsp), %eax
41; X64-NEXT:    movw %ax, {{[0-9]+}}(%rsp)
42; X64-NEXT:    callq f@PLT
43; X64-NEXT:    addq $288, %rsp # imm = 0x120
44; X64-NEXT:    popq %rbx
45; X64-NEXT:    retq
46;
47; X86-LABEL: g:
48; X86:       # %bb.0: # %entry
49; X86-NEXT:    pushl %ebp
50; X86-NEXT:    movl %esp, %ebp
51; X86-NEXT:    pushl %ebx
52; X86-NEXT:    pushl %edi
53; X86-NEXT:    pushl %esi
54; X86-NEXT:    andl $-16, %esp
55; X86-NEXT:    subl $288, %esp # imm = 0x120
56; X86-NEXT:    movzwl 8(%ebp), %eax
57; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)
58; X86-NEXT:    movzwl 12(%ebp), %eax
59; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)
60; X86-NEXT:    movzwl 16(%ebp), %eax
61; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)
62; X86-NEXT:    movzwl 20(%ebp), %eax
63; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)
64; X86-NEXT:    movzwl 24(%ebp), %eax
65; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)
66; X86-NEXT:    movzwl 28(%ebp), %eax
67; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)
68; X86-NEXT:    leal {{[0-9]+}}(%esp), %ebx
69; X86-NEXT:    movl $32, %ecx
70; X86-NEXT:    movl %esp, %edi
71; X86-NEXT:    movl %ebx, %esi
72; X86-NEXT:    rep;movsl (%esi), %es:(%edi)
73; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
74; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)
75; X86-NEXT:    calll f@PLT
76; X86-NEXT:    movl $32, %ecx
77; X86-NEXT:    movl %esp, %edi
78; X86-NEXT:    movl %ebx, %esi
79; X86-NEXT:    rep;movsl (%esi), %es:(%edi)
80; X86-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
81; X86-NEXT:    movw %ax, {{[0-9]+}}(%esp)
82; X86-NEXT:    calll f@PLT
83; X86-NEXT:    leal -12(%ebp), %esp
84; X86-NEXT:    popl %esi
85; X86-NEXT:    popl %edi
86; X86-NEXT:    popl %ebx
87; X86-NEXT:    popl %ebp
88; X86-NEXT:    retl
89	 i16 signext  %a4, i16 signext  %a5, i16 signext  %a6) nounwind {
90entry:
91        %a = alloca %struct.s, align 16
92        store i16 %a1, ptr %a, align 16
93        %tmp2 = getelementptr %struct.s, ptr %a, i32 0, i32 1
94        store i16 %a2, ptr %tmp2, align 16
95        %tmp4 = getelementptr %struct.s, ptr %a, i32 0, i32 2
96        store i16 %a3, ptr %tmp4, align 16
97        %tmp6 = getelementptr %struct.s, ptr %a, i32 0, i32 3
98        store i16 %a4, ptr %tmp6, align 16
99        %tmp8 = getelementptr %struct.s, ptr %a, i32 0, i32 4
100        store i16 %a5, ptr %tmp8, align 16
101        %tmp10 = getelementptr %struct.s, ptr %a, i32 0, i32 5
102        store i16 %a6, ptr %tmp10, align 16
103        call void @f(ptr byval(%struct.s) %a)
104        call void @f(ptr byval(%struct.s) %a)
105        ret void
106}
107
108declare void @f(ptr byval(%struct.s))
109