1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -O2 -mtriple=x86_64-linux-android \
3; RUN:     -enable-legalize-types-checking | FileCheck %s
4; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu \
5; RUN:     -enable-legalize-types-checking | FileCheck %s
6; RUN: llc < %s -O2 -mtriple=i686-linux-gnu -mattr=sse2 \
7; RUN:     -enable-legalize-types-checking | FileCheck %s --check-prefix=X86
8
9; Check all soft floating point library function calls.
10
11@vf64 = common dso_local global double 0.000000e+00, align 8
12@vf128 = common dso_local global fp128 0xL00000000000000000000000000000000, align 16
13
14define dso_local void @Test128Add(fp128 %d1, fp128 %d2) nounwind {
15; CHECK-LABEL: Test128Add:
16; CHECK:       # %bb.0: # %entry
17; CHECK-NEXT:    pushq %rax
18; CHECK-NEXT:    callq __addtf3@PLT
19; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
20; CHECK-NEXT:    popq %rax
21; CHECK-NEXT:    retq
22;
23; X86-LABEL: Test128Add:
24; X86:       # %bb.0: # %entry
25; X86-NEXT:    pushl %esi
26; X86-NEXT:    subl $36, %esp
27; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
28; X86-NEXT:    pushl {{[0-9]+}}(%esp)
29; X86-NEXT:    pushl {{[0-9]+}}(%esp)
30; X86-NEXT:    pushl {{[0-9]+}}(%esp)
31; X86-NEXT:    pushl {{[0-9]+}}(%esp)
32; X86-NEXT:    pushl {{[0-9]+}}(%esp)
33; X86-NEXT:    pushl {{[0-9]+}}(%esp)
34; X86-NEXT:    pushl {{[0-9]+}}(%esp)
35; X86-NEXT:    pushl {{[0-9]+}}(%esp)
36; X86-NEXT:    pushl %eax
37; X86-NEXT:    calll __addtf3
38; X86-NEXT:    addl $44, %esp
39; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
40; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
41; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
42; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
43; X86-NEXT:    movl %esi, vf128+12
44; X86-NEXT:    movl %edx, vf128+8
45; X86-NEXT:    movl %ecx, vf128+4
46; X86-NEXT:    movl %eax, vf128
47; X86-NEXT:    addl $24, %esp
48; X86-NEXT:    popl %esi
49; X86-NEXT:    retl
50entry:
51  %add = fadd fp128 %d1, %d2
52  store fp128 %add, fp128* @vf128, align 16
53  ret void
54}
55
56define dso_local void @Test128_1Add(fp128 %d1) nounwind {
57; CHECK-LABEL: Test128_1Add:
58; CHECK:       # %bb.0: # %entry
59; CHECK-NEXT:    pushq %rax
60; CHECK-NEXT:    movaps %xmm0, %xmm1
61; CHECK-NEXT:    movaps vf128(%rip), %xmm0
62; CHECK-NEXT:    callq __addtf3@PLT
63; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
64; CHECK-NEXT:    popq %rax
65; CHECK-NEXT:    retq
66;
67; X86-LABEL: Test128_1Add:
68; X86:       # %bb.0: # %entry
69; X86-NEXT:    pushl %esi
70; X86-NEXT:    subl $36, %esp
71; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
72; X86-NEXT:    pushl {{[0-9]+}}(%esp)
73; X86-NEXT:    pushl {{[0-9]+}}(%esp)
74; X86-NEXT:    pushl {{[0-9]+}}(%esp)
75; X86-NEXT:    pushl {{[0-9]+}}(%esp)
76; X86-NEXT:    pushl vf128+12
77; X86-NEXT:    pushl vf128+8
78; X86-NEXT:    pushl vf128+4
79; X86-NEXT:    pushl vf128
80; X86-NEXT:    pushl %eax
81; X86-NEXT:    calll __addtf3
82; X86-NEXT:    addl $44, %esp
83; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
84; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
85; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
86; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
87; X86-NEXT:    movl %esi, vf128+8
88; X86-NEXT:    movl %edx, vf128+12
89; X86-NEXT:    movl %eax, vf128
90; X86-NEXT:    movl %ecx, vf128+4
91; X86-NEXT:    addl $24, %esp
92; X86-NEXT:    popl %esi
93; X86-NEXT:    retl
94entry:
95  %0 = load fp128, fp128* @vf128, align 16
96  %add = fadd fp128 %0, %d1
97  store fp128 %add, fp128* @vf128, align 16
98  ret void
99}
100
101define dso_local void @Test128Sub(fp128 %d1, fp128 %d2) nounwind {
102; CHECK-LABEL: Test128Sub:
103; CHECK:       # %bb.0: # %entry
104; CHECK-NEXT:    pushq %rax
105; CHECK-NEXT:    callq __subtf3@PLT
106; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
107; CHECK-NEXT:    popq %rax
108; CHECK-NEXT:    retq
109;
110; X86-LABEL: Test128Sub:
111; X86:       # %bb.0: # %entry
112; X86-NEXT:    pushl %esi
113; X86-NEXT:    subl $36, %esp
114; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
115; X86-NEXT:    pushl {{[0-9]+}}(%esp)
116; X86-NEXT:    pushl {{[0-9]+}}(%esp)
117; X86-NEXT:    pushl {{[0-9]+}}(%esp)
118; X86-NEXT:    pushl {{[0-9]+}}(%esp)
119; X86-NEXT:    pushl {{[0-9]+}}(%esp)
120; X86-NEXT:    pushl {{[0-9]+}}(%esp)
121; X86-NEXT:    pushl {{[0-9]+}}(%esp)
122; X86-NEXT:    pushl {{[0-9]+}}(%esp)
123; X86-NEXT:    pushl %eax
124; X86-NEXT:    calll __subtf3
125; X86-NEXT:    addl $44, %esp
126; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
127; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
128; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
129; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
130; X86-NEXT:    movl %esi, vf128+12
131; X86-NEXT:    movl %edx, vf128+8
132; X86-NEXT:    movl %ecx, vf128+4
133; X86-NEXT:    movl %eax, vf128
134; X86-NEXT:    addl $24, %esp
135; X86-NEXT:    popl %esi
136; X86-NEXT:    retl
137entry:
138  %sub = fsub fp128 %d1, %d2
139  store fp128 %sub, fp128* @vf128, align 16
140  ret void
141}
142
143define dso_local void @Test128_1Sub(fp128 %d1) nounwind {
144; CHECK-LABEL: Test128_1Sub:
145; CHECK:       # %bb.0: # %entry
146; CHECK-NEXT:    pushq %rax
147; CHECK-NEXT:    movaps %xmm0, %xmm1
148; CHECK-NEXT:    movaps vf128(%rip), %xmm0
149; CHECK-NEXT:    callq __subtf3@PLT
150; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
151; CHECK-NEXT:    popq %rax
152; CHECK-NEXT:    retq
153;
154; X86-LABEL: Test128_1Sub:
155; X86:       # %bb.0: # %entry
156; X86-NEXT:    pushl %esi
157; X86-NEXT:    subl $36, %esp
158; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
159; X86-NEXT:    pushl {{[0-9]+}}(%esp)
160; X86-NEXT:    pushl {{[0-9]+}}(%esp)
161; X86-NEXT:    pushl {{[0-9]+}}(%esp)
162; X86-NEXT:    pushl {{[0-9]+}}(%esp)
163; X86-NEXT:    pushl vf128+12
164; X86-NEXT:    pushl vf128+8
165; X86-NEXT:    pushl vf128+4
166; X86-NEXT:    pushl vf128
167; X86-NEXT:    pushl %eax
168; X86-NEXT:    calll __subtf3
169; X86-NEXT:    addl $44, %esp
170; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
171; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
172; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
173; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
174; X86-NEXT:    movl %esi, vf128+8
175; X86-NEXT:    movl %edx, vf128+12
176; X86-NEXT:    movl %eax, vf128
177; X86-NEXT:    movl %ecx, vf128+4
178; X86-NEXT:    addl $24, %esp
179; X86-NEXT:    popl %esi
180; X86-NEXT:    retl
181entry:
182  %0 = load fp128, fp128* @vf128, align 16
183  %sub = fsub fp128 %0, %d1
184  store fp128 %sub, fp128* @vf128, align 16
185  ret void
186}
187
188define dso_local void @Test128Mul(fp128 %d1, fp128 %d2) nounwind {
189; CHECK-LABEL: Test128Mul:
190; CHECK:       # %bb.0: # %entry
191; CHECK-NEXT:    pushq %rax
192; CHECK-NEXT:    callq __multf3@PLT
193; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
194; CHECK-NEXT:    popq %rax
195; CHECK-NEXT:    retq
196;
197; X86-LABEL: Test128Mul:
198; X86:       # %bb.0: # %entry
199; X86-NEXT:    pushl %esi
200; X86-NEXT:    subl $36, %esp
201; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
202; X86-NEXT:    pushl {{[0-9]+}}(%esp)
203; X86-NEXT:    pushl {{[0-9]+}}(%esp)
204; X86-NEXT:    pushl {{[0-9]+}}(%esp)
205; X86-NEXT:    pushl {{[0-9]+}}(%esp)
206; X86-NEXT:    pushl {{[0-9]+}}(%esp)
207; X86-NEXT:    pushl {{[0-9]+}}(%esp)
208; X86-NEXT:    pushl {{[0-9]+}}(%esp)
209; X86-NEXT:    pushl {{[0-9]+}}(%esp)
210; X86-NEXT:    pushl %eax
211; X86-NEXT:    calll __multf3
212; X86-NEXT:    addl $44, %esp
213; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
214; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
215; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
216; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
217; X86-NEXT:    movl %esi, vf128+12
218; X86-NEXT:    movl %edx, vf128+8
219; X86-NEXT:    movl %ecx, vf128+4
220; X86-NEXT:    movl %eax, vf128
221; X86-NEXT:    addl $24, %esp
222; X86-NEXT:    popl %esi
223; X86-NEXT:    retl
224entry:
225  %mul = fmul fp128 %d1, %d2
226  store fp128 %mul, fp128* @vf128, align 16
227  ret void
228}
229
230define dso_local void @Test128_1Mul(fp128 %d1) nounwind {
231; CHECK-LABEL: Test128_1Mul:
232; CHECK:       # %bb.0: # %entry
233; CHECK-NEXT:    pushq %rax
234; CHECK-NEXT:    movaps %xmm0, %xmm1
235; CHECK-NEXT:    movaps vf128(%rip), %xmm0
236; CHECK-NEXT:    callq __multf3@PLT
237; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
238; CHECK-NEXT:    popq %rax
239; CHECK-NEXT:    retq
240;
241; X86-LABEL: Test128_1Mul:
242; X86:       # %bb.0: # %entry
243; X86-NEXT:    pushl %esi
244; X86-NEXT:    subl $36, %esp
245; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
246; X86-NEXT:    pushl {{[0-9]+}}(%esp)
247; X86-NEXT:    pushl {{[0-9]+}}(%esp)
248; X86-NEXT:    pushl {{[0-9]+}}(%esp)
249; X86-NEXT:    pushl {{[0-9]+}}(%esp)
250; X86-NEXT:    pushl vf128+12
251; X86-NEXT:    pushl vf128+8
252; X86-NEXT:    pushl vf128+4
253; X86-NEXT:    pushl vf128
254; X86-NEXT:    pushl %eax
255; X86-NEXT:    calll __multf3
256; X86-NEXT:    addl $44, %esp
257; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
258; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
259; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
260; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
261; X86-NEXT:    movl %esi, vf128+8
262; X86-NEXT:    movl %edx, vf128+12
263; X86-NEXT:    movl %eax, vf128
264; X86-NEXT:    movl %ecx, vf128+4
265; X86-NEXT:    addl $24, %esp
266; X86-NEXT:    popl %esi
267; X86-NEXT:    retl
268entry:
269  %0 = load fp128, fp128* @vf128, align 16
270  %mul = fmul fp128 %0, %d1
271  store fp128 %mul, fp128* @vf128, align 16
272  ret void
273}
274
275define dso_local void @Test128Div(fp128 %d1, fp128 %d2) nounwind {
276; CHECK-LABEL: Test128Div:
277; CHECK:       # %bb.0: # %entry
278; CHECK-NEXT:    pushq %rax
279; CHECK-NEXT:    callq __divtf3@PLT
280; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
281; CHECK-NEXT:    popq %rax
282; CHECK-NEXT:    retq
283;
284; X86-LABEL: Test128Div:
285; X86:       # %bb.0: # %entry
286; X86-NEXT:    pushl %esi
287; X86-NEXT:    subl $36, %esp
288; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
289; X86-NEXT:    pushl {{[0-9]+}}(%esp)
290; X86-NEXT:    pushl {{[0-9]+}}(%esp)
291; X86-NEXT:    pushl {{[0-9]+}}(%esp)
292; X86-NEXT:    pushl {{[0-9]+}}(%esp)
293; X86-NEXT:    pushl {{[0-9]+}}(%esp)
294; X86-NEXT:    pushl {{[0-9]+}}(%esp)
295; X86-NEXT:    pushl {{[0-9]+}}(%esp)
296; X86-NEXT:    pushl {{[0-9]+}}(%esp)
297; X86-NEXT:    pushl %eax
298; X86-NEXT:    calll __divtf3
299; X86-NEXT:    addl $44, %esp
300; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
301; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
302; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
303; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
304; X86-NEXT:    movl %esi, vf128+12
305; X86-NEXT:    movl %edx, vf128+8
306; X86-NEXT:    movl %ecx, vf128+4
307; X86-NEXT:    movl %eax, vf128
308; X86-NEXT:    addl $24, %esp
309; X86-NEXT:    popl %esi
310; X86-NEXT:    retl
311entry:
312  %div = fdiv fp128 %d1, %d2
313  store fp128 %div, fp128* @vf128, align 16
314  ret void
315}
316
317define dso_local void @Test128_1Div(fp128 %d1) nounwind {
318; CHECK-LABEL: Test128_1Div:
319; CHECK:       # %bb.0: # %entry
320; CHECK-NEXT:    pushq %rax
321; CHECK-NEXT:    movaps %xmm0, %xmm1
322; CHECK-NEXT:    movaps vf128(%rip), %xmm0
323; CHECK-NEXT:    callq __divtf3@PLT
324; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
325; CHECK-NEXT:    popq %rax
326; CHECK-NEXT:    retq
327;
328; X86-LABEL: Test128_1Div:
329; X86:       # %bb.0: # %entry
330; X86-NEXT:    pushl %esi
331; X86-NEXT:    subl $36, %esp
332; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
333; X86-NEXT:    pushl {{[0-9]+}}(%esp)
334; X86-NEXT:    pushl {{[0-9]+}}(%esp)
335; X86-NEXT:    pushl {{[0-9]+}}(%esp)
336; X86-NEXT:    pushl {{[0-9]+}}(%esp)
337; X86-NEXT:    pushl vf128+12
338; X86-NEXT:    pushl vf128+8
339; X86-NEXT:    pushl vf128+4
340; X86-NEXT:    pushl vf128
341; X86-NEXT:    pushl %eax
342; X86-NEXT:    calll __divtf3
343; X86-NEXT:    addl $44, %esp
344; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
345; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
346; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
347; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
348; X86-NEXT:    movl %esi, vf128+8
349; X86-NEXT:    movl %edx, vf128+12
350; X86-NEXT:    movl %eax, vf128
351; X86-NEXT:    movl %ecx, vf128+4
352; X86-NEXT:    addl $24, %esp
353; X86-NEXT:    popl %esi
354; X86-NEXT:    retl
355entry:
356  %0 = load fp128, fp128* @vf128, align 16
357  %div = fdiv fp128 %0, %d1
358  store fp128 %div, fp128* @vf128, align 16
359  ret void
360}
361
362define dso_local void @Test128Rem(fp128 %d1, fp128 %d2) nounwind {
363; CHECK-LABEL: Test128Rem:
364; CHECK:       # %bb.0: # %entry
365; CHECK-NEXT:    pushq %rax
366; CHECK-NEXT:    callq fmodl@PLT
367; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
368; CHECK-NEXT:    popq %rax
369; CHECK-NEXT:    retq
370;
371; X86-LABEL: Test128Rem:
372; X86:       # %bb.0: # %entry
373; X86-NEXT:    pushl %esi
374; X86-NEXT:    subl $36, %esp
375; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
376; X86-NEXT:    pushl {{[0-9]+}}(%esp)
377; X86-NEXT:    pushl {{[0-9]+}}(%esp)
378; X86-NEXT:    pushl {{[0-9]+}}(%esp)
379; X86-NEXT:    pushl {{[0-9]+}}(%esp)
380; X86-NEXT:    pushl {{[0-9]+}}(%esp)
381; X86-NEXT:    pushl {{[0-9]+}}(%esp)
382; X86-NEXT:    pushl {{[0-9]+}}(%esp)
383; X86-NEXT:    pushl {{[0-9]+}}(%esp)
384; X86-NEXT:    pushl %eax
385; X86-NEXT:    calll fmodl
386; X86-NEXT:    addl $44, %esp
387; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
388; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
389; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
390; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
391; X86-NEXT:    movl %esi, vf128+12
392; X86-NEXT:    movl %edx, vf128+8
393; X86-NEXT:    movl %ecx, vf128+4
394; X86-NEXT:    movl %eax, vf128
395; X86-NEXT:    addl $24, %esp
396; X86-NEXT:    popl %esi
397; X86-NEXT:    retl
398entry:
399  %div = frem fp128 %d1, %d2
400  store fp128 %div, fp128* @vf128, align 16
401  ret void
402}
403
404define dso_local void @Test128_1Rem(fp128 %d1) nounwind {
405; CHECK-LABEL: Test128_1Rem:
406; CHECK:       # %bb.0: # %entry
407; CHECK-NEXT:    pushq %rax
408; CHECK-NEXT:    movaps %xmm0, %xmm1
409; CHECK-NEXT:    movaps vf128(%rip), %xmm0
410; CHECK-NEXT:    callq fmodl@PLT
411; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
412; CHECK-NEXT:    popq %rax
413; CHECK-NEXT:    retq
414;
415; X86-LABEL: Test128_1Rem:
416; X86:       # %bb.0: # %entry
417; X86-NEXT:    pushl %esi
418; X86-NEXT:    subl $36, %esp
419; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
420; X86-NEXT:    pushl {{[0-9]+}}(%esp)
421; X86-NEXT:    pushl {{[0-9]+}}(%esp)
422; X86-NEXT:    pushl {{[0-9]+}}(%esp)
423; X86-NEXT:    pushl {{[0-9]+}}(%esp)
424; X86-NEXT:    pushl vf128+12
425; X86-NEXT:    pushl vf128+8
426; X86-NEXT:    pushl vf128+4
427; X86-NEXT:    pushl vf128
428; X86-NEXT:    pushl %eax
429; X86-NEXT:    calll fmodl
430; X86-NEXT:    addl $44, %esp
431; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
432; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
433; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
434; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
435; X86-NEXT:    movl %esi, vf128+8
436; X86-NEXT:    movl %edx, vf128+12
437; X86-NEXT:    movl %eax, vf128
438; X86-NEXT:    movl %ecx, vf128+4
439; X86-NEXT:    addl $24, %esp
440; X86-NEXT:    popl %esi
441; X86-NEXT:    retl
442entry:
443  %0 = load fp128, fp128* @vf128, align 16
444  %div = frem fp128 %0, %d1
445  store fp128 %div, fp128* @vf128, align 16
446  ret void
447}
448
449define dso_local void @Test128Sqrt(fp128 %d1) nounwind {
450; CHECK-LABEL: Test128Sqrt:
451; CHECK:       # %bb.0: # %entry
452; CHECK-NEXT:    pushq %rax
453; CHECK-NEXT:    callq sqrtl@PLT
454; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
455; CHECK-NEXT:    popq %rax
456; CHECK-NEXT:    retq
457;
458; X86-LABEL: Test128Sqrt:
459; X86:       # %bb.0: # %entry
460; X86-NEXT:    pushl %esi
461; X86-NEXT:    subl $36, %esp
462; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
463; X86-NEXT:    pushl {{[0-9]+}}(%esp)
464; X86-NEXT:    pushl {{[0-9]+}}(%esp)
465; X86-NEXT:    pushl {{[0-9]+}}(%esp)
466; X86-NEXT:    pushl {{[0-9]+}}(%esp)
467; X86-NEXT:    pushl %eax
468; X86-NEXT:    calll sqrtl
469; X86-NEXT:    addl $28, %esp
470; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
471; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
472; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
473; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
474; X86-NEXT:    movl %esi, vf128+12
475; X86-NEXT:    movl %edx, vf128+8
476; X86-NEXT:    movl %ecx, vf128+4
477; X86-NEXT:    movl %eax, vf128
478; X86-NEXT:    addl $24, %esp
479; X86-NEXT:    popl %esi
480; X86-NEXT:    retl
481entry:
482  %sqrt = call fp128 @llvm.sqrt.f128(fp128 %d1)
483  store fp128 %sqrt, fp128* @vf128, align 16
484  ret void
485}
486declare fp128 @llvm.sqrt.f128(fp128)
487
488define dso_local void @Test128Sin(fp128 %d1) nounwind {
489; CHECK-LABEL: Test128Sin:
490; CHECK:       # %bb.0: # %entry
491; CHECK-NEXT:    pushq %rax
492; CHECK-NEXT:    callq sinl@PLT
493; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
494; CHECK-NEXT:    popq %rax
495; CHECK-NEXT:    retq
496;
497; X86-LABEL: Test128Sin:
498; X86:       # %bb.0: # %entry
499; X86-NEXT:    pushl %esi
500; X86-NEXT:    subl $36, %esp
501; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
502; X86-NEXT:    pushl {{[0-9]+}}(%esp)
503; X86-NEXT:    pushl {{[0-9]+}}(%esp)
504; X86-NEXT:    pushl {{[0-9]+}}(%esp)
505; X86-NEXT:    pushl {{[0-9]+}}(%esp)
506; X86-NEXT:    pushl %eax
507; X86-NEXT:    calll sinl
508; X86-NEXT:    addl $28, %esp
509; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
510; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
511; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
512; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
513; X86-NEXT:    movl %esi, vf128+12
514; X86-NEXT:    movl %edx, vf128+8
515; X86-NEXT:    movl %ecx, vf128+4
516; X86-NEXT:    movl %eax, vf128
517; X86-NEXT:    addl $24, %esp
518; X86-NEXT:    popl %esi
519; X86-NEXT:    retl
520entry:
521  %sqrt = call fp128 @llvm.sin.f128(fp128 %d1)
522  store fp128 %sqrt, fp128* @vf128, align 16
523  ret void
524}
525declare fp128 @llvm.sin.f128(fp128)
526
527define dso_local void @Test128Cos(fp128 %d1) nounwind {
528; CHECK-LABEL: Test128Cos:
529; CHECK:       # %bb.0: # %entry
530; CHECK-NEXT:    pushq %rax
531; CHECK-NEXT:    callq cosl@PLT
532; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
533; CHECK-NEXT:    popq %rax
534; CHECK-NEXT:    retq
535;
536; X86-LABEL: Test128Cos:
537; X86:       # %bb.0: # %entry
538; X86-NEXT:    pushl %esi
539; X86-NEXT:    subl $36, %esp
540; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
541; X86-NEXT:    pushl {{[0-9]+}}(%esp)
542; X86-NEXT:    pushl {{[0-9]+}}(%esp)
543; X86-NEXT:    pushl {{[0-9]+}}(%esp)
544; X86-NEXT:    pushl {{[0-9]+}}(%esp)
545; X86-NEXT:    pushl %eax
546; X86-NEXT:    calll cosl
547; X86-NEXT:    addl $28, %esp
548; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
549; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
550; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
551; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
552; X86-NEXT:    movl %esi, vf128+12
553; X86-NEXT:    movl %edx, vf128+8
554; X86-NEXT:    movl %ecx, vf128+4
555; X86-NEXT:    movl %eax, vf128
556; X86-NEXT:    addl $24, %esp
557; X86-NEXT:    popl %esi
558; X86-NEXT:    retl
559entry:
560  %sqrt = call fp128 @llvm.cos.f128(fp128 %d1)
561  store fp128 %sqrt, fp128* @vf128, align 16
562  ret void
563}
564declare fp128 @llvm.cos.f128(fp128)
565
566define dso_local void @Test128Ceil(fp128 %d1) nounwind {
567; CHECK-LABEL: Test128Ceil:
568; CHECK:       # %bb.0: # %entry
569; CHECK-NEXT:    pushq %rax
570; CHECK-NEXT:    callq ceill@PLT
571; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
572; CHECK-NEXT:    popq %rax
573; CHECK-NEXT:    retq
574;
575; X86-LABEL: Test128Ceil:
576; X86:       # %bb.0: # %entry
577; X86-NEXT:    pushl %esi
578; X86-NEXT:    subl $36, %esp
579; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
580; X86-NEXT:    pushl {{[0-9]+}}(%esp)
581; X86-NEXT:    pushl {{[0-9]+}}(%esp)
582; X86-NEXT:    pushl {{[0-9]+}}(%esp)
583; X86-NEXT:    pushl {{[0-9]+}}(%esp)
584; X86-NEXT:    pushl %eax
585; X86-NEXT:    calll ceill
586; X86-NEXT:    addl $28, %esp
587; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
588; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
589; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
590; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
591; X86-NEXT:    movl %esi, vf128+12
592; X86-NEXT:    movl %edx, vf128+8
593; X86-NEXT:    movl %ecx, vf128+4
594; X86-NEXT:    movl %eax, vf128
595; X86-NEXT:    addl $24, %esp
596; X86-NEXT:    popl %esi
597; X86-NEXT:    retl
598entry:
599  %sqrt = call fp128 @llvm.ceil.f128(fp128 %d1)
600  store fp128 %sqrt, fp128* @vf128, align 16
601  ret void
602}
603declare fp128 @llvm.ceil.f128(fp128)
604
605define dso_local void @Test128Floor(fp128 %d1) nounwind {
606; CHECK-LABEL: Test128Floor:
607; CHECK:       # %bb.0: # %entry
608; CHECK-NEXT:    pushq %rax
609; CHECK-NEXT:    callq floorl@PLT
610; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
611; CHECK-NEXT:    popq %rax
612; CHECK-NEXT:    retq
613;
614; X86-LABEL: Test128Floor:
615; X86:       # %bb.0: # %entry
616; X86-NEXT:    pushl %esi
617; X86-NEXT:    subl $36, %esp
618; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
619; X86-NEXT:    pushl {{[0-9]+}}(%esp)
620; X86-NEXT:    pushl {{[0-9]+}}(%esp)
621; X86-NEXT:    pushl {{[0-9]+}}(%esp)
622; X86-NEXT:    pushl {{[0-9]+}}(%esp)
623; X86-NEXT:    pushl %eax
624; X86-NEXT:    calll floorl
625; X86-NEXT:    addl $28, %esp
626; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
627; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
628; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
629; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
630; X86-NEXT:    movl %esi, vf128+12
631; X86-NEXT:    movl %edx, vf128+8
632; X86-NEXT:    movl %ecx, vf128+4
633; X86-NEXT:    movl %eax, vf128
634; X86-NEXT:    addl $24, %esp
635; X86-NEXT:    popl %esi
636; X86-NEXT:    retl
637entry:
638  %sqrt = call fp128 @llvm.floor.f128(fp128 %d1)
639  store fp128 %sqrt, fp128* @vf128, align 16
640  ret void
641}
642declare fp128 @llvm.floor.f128(fp128)
643
644define dso_local void @Test128Trunc(fp128 %d1) nounwind {
645; CHECK-LABEL: Test128Trunc:
646; CHECK:       # %bb.0: # %entry
647; CHECK-NEXT:    pushq %rax
648; CHECK-NEXT:    callq truncl@PLT
649; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
650; CHECK-NEXT:    popq %rax
651; CHECK-NEXT:    retq
652;
653; X86-LABEL: Test128Trunc:
654; X86:       # %bb.0: # %entry
655; X86-NEXT:    pushl %esi
656; X86-NEXT:    subl $36, %esp
657; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
658; X86-NEXT:    pushl {{[0-9]+}}(%esp)
659; X86-NEXT:    pushl {{[0-9]+}}(%esp)
660; X86-NEXT:    pushl {{[0-9]+}}(%esp)
661; X86-NEXT:    pushl {{[0-9]+}}(%esp)
662; X86-NEXT:    pushl %eax
663; X86-NEXT:    calll truncl
664; X86-NEXT:    addl $28, %esp
665; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
666; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
667; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
668; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
669; X86-NEXT:    movl %esi, vf128+12
670; X86-NEXT:    movl %edx, vf128+8
671; X86-NEXT:    movl %ecx, vf128+4
672; X86-NEXT:    movl %eax, vf128
673; X86-NEXT:    addl $24, %esp
674; X86-NEXT:    popl %esi
675; X86-NEXT:    retl
676entry:
677  %sqrt = call fp128 @llvm.trunc.f128(fp128 %d1)
678  store fp128 %sqrt, fp128* @vf128, align 16
679  ret void
680}
681declare fp128 @llvm.trunc.f128(fp128)
682
683define dso_local void @Test128Nearbyint(fp128 %d1) nounwind {
684; CHECK-LABEL: Test128Nearbyint:
685; CHECK:       # %bb.0: # %entry
686; CHECK-NEXT:    pushq %rax
687; CHECK-NEXT:    callq nearbyintl@PLT
688; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
689; CHECK-NEXT:    popq %rax
690; CHECK-NEXT:    retq
691;
692; X86-LABEL: Test128Nearbyint:
693; X86:       # %bb.0: # %entry
694; X86-NEXT:    pushl %esi
695; X86-NEXT:    subl $36, %esp
696; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
697; X86-NEXT:    pushl {{[0-9]+}}(%esp)
698; X86-NEXT:    pushl {{[0-9]+}}(%esp)
699; X86-NEXT:    pushl {{[0-9]+}}(%esp)
700; X86-NEXT:    pushl {{[0-9]+}}(%esp)
701; X86-NEXT:    pushl %eax
702; X86-NEXT:    calll nearbyintl
703; X86-NEXT:    addl $28, %esp
704; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
705; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
706; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
707; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
708; X86-NEXT:    movl %esi, vf128+12
709; X86-NEXT:    movl %edx, vf128+8
710; X86-NEXT:    movl %ecx, vf128+4
711; X86-NEXT:    movl %eax, vf128
712; X86-NEXT:    addl $24, %esp
713; X86-NEXT:    popl %esi
714; X86-NEXT:    retl
715entry:
716  %sqrt = call fp128 @llvm.nearbyint.f128(fp128 %d1)
717  store fp128 %sqrt, fp128* @vf128, align 16
718  ret void
719}
720declare fp128 @llvm.nearbyint.f128(fp128)
721
722define dso_local void @Test128Rint(fp128 %d1) nounwind {
723; CHECK-LABEL: Test128Rint:
724; CHECK:       # %bb.0: # %entry
725; CHECK-NEXT:    pushq %rax
726; CHECK-NEXT:    callq rintl@PLT
727; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
728; CHECK-NEXT:    popq %rax
729; CHECK-NEXT:    retq
730;
731; X86-LABEL: Test128Rint:
732; X86:       # %bb.0: # %entry
733; X86-NEXT:    pushl %esi
734; X86-NEXT:    subl $36, %esp
735; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
736; X86-NEXT:    pushl {{[0-9]+}}(%esp)
737; X86-NEXT:    pushl {{[0-9]+}}(%esp)
738; X86-NEXT:    pushl {{[0-9]+}}(%esp)
739; X86-NEXT:    pushl {{[0-9]+}}(%esp)
740; X86-NEXT:    pushl %eax
741; X86-NEXT:    calll rintl
742; X86-NEXT:    addl $28, %esp
743; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
744; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
745; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
746; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
747; X86-NEXT:    movl %esi, vf128+12
748; X86-NEXT:    movl %edx, vf128+8
749; X86-NEXT:    movl %ecx, vf128+4
750; X86-NEXT:    movl %eax, vf128
751; X86-NEXT:    addl $24, %esp
752; X86-NEXT:    popl %esi
753; X86-NEXT:    retl
754entry:
755  %sqrt = call fp128 @llvm.rint.f128(fp128 %d1)
756  store fp128 %sqrt, fp128* @vf128, align 16
757  ret void
758}
759declare fp128 @llvm.rint.f128(fp128)
760
761define dso_local void @Test128Round(fp128 %d1) nounwind {
762; CHECK-LABEL: Test128Round:
763; CHECK:       # %bb.0: # %entry
764; CHECK-NEXT:    pushq %rax
765; CHECK-NEXT:    callq roundl@PLT
766; CHECK-NEXT:    movaps %xmm0, vf128(%rip)
767; CHECK-NEXT:    popq %rax
768; CHECK-NEXT:    retq
769;
770; X86-LABEL: Test128Round:
771; X86:       # %bb.0: # %entry
772; X86-NEXT:    pushl %esi
773; X86-NEXT:    subl $36, %esp
774; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
775; X86-NEXT:    pushl {{[0-9]+}}(%esp)
776; X86-NEXT:    pushl {{[0-9]+}}(%esp)
777; X86-NEXT:    pushl {{[0-9]+}}(%esp)
778; X86-NEXT:    pushl {{[0-9]+}}(%esp)
779; X86-NEXT:    pushl %eax
780; X86-NEXT:    calll roundl
781; X86-NEXT:    addl $28, %esp
782; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
783; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
784; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
785; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
786; X86-NEXT:    movl %esi, vf128+12
787; X86-NEXT:    movl %edx, vf128+8
788; X86-NEXT:    movl %ecx, vf128+4
789; X86-NEXT:    movl %eax, vf128
790; X86-NEXT:    addl $24, %esp
791; X86-NEXT:    popl %esi
792; X86-NEXT:    retl
793entry:
794  %sqrt = call fp128 @llvm.round.f128(fp128 %d1)
795  store fp128 %sqrt, fp128* @vf128, align 16
796  ret void
797}
798declare fp128 @llvm.round.f128(fp128)
799
800define fp128 @Test128FMA(fp128 %a, fp128 %b, fp128 %c) nounwind {
801; CHECK-LABEL: Test128FMA:
802; CHECK:       # %bb.0: # %entry
803; CHECK-NEXT:    jmp fmal@PLT # TAILCALL
804;
805; X86-LABEL: Test128FMA:
806; X86:       # %bb.0: # %entry
807; X86-NEXT:    pushl %edi
808; X86-NEXT:    pushl %esi
809; X86-NEXT:    subl $20, %esp
810; X86-NEXT:    movl {{[0-9]+}}(%esp), %esi
811; X86-NEXT:    subl $12, %esp
812; X86-NEXT:    leal {{[0-9]+}}(%esp), %eax
813; X86-NEXT:    pushl {{[0-9]+}}(%esp)
814; X86-NEXT:    pushl {{[0-9]+}}(%esp)
815; X86-NEXT:    pushl {{[0-9]+}}(%esp)
816; X86-NEXT:    pushl {{[0-9]+}}(%esp)
817; X86-NEXT:    pushl {{[0-9]+}}(%esp)
818; X86-NEXT:    pushl {{[0-9]+}}(%esp)
819; X86-NEXT:    pushl {{[0-9]+}}(%esp)
820; X86-NEXT:    pushl {{[0-9]+}}(%esp)
821; X86-NEXT:    pushl {{[0-9]+}}(%esp)
822; X86-NEXT:    pushl {{[0-9]+}}(%esp)
823; X86-NEXT:    pushl {{[0-9]+}}(%esp)
824; X86-NEXT:    pushl {{[0-9]+}}(%esp)
825; X86-NEXT:    pushl %eax
826; X86-NEXT:    calll fmal
827; X86-NEXT:    addl $60, %esp
828; X86-NEXT:    movl (%esp), %eax
829; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
830; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
831; X86-NEXT:    movl {{[0-9]+}}(%esp), %edi
832; X86-NEXT:    movl %edi, 12(%esi)
833; X86-NEXT:    movl %edx, 8(%esi)
834; X86-NEXT:    movl %ecx, 4(%esi)
835; X86-NEXT:    movl %eax, (%esi)
836; X86-NEXT:    movl %esi, %eax
837; X86-NEXT:    addl $20, %esp
838; X86-NEXT:    popl %esi
839; X86-NEXT:    popl %edi
840; X86-NEXT:    retl $4
841entry:
842  %call = call fp128 @llvm.fma.f128(fp128 %a, fp128 %b, fp128 %c)
843  ret fp128 %call
844}
845declare fp128 @llvm.fma.f128(fp128, fp128, fp128)
846