• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=NOFAST32
3; RUN: llc -mtriple=i686-linux-gnu -mattr=+ermsb < %s -o - | FileCheck %s --check-prefix=FAST32
4; RUN: llc -mtriple=x86_64-linux-gnu -mattr=-ermsb < %s -o - | FileCheck %s --check-prefix=NOFAST
5; RUN: llc -mtriple=x86_64-linux-gnu -mattr=+ermsb < %s -o - | FileCheck %s --check-prefix=FAST
6; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=generic < %s -o - | FileCheck %s --check-prefix=NOFAST
7; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=haswell < %s -o - | FileCheck %s --check-prefix=FAST
8; RUN: llc -mtriple=x86_64-linux-gnu -mcpu=skylake < %s -o - | FileCheck %s --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=NOFAST
12
13%struct.large = type { [4096 x i8] }
14
15declare void @foo(%struct.large* align 8 byval(%struct.large)) nounwind
16
17define void @test1(%struct.large* nocapture %x) nounwind {
18; NOFAST32-LABEL: test1:
19; NOFAST32:       # %bb.0:
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
31; NOFAST32-NEXT:    retl
32;
33; FAST32-LABEL: test1:
34; FAST32:       # %bb.0:
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
46; FAST32-NEXT:    retl
47;
48; NOFAST-LABEL: test1:
49; NOFAST:       # %bb.0:
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
57; NOFAST-NEXT:    retq
58;
59; FAST-LABEL: test1:
60; FAST:       # %bb.0:
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
68; FAST-NEXT:    retq
69  call void @foo(%struct.large* align 8 byval(%struct.large) %x)
70  ret void
71
72}
73
74define void @test2(%struct.large* nocapture %x) nounwind minsize {
75; NOFAST32-LABEL: test2:
76; NOFAST32:       # %bb.0:
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
88; NOFAST32-NEXT:    retl
89;
90; FAST32-LABEL: test2:
91; FAST32:       # %bb.0:
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
103; FAST32-NEXT:    retl
104;
105; NOFAST-LABEL: test2:
106; NOFAST:       # %bb.0:
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
114; NOFAST-NEXT:    retq
115;
116; FAST-LABEL: test2:
117; FAST:       # %bb.0:
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
125; FAST-NEXT:    retq
126  call void @foo(%struct.large* align 8 byval(%struct.large) %x)
127  ret void
128
129}
130
131%struct.large_oddsize = type { [4095 x i8] }
132
133declare void @foo_oddsize(%struct.large_oddsize* align 8 byval(%struct.large_oddsize)) nounwind
134
135define void @test3(%struct.large_oddsize* nocapture %x) nounwind minsize {
136; NOFAST32-LABEL: test3:
137; NOFAST32:       # %bb.0:
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
150;
151; FAST32-LABEL: test3:
152; FAST32:       # %bb.0:
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
164; FAST32-NEXT:    retl
165;
166; NOFAST-LABEL: test3:
167; NOFAST:       # %bb.0:
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
175; NOFAST-NEXT:    retq
176;
177; FAST-LABEL: test3:
178; FAST:       # %bb.0:
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
186; FAST-NEXT:    retq
187  call void @foo_oddsize(%struct.large_oddsize* align 8 byval(%struct.large_oddsize) %x)
188  ret void
189
190}
191