1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; When we accept small parameters on Windows, make sure we do not assume they
3 ; are zero or sign extended in memory or in registers.
5 ; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefix=WIN64
6 ; RUN: llc < %s -mtriple=x86_64-windows-gnu | FileCheck %s --check-prefix=WIN64
7 ; RUN: llc < %s -mtriple=i686-windows-msvc | FileCheck %s --check-prefix=WIN32-MSVC
8 ; RUN: llc < %s -mtriple=i686-windows-gnu | FileCheck %s --check-prefix=WIN32-GNU
12 ; WIN64: # %bb.0: # %entry
13 ; WIN64-NEXT: subq $56, %rsp
14 ; WIN64-NEXT: .seh_stackalloc 56
15 ; WIN64-NEXT: .seh_endprologue
16 ; WIN64-NEXT: movw $6, {{[0-9]+}}(%rsp)
17 ; WIN64-NEXT: movb $5, {{[0-9]+}}(%rsp)
18 ; WIN64-NEXT: movb $1, %cl
19 ; WIN64-NEXT: movw $2, %dx
20 ; WIN64-NEXT: movb $3, %r8b
21 ; WIN64-NEXT: movw $4, %r9w
22 ; WIN64-NEXT: callq manyargs
24 ; WIN64-NEXT: addq $56, %rsp
26 ; WIN64-NEXT: .seh_endproc
28 ; WIN32-MSVC-LABEL: call:
29 ; WIN32-MSVC: # %bb.0: # %entry
30 ; WIN32-MSVC-NEXT: pushl $6
31 ; WIN32-MSVC-NEXT: pushl $5
32 ; WIN32-MSVC-NEXT: pushl $4
33 ; WIN32-MSVC-NEXT: pushl $3
34 ; WIN32-MSVC-NEXT: pushl $2
35 ; WIN32-MSVC-NEXT: pushl $1
36 ; WIN32-MSVC-NEXT: calll _manyargs
37 ; WIN32-MSVC-NEXT: addl $24, %esp
38 ; WIN32-MSVC-NEXT: retl
40 ; WIN32-GNU-LABEL: call:
41 ; WIN32-GNU: # %bb.0: # %entry
42 ; WIN32-GNU-NEXT: pushl $6
43 ; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
44 ; WIN32-GNU-NEXT: pushl $5
45 ; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
46 ; WIN32-GNU-NEXT: pushl $4
47 ; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
48 ; WIN32-GNU-NEXT: pushl $3
49 ; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
50 ; WIN32-GNU-NEXT: pushl $2
51 ; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
52 ; WIN32-GNU-NEXT: pushl $1
53 ; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset 4
54 ; WIN32-GNU-NEXT: calll _manyargs
55 ; WIN32-GNU-NEXT: addl $24, %esp
56 ; WIN32-GNU-NEXT: .cfi_adjust_cfa_offset -24
57 ; WIN32-GNU-NEXT: retl
59 %rv = call i32 @manyargs(i8 1, i16 2, i8 3, i16 4, i8 5, i16 6)
63 define i32 @manyargs(i8 %a, i16 %b, i8 %c, i16 %d, i8 %e, i16 %f) {
64 ; WIN64-LABEL: manyargs:
65 ; WIN64: # %bb.0: # %entry
66 ; WIN64-NEXT: movzwl {{[0-9]+}}(%rsp), %r10d
67 ; WIN64-NEXT: movzbl {{[0-9]+}}(%rsp), %r11d
68 ; WIN64-NEXT: movsbl %cl, %eax
69 ; WIN64-NEXT: movswl %dx, %ecx
70 ; WIN64-NEXT: addl %eax, %ecx
71 ; WIN64-NEXT: movzbl %r8b, %edx
72 ; WIN64-NEXT: movzwl %r9w, %eax
73 ; WIN64-NEXT: addl %edx, %eax
74 ; WIN64-NEXT: addl %ecx, %eax
75 ; WIN64-NEXT: addl %r11d, %eax
76 ; WIN64-NEXT: addl %r10d, %eax
79 ; WIN32-MSVC-LABEL: manyargs:
80 ; WIN32-MSVC: # %bb.0: # %entry
81 ; WIN32-MSVC-NEXT: pushl %esi
82 ; WIN32-MSVC-NEXT: movzwl {{[0-9]+}}(%esp), %eax
83 ; WIN32-MSVC-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
84 ; WIN32-MSVC-NEXT: addl %eax, %ecx
85 ; WIN32-MSVC-NEXT: movzwl {{[0-9]+}}(%esp), %eax
86 ; WIN32-MSVC-NEXT: movzbl {{[0-9]+}}(%esp), %edx
87 ; WIN32-MSVC-NEXT: addl %eax, %edx
88 ; WIN32-MSVC-NEXT: movswl {{[0-9]+}}(%esp), %esi
89 ; WIN32-MSVC-NEXT: movsbl {{[0-9]+}}(%esp), %eax
90 ; WIN32-MSVC-NEXT: addl %esi, %eax
91 ; WIN32-MSVC-NEXT: addl %edx, %eax
92 ; WIN32-MSVC-NEXT: addl %ecx, %eax
93 ; WIN32-MSVC-NEXT: popl %esi
94 ; WIN32-MSVC-NEXT: retl
96 ; WIN32-GNU-LABEL: manyargs:
97 ; WIN32-GNU: # %bb.0: # %entry
98 ; WIN32-GNU-NEXT: pushl %esi
99 ; WIN32-GNU-NEXT: .cfi_def_cfa_offset 8
100 ; WIN32-GNU-NEXT: .cfi_offset %esi, -8
101 ; WIN32-GNU-NEXT: movzwl {{[0-9]+}}(%esp), %eax
102 ; WIN32-GNU-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
103 ; WIN32-GNU-NEXT: addl %eax, %ecx
104 ; WIN32-GNU-NEXT: movzwl {{[0-9]+}}(%esp), %eax
105 ; WIN32-GNU-NEXT: movzbl {{[0-9]+}}(%esp), %edx
106 ; WIN32-GNU-NEXT: addl %eax, %edx
107 ; WIN32-GNU-NEXT: movswl {{[0-9]+}}(%esp), %esi
108 ; WIN32-GNU-NEXT: movsbl {{[0-9]+}}(%esp), %eax
109 ; WIN32-GNU-NEXT: addl %esi, %eax
110 ; WIN32-GNU-NEXT: addl %edx, %eax
111 ; WIN32-GNU-NEXT: addl %ecx, %eax
112 ; WIN32-GNU-NEXT: popl %esi
113 ; WIN32-GNU-NEXT: retl
115 %aa = sext i8 %a to i32
116 %bb = sext i16 %b to i32
117 %cc = zext i8 %c to i32
118 %dd = zext i16 %d to i32
119 %ee = zext i8 %e to i32
120 %ff = zext i16 %f to i32
121 %t0 = add i32 %aa, %bb
122 %t1 = add i32 %t0, %cc
123 %t2 = add i32 %t1, %dd
124 %t3 = add i32 %t2, %ee
125 %t4 = add i32 %t3, %ff