memcpy-struct-by-value.ll
6.79 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=i686-linux-gnu -mattr=-ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST32
; RUN: llc -mtriple=i686-linux-gnu -mattr=+ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST32
; RUN: llc -mtriple=x86_64-linux-gnu -mattr=-ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST
; RUN: llc -mtriple=x86_64-linux-gnu -mattr=+ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST
; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=generic < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST
; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=haswell < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST
; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=skylake < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST
; FIXME: The documentation states that ivybridge has ermsb, but this is not
; enabled right now since I could not confirm by testing.
; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=ivybridge < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST
%struct.large = type { [4096 x i8] }
declare void @foo(%struct.large* align 8 byval) nounwind
define void @test1(%struct.large* nocapture %x) nounwind {
; NOFAST32-LABEL: test1:
; NOFAST32: # %bb.0:
; NOFAST32-NEXT: pushl %edi
; NOFAST32-NEXT: pushl %esi
; NOFAST32-NEXT: subl $4100, %esp # imm = 0x1004
; NOFAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
; NOFAST32-NEXT: movl $1024, %ecx # imm = 0x400
; NOFAST32-NEXT: movl %esp, %edi
; NOFAST32-NEXT: rep;movsl (%esi), %es:(%edi)
; NOFAST32-NEXT: calll foo
; NOFAST32-NEXT: addl $4100, %esp # imm = 0x1004
; NOFAST32-NEXT: popl %esi
; NOFAST32-NEXT: popl %edi
; NOFAST32-NEXT: retl
;
; FAST32-LABEL: test1:
; FAST32: # %bb.0:
; FAST32-NEXT: pushl %edi
; FAST32-NEXT: pushl %esi
; FAST32-NEXT: subl $4100, %esp # imm = 0x1004
; FAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
; FAST32-NEXT: movl $4096, %ecx # imm = 0x1000
; FAST32-NEXT: movl %esp, %edi
; FAST32-NEXT: rep;movsb (%esi), %es:(%edi)
; FAST32-NEXT: calll foo
; FAST32-NEXT: addl $4100, %esp # imm = 0x1004
; FAST32-NEXT: popl %esi
; FAST32-NEXT: popl %edi
; FAST32-NEXT: retl
;
; NOFAST-LABEL: test1:
; NOFAST: # %bb.0:
; NOFAST-NEXT: subq $4104, %rsp # imm = 0x1008
; NOFAST-NEXT: movq %rdi, %rsi
; NOFAST-NEXT: movl $512, %ecx # imm = 0x200
; NOFAST-NEXT: movq %rsp, %rdi
; NOFAST-NEXT: rep;movsq (%rsi), %es:(%rdi)
; NOFAST-NEXT: callq foo
; NOFAST-NEXT: addq $4104, %rsp # imm = 0x1008
; NOFAST-NEXT: retq
;
; FAST-LABEL: test1:
; FAST: # %bb.0:
; FAST-NEXT: subq $4104, %rsp # imm = 0x1008
; FAST-NEXT: movq %rdi, %rsi
; FAST-NEXT: movl $4096, %ecx # imm = 0x1000
; FAST-NEXT: movq %rsp, %rdi
; FAST-NEXT: rep;movsb (%rsi), %es:(%rdi)
; FAST-NEXT: callq foo
; FAST-NEXT: addq $4104, %rsp # imm = 0x1008
; FAST-NEXT: retq
call void @foo(%struct.large* align 8 byval %x)
ret void
}
define void @test2(%struct.large* nocapture %x) nounwind minsize {
; NOFAST32-LABEL: test2:
; NOFAST32: # %bb.0:
; NOFAST32-NEXT: pushl %edi
; NOFAST32-NEXT: pushl %esi
; NOFAST32-NEXT: subl $4100, %esp # imm = 0x1004
; NOFAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
; NOFAST32-NEXT: movl $1024, %ecx # imm = 0x400
; NOFAST32-NEXT: movl %esp, %edi
; NOFAST32-NEXT: rep;movsl (%esi), %es:(%edi)
; NOFAST32-NEXT: calll foo
; NOFAST32-NEXT: addl $4100, %esp # imm = 0x1004
; NOFAST32-NEXT: popl %esi
; NOFAST32-NEXT: popl %edi
; NOFAST32-NEXT: retl
;
; FAST32-LABEL: test2:
; FAST32: # %bb.0:
; FAST32-NEXT: pushl %edi
; FAST32-NEXT: pushl %esi
; FAST32-NEXT: subl $4100, %esp # imm = 0x1004
; FAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
; FAST32-NEXT: movl $4096, %ecx # imm = 0x1000
; FAST32-NEXT: movl %esp, %edi
; FAST32-NEXT: rep;movsb (%esi), %es:(%edi)
; FAST32-NEXT: calll foo
; FAST32-NEXT: addl $4100, %esp # imm = 0x1004
; FAST32-NEXT: popl %esi
; FAST32-NEXT: popl %edi
; FAST32-NEXT: retl
;
; NOFAST-LABEL: test2:
; NOFAST: # %bb.0:
; NOFAST-NEXT: subq $4104, %rsp # imm = 0x1008
; NOFAST-NEXT: movq %rdi, %rsi
; NOFAST-NEXT: movl $512, %ecx # imm = 0x200
; NOFAST-NEXT: movq %rsp, %rdi
; NOFAST-NEXT: rep;movsq (%rsi), %es:(%rdi)
; NOFAST-NEXT: callq foo
; NOFAST-NEXT: addq $4104, %rsp # imm = 0x1008
; NOFAST-NEXT: retq
;
; FAST-LABEL: test2:
; FAST: # %bb.0:
; FAST-NEXT: subq $4104, %rsp # imm = 0x1008
; FAST-NEXT: movq %rdi, %rsi
; FAST-NEXT: movl $4096, %ecx # imm = 0x1000
; FAST-NEXT: movq %rsp, %rdi
; FAST-NEXT: rep;movsb (%rsi), %es:(%rdi)
; FAST-NEXT: callq foo
; FAST-NEXT: addq $4104, %rsp # imm = 0x1008
; FAST-NEXT: retq
call void @foo(%struct.large* align 8 byval %x)
ret void
}
%struct.large_oddsize = type { [4095 x i8] }
declare void @foo_oddsize(%struct.large_oddsize* align 8 byval) nounwind
define void @test3(%struct.large_oddsize* nocapture %x) nounwind minsize {
; NOFAST32-LABEL: test3:
; NOFAST32: # %bb.0:
; NOFAST32-NEXT: pushl %edi
; NOFAST32-NEXT: pushl %esi
; NOFAST32-NEXT: subl $4100, %esp # imm = 0x1004
; NOFAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
; NOFAST32-NEXT: movl $4095, %ecx # imm = 0xFFF
; NOFAST32-NEXT: movl %esp, %edi
; NOFAST32-NEXT: rep;movsb (%esi), %es:(%edi)
; NOFAST32-NEXT: calll foo_oddsize
; NOFAST32-NEXT: addl $4100, %esp # imm = 0x1004
; NOFAST32-NEXT: popl %esi
; NOFAST32-NEXT: popl %edi
; NOFAST32-NEXT: retl
;
; FAST32-LABEL: test3:
; FAST32: # %bb.0:
; FAST32-NEXT: pushl %edi
; FAST32-NEXT: pushl %esi
; FAST32-NEXT: subl $4100, %esp # imm = 0x1004
; FAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
; FAST32-NEXT: movl $4095, %ecx # imm = 0xFFF
; FAST32-NEXT: movl %esp, %edi
; FAST32-NEXT: rep;movsb (%esi), %es:(%edi)
; FAST32-NEXT: calll foo_oddsize
; FAST32-NEXT: addl $4100, %esp # imm = 0x1004
; FAST32-NEXT: popl %esi
; FAST32-NEXT: popl %edi
; FAST32-NEXT: retl
;
; NOFAST-LABEL: test3:
; NOFAST: # %bb.0:
; NOFAST-NEXT: subq $4104, %rsp # imm = 0x1008
; NOFAST-NEXT: movq %rdi, %rsi
; NOFAST-NEXT: movl $4095, %ecx # imm = 0xFFF
; NOFAST-NEXT: movq %rsp, %rdi
; NOFAST-NEXT: rep;movsb (%rsi), %es:(%rdi)
; NOFAST-NEXT: callq foo_oddsize
; NOFAST-NEXT: addq $4104, %rsp # imm = 0x1008
; NOFAST-NEXT: retq
;
; FAST-LABEL: test3:
; FAST: # %bb.0:
; FAST-NEXT: subq $4104, %rsp # imm = 0x1008
; FAST-NEXT: movq %rdi, %rsi
; FAST-NEXT: movl $4095, %ecx # imm = 0xFFF
; FAST-NEXT: movq %rsp, %rdi
; FAST-NEXT: rep;movsb (%rsi), %es:(%rdi)
; FAST-NEXT: callq foo_oddsize
; FAST-NEXT: addq $4104, %rsp # imm = 0x1008
; FAST-NEXT: retq
call void @foo_oddsize(%struct.large_oddsize* align 8 byval %x)
ret void
}