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