1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=i686-linux-gnu -mattr=-ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST32
3 ; RUN: llc -mtriple=i686-linux-gnu -mattr=+ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST32
4 ; RUN: llc -mtriple=x86_64-linux-gnu -mattr=-ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST
5 ; RUN: llc -mtriple=x86_64-linux-gnu -mattr=+ermsb < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST
6 ; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=generic < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST
7 ; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=haswell < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST
8 ; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=skylake < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=FAST
9 ; FIXME: The documentation states that ivybridge has ermsb, but this is not
10 ; enabled right now since I could not confirm by testing.
11 ; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=ivybridge < %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=NOFAST
13 %struct.large = type { [4096 x i8] }
15 declare void @foo(%struct.large* align 8 byval) nounwind
17 define void @test1(%struct.large* nocapture %x) nounwind {
18 ; NOFAST32-LABEL: test1:
20 ; NOFAST32-NEXT: pushl %edi
21 ; NOFAST32-NEXT: pushl %esi
22 ; NOFAST32-NEXT: subl $4100, %esp # imm = 0x1004
23 ; NOFAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
24 ; NOFAST32-NEXT: movl $1024, %ecx # imm = 0x400
25 ; NOFAST32-NEXT: movl %esp, %edi
26 ; NOFAST32-NEXT: rep;movsl (%esi), %es:(%edi)
27 ; NOFAST32-NEXT: calll foo
28 ; NOFAST32-NEXT: addl $4100, %esp # imm = 0x1004
29 ; NOFAST32-NEXT: popl %esi
30 ; NOFAST32-NEXT: popl %edi
33 ; FAST32-LABEL: test1:
35 ; FAST32-NEXT: pushl %edi
36 ; FAST32-NEXT: pushl %esi
37 ; FAST32-NEXT: subl $4100, %esp # imm = 0x1004
38 ; FAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
39 ; FAST32-NEXT: movl $4096, %ecx # imm = 0x1000
40 ; FAST32-NEXT: movl %esp, %edi
41 ; FAST32-NEXT: rep;movsb (%esi), %es:(%edi)
42 ; FAST32-NEXT: calll foo
43 ; FAST32-NEXT: addl $4100, %esp # imm = 0x1004
44 ; FAST32-NEXT: popl %esi
45 ; FAST32-NEXT: popl %edi
48 ; NOFAST-LABEL: test1:
50 ; NOFAST-NEXT: subq $4104, %rsp # imm = 0x1008
51 ; NOFAST-NEXT: movq %rdi, %rsi
52 ; NOFAST-NEXT: movl $512, %ecx # imm = 0x200
53 ; NOFAST-NEXT: movq %rsp, %rdi
54 ; NOFAST-NEXT: rep;movsq (%rsi), %es:(%rdi)
55 ; NOFAST-NEXT: callq foo
56 ; NOFAST-NEXT: addq $4104, %rsp # imm = 0x1008
61 ; FAST-NEXT: subq $4104, %rsp # imm = 0x1008
62 ; FAST-NEXT: movq %rdi, %rsi
63 ; FAST-NEXT: movl $4096, %ecx # imm = 0x1000
64 ; FAST-NEXT: movq %rsp, %rdi
65 ; FAST-NEXT: rep;movsb (%rsi), %es:(%rdi)
66 ; FAST-NEXT: callq foo
67 ; FAST-NEXT: addq $4104, %rsp # imm = 0x1008
69 call void @foo(%struct.large* align 8 byval %x)
74 define void @test2(%struct.large* nocapture %x) nounwind minsize {
75 ; NOFAST32-LABEL: test2:
77 ; NOFAST32-NEXT: pushl %edi
78 ; NOFAST32-NEXT: pushl %esi
79 ; NOFAST32-NEXT: subl $4100, %esp # imm = 0x1004
80 ; NOFAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
81 ; NOFAST32-NEXT: movl $1024, %ecx # imm = 0x400
82 ; NOFAST32-NEXT: movl %esp, %edi
83 ; NOFAST32-NEXT: rep;movsl (%esi), %es:(%edi)
84 ; NOFAST32-NEXT: calll foo
85 ; NOFAST32-NEXT: addl $4100, %esp # imm = 0x1004
86 ; NOFAST32-NEXT: popl %esi
87 ; NOFAST32-NEXT: popl %edi
90 ; FAST32-LABEL: test2:
92 ; FAST32-NEXT: pushl %edi
93 ; FAST32-NEXT: pushl %esi
94 ; FAST32-NEXT: subl $4100, %esp # imm = 0x1004
95 ; FAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
96 ; FAST32-NEXT: movl $4096, %ecx # imm = 0x1000
97 ; FAST32-NEXT: movl %esp, %edi
98 ; FAST32-NEXT: rep;movsb (%esi), %es:(%edi)
99 ; FAST32-NEXT: calll foo
100 ; FAST32-NEXT: addl $4100, %esp # imm = 0x1004
101 ; FAST32-NEXT: popl %esi
102 ; FAST32-NEXT: popl %edi
105 ; NOFAST-LABEL: test2:
107 ; NOFAST-NEXT: subq $4104, %rsp # imm = 0x1008
108 ; NOFAST-NEXT: movq %rdi, %rsi
109 ; NOFAST-NEXT: movl $512, %ecx # imm = 0x200
110 ; NOFAST-NEXT: movq %rsp, %rdi
111 ; NOFAST-NEXT: rep;movsq (%rsi), %es:(%rdi)
112 ; NOFAST-NEXT: callq foo
113 ; NOFAST-NEXT: addq $4104, %rsp # imm = 0x1008
118 ; FAST-NEXT: subq $4104, %rsp # imm = 0x1008
119 ; FAST-NEXT: movq %rdi, %rsi
120 ; FAST-NEXT: movl $4096, %ecx # imm = 0x1000
121 ; FAST-NEXT: movq %rsp, %rdi
122 ; FAST-NEXT: rep;movsb (%rsi), %es:(%rdi)
123 ; FAST-NEXT: callq foo
124 ; FAST-NEXT: addq $4104, %rsp # imm = 0x1008
126 call void @foo(%struct.large* align 8 byval %x)
131 %struct.large_oddsize = type { [4095 x i8] }
133 declare void @foo_oddsize(%struct.large_oddsize* align 8 byval) nounwind
135 define void @test3(%struct.large_oddsize* nocapture %x) nounwind minsize {
136 ; NOFAST32-LABEL: test3:
138 ; NOFAST32-NEXT: pushl %edi
139 ; NOFAST32-NEXT: pushl %esi
140 ; NOFAST32-NEXT: subl $4100, %esp # imm = 0x1004
141 ; NOFAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
142 ; NOFAST32-NEXT: movl $4095, %ecx # imm = 0xFFF
143 ; NOFAST32-NEXT: movl %esp, %edi
144 ; NOFAST32-NEXT: rep;movsb (%esi), %es:(%edi)
145 ; NOFAST32-NEXT: calll foo_oddsize
146 ; NOFAST32-NEXT: addl $4100, %esp # imm = 0x1004
147 ; NOFAST32-NEXT: popl %esi
148 ; NOFAST32-NEXT: popl %edi
149 ; NOFAST32-NEXT: retl
151 ; FAST32-LABEL: test3:
153 ; FAST32-NEXT: pushl %edi
154 ; FAST32-NEXT: pushl %esi
155 ; FAST32-NEXT: subl $4100, %esp # imm = 0x1004
156 ; FAST32-NEXT: movl {{[0-9]+}}(%esp), %esi
157 ; FAST32-NEXT: movl $4095, %ecx # imm = 0xFFF
158 ; FAST32-NEXT: movl %esp, %edi
159 ; FAST32-NEXT: rep;movsb (%esi), %es:(%edi)
160 ; FAST32-NEXT: calll foo_oddsize
161 ; FAST32-NEXT: addl $4100, %esp # imm = 0x1004
162 ; FAST32-NEXT: popl %esi
163 ; FAST32-NEXT: popl %edi
166 ; NOFAST-LABEL: test3:
168 ; NOFAST-NEXT: subq $4104, %rsp # imm = 0x1008
169 ; NOFAST-NEXT: movq %rdi, %rsi
170 ; NOFAST-NEXT: movl $4095, %ecx # imm = 0xFFF
171 ; NOFAST-NEXT: movq %rsp, %rdi
172 ; NOFAST-NEXT: rep;movsb (%rsi), %es:(%rdi)
173 ; NOFAST-NEXT: callq foo_oddsize
174 ; NOFAST-NEXT: addq $4104, %rsp # imm = 0x1008
179 ; FAST-NEXT: subq $4104, %rsp # imm = 0x1008
180 ; FAST-NEXT: movq %rdi, %rsi
181 ; FAST-NEXT: movl $4095, %ecx # imm = 0xFFF
182 ; FAST-NEXT: movq %rsp, %rdi
183 ; FAST-NEXT: rep;movsb (%rsi), %es:(%rdi)
184 ; FAST-NEXT: callq foo_oddsize
185 ; FAST-NEXT: addq $4104, %rsp # imm = 0x1008
187 call void @foo_oddsize(%struct.large_oddsize* align 8 byval %x)