• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i386-pc-windows-msvc     -mattr=+avx512f,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X86-AVX512,X86-AVX512-WIN
3; RUN: llc < %s -mtriple=i386-unknown-linux-gnu   -mattr=+avx512f,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X86-AVX512,X86-AVX512-LIN
4; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc   -mattr=+avx512f,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X64-AVX512,X64-AVX512-WIN
5; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f,+avx512dq,+avx512vl | FileCheck %s --check-prefixes=X64-AVX512,X64-AVX512-LIN
6; RUN: llc < %s -mtriple=i386-pc-windows-msvc     -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=X86-AVX512,X86-AVX512-WIN
7; RUN: llc < %s -mtriple=i386-unknown-linux-gnu   -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=X86-AVX512,X86-AVX512-LIN
8; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc   -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=X64-AVX512,X64-AVX512-WIN
9; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f,+avx512dq | FileCheck %s --check-prefixes=X64-AVX512,X64-AVX512-LIN
10; RUN: llc < %s -mtriple=i386-pc-windows-msvc     -mattr=+avx512f | FileCheck %s --check-prefixes=X86-AVX512,X86-AVX512-WIN
11; RUN: llc < %s -mtriple=i386-unknown-linux-gnu   -mattr=+avx512f | FileCheck %s --check-prefixes=X86-AVX512,X86-AVX512-LIN
12; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc   -mattr=+avx512f | FileCheck %s --check-prefixes=X64-AVX512,X64-AVX512-WIN
13; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f | FileCheck %s --check-prefixes=X64-AVX512,X64-AVX512-LIN
14; RUN: llc < %s -mtriple=i386-pc-windows-msvc     -mattr=+sse3 | FileCheck %s --check-prefixes=X86-SSE,X86-SSE3,X86-SSE-WIN,X86-SSE3-WIN
15; RUN: llc < %s -mtriple=i386-unknown-linux-gnu   -mattr=+sse3 | FileCheck %s --check-prefixes=X86-SSE,X86-SSE3,X86-SSE-LIN,X86-SSE3-LIN
16; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc   -mattr=+sse3 | FileCheck %s --check-prefixes=X64-SSE,X64-SSE-WIN,X64-SSE3-WIN
17; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+sse3 | FileCheck %s --check-prefixes=X64-SSE,X64-SSE-LIN,X64-SSE3-LIN
18; RUN: llc < %s -mtriple=i386-pc-windows-msvc     -mattr=+sse2 | FileCheck %s --check-prefixes=X86-SSE,X86-SSE2,X86-SSE-WIN,X86-SSE2-WIN
19; RUN: llc < %s -mtriple=i386-unknown-linux-gnu   -mattr=+sse2 | FileCheck %s --check-prefixes=X86-SSE,X86-SSE2,X86-SSE-LIN,X86-SSE2-LIN
20; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc   -mattr=+sse2 | FileCheck %s --check-prefixes=X64-SSE,X64-SSE-WIN,X64-SSE2-WIN
21; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+sse2 | FileCheck %s --check-prefixes=X64-SSE,X64-SSE-LIN,X64-SSE2-LIN
22; RUN: llc < %s -mtriple=i386-pc-windows-msvc     -mattr=+sse  | FileCheck %s --check-prefixes=X86-SSE,X86-SSE1,X86-SSE-WIN,X86-SSE1-WIN
23; RUN: llc < %s -mtriple=i386-unknown-linux-gnu   -mattr=+sse  | FileCheck %s --check-prefixes=X86-SSE,X86-SSE1,X86-SSE-LIN,X86-SSE1-LIN
24; RUN: llc < %s -mtriple=i386-pc-windows-msvc     -mattr=-sse  | FileCheck %s --check-prefixes=X87,X87-WIN
25; RUN: llc < %s -mtriple=i386-unknown-linux-gnu   -mattr=-sse  | FileCheck %s --check-prefixes=X87,X87-LIN
26
27; Check that scalar FP conversions to signed and unsigned int32 are using
28; reasonable sequences, across platforms and target switches.
29
30define i32 @f_to_u32(float %a) nounwind {
31; X86-AVX512-LABEL: f_to_u32:
32; X86-AVX512:       # %bb.0:
33; X86-AVX512-NEXT:    vcvttss2usi {{[0-9]+}}(%esp), %eax
34; X86-AVX512-NEXT:    retl
35;
36; X64-AVX512-LABEL: f_to_u32:
37; X64-AVX512:       # %bb.0:
38; X64-AVX512-NEXT:    vcvttss2usi %xmm0, %eax
39; X64-AVX512-NEXT:    retq
40;
41; X86-SSE3-WIN-LABEL: f_to_u32:
42; X86-SSE3-WIN:       # %bb.0:
43; X86-SSE3-WIN-NEXT:    pushl %ebp
44; X86-SSE3-WIN-NEXT:    movl %esp, %ebp
45; X86-SSE3-WIN-NEXT:    andl $-8, %esp
46; X86-SSE3-WIN-NEXT:    subl $8, %esp
47; X86-SSE3-WIN-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
48; X86-SSE3-WIN-NEXT:    movss %xmm0, (%esp)
49; X86-SSE3-WIN-NEXT:    flds (%esp)
50; X86-SSE3-WIN-NEXT:    fisttpll (%esp)
51; X86-SSE3-WIN-NEXT:    movl (%esp), %eax
52; X86-SSE3-WIN-NEXT:    movl %ebp, %esp
53; X86-SSE3-WIN-NEXT:    popl %ebp
54; X86-SSE3-WIN-NEXT:    retl
55;
56; X86-SSE3-LIN-LABEL: f_to_u32:
57; X86-SSE3-LIN:       # %bb.0:
58; X86-SSE3-LIN-NEXT:    subl $12, %esp
59; X86-SSE3-LIN-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
60; X86-SSE3-LIN-NEXT:    movss %xmm0, (%esp)
61; X86-SSE3-LIN-NEXT:    flds (%esp)
62; X86-SSE3-LIN-NEXT:    fisttpll (%esp)
63; X86-SSE3-LIN-NEXT:    movl (%esp), %eax
64; X86-SSE3-LIN-NEXT:    addl $12, %esp
65; X86-SSE3-LIN-NEXT:    retl
66;
67; X64-SSE-LABEL: f_to_u32:
68; X64-SSE:       # %bb.0:
69; X64-SSE-NEXT:    cvttss2si %xmm0, %rax
70; X64-SSE-NEXT:    # kill: def $eax killed $eax killed $rax
71; X64-SSE-NEXT:    retq
72;
73; X86-SSE2-LABEL: f_to_u32:
74; X86-SSE2:       # %bb.0:
75; X86-SSE2-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
76; X86-SSE2-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
77; X86-SSE2-NEXT:    movaps %xmm0, %xmm2
78; X86-SSE2-NEXT:    subss %xmm1, %xmm2
79; X86-SSE2-NEXT:    cvttss2si %xmm2, %ecx
80; X86-SSE2-NEXT:    xorl $-2147483648, %ecx # imm = 0x80000000
81; X86-SSE2-NEXT:    cvttss2si %xmm0, %eax
82; X86-SSE2-NEXT:    ucomiss %xmm0, %xmm1
83; X86-SSE2-NEXT:    cmovbel %ecx, %eax
84; X86-SSE2-NEXT:    retl
85;
86; X86-SSE1-LABEL: f_to_u32:
87; X86-SSE1:       # %bb.0:
88; X86-SSE1-NEXT:    movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
89; X86-SSE1-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
90; X86-SSE1-NEXT:    movaps %xmm0, %xmm2
91; X86-SSE1-NEXT:    subss %xmm1, %xmm2
92; X86-SSE1-NEXT:    cvttss2si %xmm2, %ecx
93; X86-SSE1-NEXT:    xorl $-2147483648, %ecx # imm = 0x80000000
94; X86-SSE1-NEXT:    cvttss2si %xmm0, %eax
95; X86-SSE1-NEXT:    ucomiss %xmm0, %xmm1
96; X86-SSE1-NEXT:    cmovbel %ecx, %eax
97; X86-SSE1-NEXT:    retl
98;
99; X87-WIN-LABEL: f_to_u32:
100; X87-WIN:       # %bb.0:
101; X87-WIN-NEXT:    pushl %ebp
102; X87-WIN-NEXT:    movl %esp, %ebp
103; X87-WIN-NEXT:    andl $-8, %esp
104; X87-WIN-NEXT:    subl $16, %esp
105; X87-WIN-NEXT:    flds 8(%ebp)
106; X87-WIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
107; X87-WIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
108; X87-WIN-NEXT:    orl $3072, %eax # imm = 0xC00
109; X87-WIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
110; X87-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
111; X87-WIN-NEXT:    fistpll {{[0-9]+}}(%esp)
112; X87-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
113; X87-WIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
114; X87-WIN-NEXT:    movl %ebp, %esp
115; X87-WIN-NEXT:    popl %ebp
116; X87-WIN-NEXT:    retl
117;
118; X87-LIN-LABEL: f_to_u32:
119; X87-LIN:       # %bb.0:
120; X87-LIN-NEXT:    subl $20, %esp
121; X87-LIN-NEXT:    flds {{[0-9]+}}(%esp)
122; X87-LIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
123; X87-LIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
124; X87-LIN-NEXT:    orl $3072, %eax # imm = 0xC00
125; X87-LIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
126; X87-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
127; X87-LIN-NEXT:    fistpll {{[0-9]+}}(%esp)
128; X87-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
129; X87-LIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
130; X87-LIN-NEXT:    addl $20, %esp
131; X87-LIN-NEXT:    retl
132  %r = fptoui float %a to i32
133  ret i32 %r
134}
135
136define i32 @f_to_s32(float %a) nounwind {
137; X86-AVX512-LABEL: f_to_s32:
138; X86-AVX512:       # %bb.0:
139; X86-AVX512-NEXT:    vcvttss2si {{[0-9]+}}(%esp), %eax
140; X86-AVX512-NEXT:    retl
141;
142; X64-AVX512-LABEL: f_to_s32:
143; X64-AVX512:       # %bb.0:
144; X64-AVX512-NEXT:    vcvttss2si %xmm0, %eax
145; X64-AVX512-NEXT:    retq
146;
147; X86-SSE-LABEL: f_to_s32:
148; X86-SSE:       # %bb.0:
149; X86-SSE-NEXT:    cvttss2si {{[0-9]+}}(%esp), %eax
150; X86-SSE-NEXT:    retl
151;
152; X64-SSE-LABEL: f_to_s32:
153; X64-SSE:       # %bb.0:
154; X64-SSE-NEXT:    cvttss2si %xmm0, %eax
155; X64-SSE-NEXT:    retq
156;
157; X87-LABEL: f_to_s32:
158; X87:       # %bb.0:
159; X87-NEXT:    subl $8, %esp
160; X87-NEXT:    flds {{[0-9]+}}(%esp)
161; X87-NEXT:    fnstcw (%esp)
162; X87-NEXT:    movzwl (%esp), %eax
163; X87-NEXT:    orl $3072, %eax # imm = 0xC00
164; X87-NEXT:    movw %ax, {{[0-9]+}}(%esp)
165; X87-NEXT:    fldcw {{[0-9]+}}(%esp)
166; X87-NEXT:    fistpl {{[0-9]+}}(%esp)
167; X87-NEXT:    fldcw (%esp)
168; X87-NEXT:    movl {{[0-9]+}}(%esp), %eax
169; X87-NEXT:    addl $8, %esp
170; X87-NEXT:    retl
171  %r = fptosi float %a to i32
172  ret i32 %r
173}
174
175define i32 @d_to_u32(double %a) nounwind {
176; X86-AVX512-LABEL: d_to_u32:
177; X86-AVX512:       # %bb.0:
178; X86-AVX512-NEXT:    vcvttsd2usi {{[0-9]+}}(%esp), %eax
179; X86-AVX512-NEXT:    retl
180;
181; X64-AVX512-LABEL: d_to_u32:
182; X64-AVX512:       # %bb.0:
183; X64-AVX512-NEXT:    vcvttsd2usi %xmm0, %eax
184; X64-AVX512-NEXT:    retq
185;
186; X86-SSE3-WIN-LABEL: d_to_u32:
187; X86-SSE3-WIN:       # %bb.0:
188; X86-SSE3-WIN-NEXT:    pushl %ebp
189; X86-SSE3-WIN-NEXT:    movl %esp, %ebp
190; X86-SSE3-WIN-NEXT:    andl $-8, %esp
191; X86-SSE3-WIN-NEXT:    subl $8, %esp
192; X86-SSE3-WIN-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
193; X86-SSE3-WIN-NEXT:    movsd %xmm0, (%esp)
194; X86-SSE3-WIN-NEXT:    fldl (%esp)
195; X86-SSE3-WIN-NEXT:    fisttpll (%esp)
196; X86-SSE3-WIN-NEXT:    movl (%esp), %eax
197; X86-SSE3-WIN-NEXT:    movl %ebp, %esp
198; X86-SSE3-WIN-NEXT:    popl %ebp
199; X86-SSE3-WIN-NEXT:    retl
200;
201; X86-SSE3-LIN-LABEL: d_to_u32:
202; X86-SSE3-LIN:       # %bb.0:
203; X86-SSE3-LIN-NEXT:    subl $12, %esp
204; X86-SSE3-LIN-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
205; X86-SSE3-LIN-NEXT:    movsd %xmm0, (%esp)
206; X86-SSE3-LIN-NEXT:    fldl (%esp)
207; X86-SSE3-LIN-NEXT:    fisttpll (%esp)
208; X86-SSE3-LIN-NEXT:    movl (%esp), %eax
209; X86-SSE3-LIN-NEXT:    addl $12, %esp
210; X86-SSE3-LIN-NEXT:    retl
211;
212; X64-SSE-LABEL: d_to_u32:
213; X64-SSE:       # %bb.0:
214; X64-SSE-NEXT:    cvttsd2si %xmm0, %rax
215; X64-SSE-NEXT:    # kill: def $eax killed $eax killed $rax
216; X64-SSE-NEXT:    retq
217;
218; X86-SSE2-LABEL: d_to_u32:
219; X86-SSE2:       # %bb.0:
220; X86-SSE2-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
221; X86-SSE2-NEXT:    movsd {{.*#+}} xmm1 = mem[0],zero
222; X86-SSE2-NEXT:    movapd %xmm0, %xmm2
223; X86-SSE2-NEXT:    subsd %xmm1, %xmm2
224; X86-SSE2-NEXT:    cvttsd2si %xmm2, %ecx
225; X86-SSE2-NEXT:    xorl $-2147483648, %ecx # imm = 0x80000000
226; X86-SSE2-NEXT:    cvttsd2si %xmm0, %eax
227; X86-SSE2-NEXT:    ucomisd %xmm0, %xmm1
228; X86-SSE2-NEXT:    cmovbel %ecx, %eax
229; X86-SSE2-NEXT:    retl
230;
231; X86-SSE1-WIN-LABEL: d_to_u32:
232; X86-SSE1-WIN:       # %bb.0:
233; X86-SSE1-WIN-NEXT:    pushl %ebp
234; X86-SSE1-WIN-NEXT:    movl %esp, %ebp
235; X86-SSE1-WIN-NEXT:    andl $-8, %esp
236; X86-SSE1-WIN-NEXT:    subl $16, %esp
237; X86-SSE1-WIN-NEXT:    fldl 8(%ebp)
238; X86-SSE1-WIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
239; X86-SSE1-WIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
240; X86-SSE1-WIN-NEXT:    orl $3072, %eax # imm = 0xC00
241; X86-SSE1-WIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
242; X86-SSE1-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
243; X86-SSE1-WIN-NEXT:    fistpll {{[0-9]+}}(%esp)
244; X86-SSE1-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
245; X86-SSE1-WIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
246; X86-SSE1-WIN-NEXT:    movl %ebp, %esp
247; X86-SSE1-WIN-NEXT:    popl %ebp
248; X86-SSE1-WIN-NEXT:    retl
249;
250; X86-SSE1-LIN-LABEL: d_to_u32:
251; X86-SSE1-LIN:       # %bb.0:
252; X86-SSE1-LIN-NEXT:    subl $20, %esp
253; X86-SSE1-LIN-NEXT:    fldl {{[0-9]+}}(%esp)
254; X86-SSE1-LIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
255; X86-SSE1-LIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
256; X86-SSE1-LIN-NEXT:    orl $3072, %eax # imm = 0xC00
257; X86-SSE1-LIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
258; X86-SSE1-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
259; X86-SSE1-LIN-NEXT:    fistpll {{[0-9]+}}(%esp)
260; X86-SSE1-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
261; X86-SSE1-LIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
262; X86-SSE1-LIN-NEXT:    addl $20, %esp
263; X86-SSE1-LIN-NEXT:    retl
264;
265; X87-WIN-LABEL: d_to_u32:
266; X87-WIN:       # %bb.0:
267; X87-WIN-NEXT:    pushl %ebp
268; X87-WIN-NEXT:    movl %esp, %ebp
269; X87-WIN-NEXT:    andl $-8, %esp
270; X87-WIN-NEXT:    subl $16, %esp
271; X87-WIN-NEXT:    fldl 8(%ebp)
272; X87-WIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
273; X87-WIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
274; X87-WIN-NEXT:    orl $3072, %eax # imm = 0xC00
275; X87-WIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
276; X87-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
277; X87-WIN-NEXT:    fistpll {{[0-9]+}}(%esp)
278; X87-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
279; X87-WIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
280; X87-WIN-NEXT:    movl %ebp, %esp
281; X87-WIN-NEXT:    popl %ebp
282; X87-WIN-NEXT:    retl
283;
284; X87-LIN-LABEL: d_to_u32:
285; X87-LIN:       # %bb.0:
286; X87-LIN-NEXT:    subl $20, %esp
287; X87-LIN-NEXT:    fldl {{[0-9]+}}(%esp)
288; X87-LIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
289; X87-LIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
290; X87-LIN-NEXT:    orl $3072, %eax # imm = 0xC00
291; X87-LIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
292; X87-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
293; X87-LIN-NEXT:    fistpll {{[0-9]+}}(%esp)
294; X87-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
295; X87-LIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
296; X87-LIN-NEXT:    addl $20, %esp
297; X87-LIN-NEXT:    retl
298  %r = fptoui double %a to i32
299  ret i32 %r
300}
301
302define i32 @d_to_s32(double %a) nounwind {
303; X86-AVX512-LABEL: d_to_s32:
304; X86-AVX512:       # %bb.0:
305; X86-AVX512-NEXT:    vcvttsd2si {{[0-9]+}}(%esp), %eax
306; X86-AVX512-NEXT:    retl
307;
308; X64-AVX512-LABEL: d_to_s32:
309; X64-AVX512:       # %bb.0:
310; X64-AVX512-NEXT:    vcvttsd2si %xmm0, %eax
311; X64-AVX512-NEXT:    retq
312;
313; X86-SSE3-LABEL: d_to_s32:
314; X86-SSE3:       # %bb.0:
315; X86-SSE3-NEXT:    cvttsd2si {{[0-9]+}}(%esp), %eax
316; X86-SSE3-NEXT:    retl
317;
318; X64-SSE-LABEL: d_to_s32:
319; X64-SSE:       # %bb.0:
320; X64-SSE-NEXT:    cvttsd2si %xmm0, %eax
321; X64-SSE-NEXT:    retq
322;
323; X86-SSE2-LABEL: d_to_s32:
324; X86-SSE2:       # %bb.0:
325; X86-SSE2-NEXT:    cvttsd2si {{[0-9]+}}(%esp), %eax
326; X86-SSE2-NEXT:    retl
327;
328; X86-SSE1-LABEL: d_to_s32:
329; X86-SSE1:       # %bb.0:
330; X86-SSE1-NEXT:    subl $8, %esp
331; X86-SSE1-NEXT:    fldl {{[0-9]+}}(%esp)
332; X86-SSE1-NEXT:    fnstcw (%esp)
333; X86-SSE1-NEXT:    movzwl (%esp), %eax
334; X86-SSE1-NEXT:    orl $3072, %eax # imm = 0xC00
335; X86-SSE1-NEXT:    movw %ax, {{[0-9]+}}(%esp)
336; X86-SSE1-NEXT:    fldcw {{[0-9]+}}(%esp)
337; X86-SSE1-NEXT:    fistpl {{[0-9]+}}(%esp)
338; X86-SSE1-NEXT:    fldcw (%esp)
339; X86-SSE1-NEXT:    movl {{[0-9]+}}(%esp), %eax
340; X86-SSE1-NEXT:    addl $8, %esp
341; X86-SSE1-NEXT:    retl
342;
343; X87-LABEL: d_to_s32:
344; X87:       # %bb.0:
345; X87-NEXT:    subl $8, %esp
346; X87-NEXT:    fldl {{[0-9]+}}(%esp)
347; X87-NEXT:    fnstcw (%esp)
348; X87-NEXT:    movzwl (%esp), %eax
349; X87-NEXT:    orl $3072, %eax # imm = 0xC00
350; X87-NEXT:    movw %ax, {{[0-9]+}}(%esp)
351; X87-NEXT:    fldcw {{[0-9]+}}(%esp)
352; X87-NEXT:    fistpl {{[0-9]+}}(%esp)
353; X87-NEXT:    fldcw (%esp)
354; X87-NEXT:    movl {{[0-9]+}}(%esp), %eax
355; X87-NEXT:    addl $8, %esp
356; X87-NEXT:    retl
357  %r = fptosi double %a to i32
358  ret i32 %r
359}
360
361define i32 @x_to_u32(x86_fp80 %a) nounwind {
362; X86-AVX512-WIN-LABEL: x_to_u32:
363; X86-AVX512-WIN:       # %bb.0:
364; X86-AVX512-WIN-NEXT:    pushl %ebp
365; X86-AVX512-WIN-NEXT:    movl %esp, %ebp
366; X86-AVX512-WIN-NEXT:    andl $-8, %esp
367; X86-AVX512-WIN-NEXT:    subl $8, %esp
368; X86-AVX512-WIN-NEXT:    fldt 8(%ebp)
369; X86-AVX512-WIN-NEXT:    fisttpll (%esp)
370; X86-AVX512-WIN-NEXT:    movl (%esp), %eax
371; X86-AVX512-WIN-NEXT:    movl %ebp, %esp
372; X86-AVX512-WIN-NEXT:    popl %ebp
373; X86-AVX512-WIN-NEXT:    retl
374;
375; X86-AVX512-LIN-LABEL: x_to_u32:
376; X86-AVX512-LIN:       # %bb.0:
377; X86-AVX512-LIN-NEXT:    subl $12, %esp
378; X86-AVX512-LIN-NEXT:    fldt {{[0-9]+}}(%esp)
379; X86-AVX512-LIN-NEXT:    fisttpll (%esp)
380; X86-AVX512-LIN-NEXT:    movl (%esp), %eax
381; X86-AVX512-LIN-NEXT:    addl $12, %esp
382; X86-AVX512-LIN-NEXT:    retl
383;
384; X64-AVX512-WIN-LABEL: x_to_u32:
385; X64-AVX512-WIN:       # %bb.0:
386; X64-AVX512-WIN-NEXT:    pushq %rax
387; X64-AVX512-WIN-NEXT:    fldt (%rcx)
388; X64-AVX512-WIN-NEXT:    fisttpll (%rsp)
389; X64-AVX512-WIN-NEXT:    movl (%rsp), %eax
390; X64-AVX512-WIN-NEXT:    popq %rcx
391; X64-AVX512-WIN-NEXT:    retq
392;
393; X64-AVX512-LIN-LABEL: x_to_u32:
394; X64-AVX512-LIN:       # %bb.0:
395; X64-AVX512-LIN-NEXT:    fldt {{[0-9]+}}(%rsp)
396; X64-AVX512-LIN-NEXT:    fisttpll -{{[0-9]+}}(%rsp)
397; X64-AVX512-LIN-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
398; X64-AVX512-LIN-NEXT:    retq
399;
400; X86-SSE3-WIN-LABEL: x_to_u32:
401; X86-SSE3-WIN:       # %bb.0:
402; X86-SSE3-WIN-NEXT:    pushl %ebp
403; X86-SSE3-WIN-NEXT:    movl %esp, %ebp
404; X86-SSE3-WIN-NEXT:    andl $-8, %esp
405; X86-SSE3-WIN-NEXT:    subl $8, %esp
406; X86-SSE3-WIN-NEXT:    fldt 8(%ebp)
407; X86-SSE3-WIN-NEXT:    fisttpll (%esp)
408; X86-SSE3-WIN-NEXT:    movl (%esp), %eax
409; X86-SSE3-WIN-NEXT:    movl %ebp, %esp
410; X86-SSE3-WIN-NEXT:    popl %ebp
411; X86-SSE3-WIN-NEXT:    retl
412;
413; X86-SSE3-LIN-LABEL: x_to_u32:
414; X86-SSE3-LIN:       # %bb.0:
415; X86-SSE3-LIN-NEXT:    subl $12, %esp
416; X86-SSE3-LIN-NEXT:    fldt {{[0-9]+}}(%esp)
417; X86-SSE3-LIN-NEXT:    fisttpll (%esp)
418; X86-SSE3-LIN-NEXT:    movl (%esp), %eax
419; X86-SSE3-LIN-NEXT:    addl $12, %esp
420; X86-SSE3-LIN-NEXT:    retl
421;
422; X64-SSE3-WIN-LABEL: x_to_u32:
423; X64-SSE3-WIN:       # %bb.0:
424; X64-SSE3-WIN-NEXT:    pushq %rax
425; X64-SSE3-WIN-NEXT:    fldt (%rcx)
426; X64-SSE3-WIN-NEXT:    fisttpll (%rsp)
427; X64-SSE3-WIN-NEXT:    movl (%rsp), %eax
428; X64-SSE3-WIN-NEXT:    popq %rcx
429; X64-SSE3-WIN-NEXT:    retq
430;
431; X64-SSE3-LIN-LABEL: x_to_u32:
432; X64-SSE3-LIN:       # %bb.0:
433; X64-SSE3-LIN-NEXT:    fldt {{[0-9]+}}(%rsp)
434; X64-SSE3-LIN-NEXT:    fisttpll -{{[0-9]+}}(%rsp)
435; X64-SSE3-LIN-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
436; X64-SSE3-LIN-NEXT:    retq
437;
438; X86-SSE2-WIN-LABEL: x_to_u32:
439; X86-SSE2-WIN:       # %bb.0:
440; X86-SSE2-WIN-NEXT:    pushl %ebp
441; X86-SSE2-WIN-NEXT:    movl %esp, %ebp
442; X86-SSE2-WIN-NEXT:    andl $-8, %esp
443; X86-SSE2-WIN-NEXT:    subl $16, %esp
444; X86-SSE2-WIN-NEXT:    fldt 8(%ebp)
445; X86-SSE2-WIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
446; X86-SSE2-WIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
447; X86-SSE2-WIN-NEXT:    orl $3072, %eax # imm = 0xC00
448; X86-SSE2-WIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
449; X86-SSE2-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
450; X86-SSE2-WIN-NEXT:    fistpll {{[0-9]+}}(%esp)
451; X86-SSE2-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
452; X86-SSE2-WIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
453; X86-SSE2-WIN-NEXT:    movl %ebp, %esp
454; X86-SSE2-WIN-NEXT:    popl %ebp
455; X86-SSE2-WIN-NEXT:    retl
456;
457; X86-SSE2-LIN-LABEL: x_to_u32:
458; X86-SSE2-LIN:       # %bb.0:
459; X86-SSE2-LIN-NEXT:    subl $20, %esp
460; X86-SSE2-LIN-NEXT:    fldt {{[0-9]+}}(%esp)
461; X86-SSE2-LIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
462; X86-SSE2-LIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
463; X86-SSE2-LIN-NEXT:    orl $3072, %eax # imm = 0xC00
464; X86-SSE2-LIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
465; X86-SSE2-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
466; X86-SSE2-LIN-NEXT:    fistpll {{[0-9]+}}(%esp)
467; X86-SSE2-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
468; X86-SSE2-LIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
469; X86-SSE2-LIN-NEXT:    addl $20, %esp
470; X86-SSE2-LIN-NEXT:    retl
471;
472; X64-SSE2-WIN-LABEL: x_to_u32:
473; X64-SSE2-WIN:       # %bb.0:
474; X64-SSE2-WIN-NEXT:    subq $16, %rsp
475; X64-SSE2-WIN-NEXT:    fldt (%rcx)
476; X64-SSE2-WIN-NEXT:    fnstcw {{[0-9]+}}(%rsp)
477; X64-SSE2-WIN-NEXT:    movzwl {{[0-9]+}}(%rsp), %eax
478; X64-SSE2-WIN-NEXT:    orl $3072, %eax # imm = 0xC00
479; X64-SSE2-WIN-NEXT:    movw %ax, {{[0-9]+}}(%rsp)
480; X64-SSE2-WIN-NEXT:    fldcw {{[0-9]+}}(%rsp)
481; X64-SSE2-WIN-NEXT:    fistpll {{[0-9]+}}(%rsp)
482; X64-SSE2-WIN-NEXT:    fldcw {{[0-9]+}}(%rsp)
483; X64-SSE2-WIN-NEXT:    movl {{[0-9]+}}(%rsp), %eax
484; X64-SSE2-WIN-NEXT:    addq $16, %rsp
485; X64-SSE2-WIN-NEXT:    retq
486;
487; X64-SSE2-LIN-LABEL: x_to_u32:
488; X64-SSE2-LIN:       # %bb.0:
489; X64-SSE2-LIN-NEXT:    fldt {{[0-9]+}}(%rsp)
490; X64-SSE2-LIN-NEXT:    fnstcw -{{[0-9]+}}(%rsp)
491; X64-SSE2-LIN-NEXT:    movzwl -{{[0-9]+}}(%rsp), %eax
492; X64-SSE2-LIN-NEXT:    orl $3072, %eax # imm = 0xC00
493; X64-SSE2-LIN-NEXT:    movw %ax, -{{[0-9]+}}(%rsp)
494; X64-SSE2-LIN-NEXT:    fldcw -{{[0-9]+}}(%rsp)
495; X64-SSE2-LIN-NEXT:    fistpll -{{[0-9]+}}(%rsp)
496; X64-SSE2-LIN-NEXT:    fldcw -{{[0-9]+}}(%rsp)
497; X64-SSE2-LIN-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
498; X64-SSE2-LIN-NEXT:    retq
499;
500; X86-SSE1-WIN-LABEL: x_to_u32:
501; X86-SSE1-WIN:       # %bb.0:
502; X86-SSE1-WIN-NEXT:    pushl %ebp
503; X86-SSE1-WIN-NEXT:    movl %esp, %ebp
504; X86-SSE1-WIN-NEXT:    andl $-8, %esp
505; X86-SSE1-WIN-NEXT:    subl $16, %esp
506; X86-SSE1-WIN-NEXT:    fldt 8(%ebp)
507; X86-SSE1-WIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
508; X86-SSE1-WIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
509; X86-SSE1-WIN-NEXT:    orl $3072, %eax # imm = 0xC00
510; X86-SSE1-WIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
511; X86-SSE1-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
512; X86-SSE1-WIN-NEXT:    fistpll {{[0-9]+}}(%esp)
513; X86-SSE1-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
514; X86-SSE1-WIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
515; X86-SSE1-WIN-NEXT:    movl %ebp, %esp
516; X86-SSE1-WIN-NEXT:    popl %ebp
517; X86-SSE1-WIN-NEXT:    retl
518;
519; X86-SSE1-LIN-LABEL: x_to_u32:
520; X86-SSE1-LIN:       # %bb.0:
521; X86-SSE1-LIN-NEXT:    subl $20, %esp
522; X86-SSE1-LIN-NEXT:    fldt {{[0-9]+}}(%esp)
523; X86-SSE1-LIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
524; X86-SSE1-LIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
525; X86-SSE1-LIN-NEXT:    orl $3072, %eax # imm = 0xC00
526; X86-SSE1-LIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
527; X86-SSE1-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
528; X86-SSE1-LIN-NEXT:    fistpll {{[0-9]+}}(%esp)
529; X86-SSE1-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
530; X86-SSE1-LIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
531; X86-SSE1-LIN-NEXT:    addl $20, %esp
532; X86-SSE1-LIN-NEXT:    retl
533;
534; X87-WIN-LABEL: x_to_u32:
535; X87-WIN:       # %bb.0:
536; X87-WIN-NEXT:    pushl %ebp
537; X87-WIN-NEXT:    movl %esp, %ebp
538; X87-WIN-NEXT:    andl $-8, %esp
539; X87-WIN-NEXT:    subl $16, %esp
540; X87-WIN-NEXT:    fldt 8(%ebp)
541; X87-WIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
542; X87-WIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
543; X87-WIN-NEXT:    orl $3072, %eax # imm = 0xC00
544; X87-WIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
545; X87-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
546; X87-WIN-NEXT:    fistpll {{[0-9]+}}(%esp)
547; X87-WIN-NEXT:    fldcw {{[0-9]+}}(%esp)
548; X87-WIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
549; X87-WIN-NEXT:    movl %ebp, %esp
550; X87-WIN-NEXT:    popl %ebp
551; X87-WIN-NEXT:    retl
552;
553; X87-LIN-LABEL: x_to_u32:
554; X87-LIN:       # %bb.0:
555; X87-LIN-NEXT:    subl $20, %esp
556; X87-LIN-NEXT:    fldt {{[0-9]+}}(%esp)
557; X87-LIN-NEXT:    fnstcw {{[0-9]+}}(%esp)
558; X87-LIN-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
559; X87-LIN-NEXT:    orl $3072, %eax # imm = 0xC00
560; X87-LIN-NEXT:    movw %ax, {{[0-9]+}}(%esp)
561; X87-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
562; X87-LIN-NEXT:    fistpll {{[0-9]+}}(%esp)
563; X87-LIN-NEXT:    fldcw {{[0-9]+}}(%esp)
564; X87-LIN-NEXT:    movl {{[0-9]+}}(%esp), %eax
565; X87-LIN-NEXT:    addl $20, %esp
566; X87-LIN-NEXT:    retl
567  %r = fptoui x86_fp80 %a to i32
568  ret i32 %r
569}
570
571define i32 @x_to_s32(x86_fp80 %a) nounwind {
572; X86-AVX512-LABEL: x_to_s32:
573; X86-AVX512:       # %bb.0:
574; X86-AVX512-NEXT:    pushl %eax
575; X86-AVX512-NEXT:    fldt {{[0-9]+}}(%esp)
576; X86-AVX512-NEXT:    fisttpl (%esp)
577; X86-AVX512-NEXT:    movl (%esp), %eax
578; X86-AVX512-NEXT:    popl %ecx
579; X86-AVX512-NEXT:    retl
580;
581; X64-AVX512-WIN-LABEL: x_to_s32:
582; X64-AVX512-WIN:       # %bb.0:
583; X64-AVX512-WIN-NEXT:    pushq %rax
584; X64-AVX512-WIN-NEXT:    fldt (%rcx)
585; X64-AVX512-WIN-NEXT:    fisttpl {{[0-9]+}}(%rsp)
586; X64-AVX512-WIN-NEXT:    movl {{[0-9]+}}(%rsp), %eax
587; X64-AVX512-WIN-NEXT:    popq %rcx
588; X64-AVX512-WIN-NEXT:    retq
589;
590; X64-AVX512-LIN-LABEL: x_to_s32:
591; X64-AVX512-LIN:       # %bb.0:
592; X64-AVX512-LIN-NEXT:    fldt {{[0-9]+}}(%rsp)
593; X64-AVX512-LIN-NEXT:    fisttpl -{{[0-9]+}}(%rsp)
594; X64-AVX512-LIN-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
595; X64-AVX512-LIN-NEXT:    retq
596;
597; X86-SSE3-LABEL: x_to_s32:
598; X86-SSE3:       # %bb.0:
599; X86-SSE3-NEXT:    pushl %eax
600; X86-SSE3-NEXT:    fldt {{[0-9]+}}(%esp)
601; X86-SSE3-NEXT:    fisttpl (%esp)
602; X86-SSE3-NEXT:    movl (%esp), %eax
603; X86-SSE3-NEXT:    popl %ecx
604; X86-SSE3-NEXT:    retl
605;
606; X64-SSE3-WIN-LABEL: x_to_s32:
607; X64-SSE3-WIN:       # %bb.0:
608; X64-SSE3-WIN-NEXT:    pushq %rax
609; X64-SSE3-WIN-NEXT:    fldt (%rcx)
610; X64-SSE3-WIN-NEXT:    fisttpl {{[0-9]+}}(%rsp)
611; X64-SSE3-WIN-NEXT:    movl {{[0-9]+}}(%rsp), %eax
612; X64-SSE3-WIN-NEXT:    popq %rcx
613; X64-SSE3-WIN-NEXT:    retq
614;
615; X64-SSE3-LIN-LABEL: x_to_s32:
616; X64-SSE3-LIN:       # %bb.0:
617; X64-SSE3-LIN-NEXT:    fldt {{[0-9]+}}(%rsp)
618; X64-SSE3-LIN-NEXT:    fisttpl -{{[0-9]+}}(%rsp)
619; X64-SSE3-LIN-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
620; X64-SSE3-LIN-NEXT:    retq
621;
622; X86-SSE2-LABEL: x_to_s32:
623; X86-SSE2:       # %bb.0:
624; X86-SSE2-NEXT:    subl $8, %esp
625; X86-SSE2-NEXT:    fldt {{[0-9]+}}(%esp)
626; X86-SSE2-NEXT:    fnstcw (%esp)
627; X86-SSE2-NEXT:    movzwl (%esp), %eax
628; X86-SSE2-NEXT:    orl $3072, %eax # imm = 0xC00
629; X86-SSE2-NEXT:    movw %ax, {{[0-9]+}}(%esp)
630; X86-SSE2-NEXT:    fldcw {{[0-9]+}}(%esp)
631; X86-SSE2-NEXT:    fistpl {{[0-9]+}}(%esp)
632; X86-SSE2-NEXT:    fldcw (%esp)
633; X86-SSE2-NEXT:    movl {{[0-9]+}}(%esp), %eax
634; X86-SSE2-NEXT:    addl $8, %esp
635; X86-SSE2-NEXT:    retl
636;
637; X64-SSE2-WIN-LABEL: x_to_s32:
638; X64-SSE2-WIN:       # %bb.0:
639; X64-SSE2-WIN-NEXT:    pushq %rax
640; X64-SSE2-WIN-NEXT:    fldt (%rcx)
641; X64-SSE2-WIN-NEXT:    fnstcw (%rsp)
642; X64-SSE2-WIN-NEXT:    movzwl (%rsp), %eax
643; X64-SSE2-WIN-NEXT:    orl $3072, %eax # imm = 0xC00
644; X64-SSE2-WIN-NEXT:    movw %ax, {{[0-9]+}}(%rsp)
645; X64-SSE2-WIN-NEXT:    fldcw {{[0-9]+}}(%rsp)
646; X64-SSE2-WIN-NEXT:    fistpl {{[0-9]+}}(%rsp)
647; X64-SSE2-WIN-NEXT:    fldcw (%rsp)
648; X64-SSE2-WIN-NEXT:    movl {{[0-9]+}}(%rsp), %eax
649; X64-SSE2-WIN-NEXT:    popq %rcx
650; X64-SSE2-WIN-NEXT:    retq
651;
652; X64-SSE2-LIN-LABEL: x_to_s32:
653; X64-SSE2-LIN:       # %bb.0:
654; X64-SSE2-LIN-NEXT:    fldt {{[0-9]+}}(%rsp)
655; X64-SSE2-LIN-NEXT:    fnstcw -{{[0-9]+}}(%rsp)
656; X64-SSE2-LIN-NEXT:    movzwl -{{[0-9]+}}(%rsp), %eax
657; X64-SSE2-LIN-NEXT:    orl $3072, %eax # imm = 0xC00
658; X64-SSE2-LIN-NEXT:    movw %ax, -{{[0-9]+}}(%rsp)
659; X64-SSE2-LIN-NEXT:    fldcw -{{[0-9]+}}(%rsp)
660; X64-SSE2-LIN-NEXT:    fistpl -{{[0-9]+}}(%rsp)
661; X64-SSE2-LIN-NEXT:    fldcw -{{[0-9]+}}(%rsp)
662; X64-SSE2-LIN-NEXT:    movl -{{[0-9]+}}(%rsp), %eax
663; X64-SSE2-LIN-NEXT:    retq
664;
665; X86-SSE1-LABEL: x_to_s32:
666; X86-SSE1:       # %bb.0:
667; X86-SSE1-NEXT:    subl $8, %esp
668; X86-SSE1-NEXT:    fldt {{[0-9]+}}(%esp)
669; X86-SSE1-NEXT:    fnstcw (%esp)
670; X86-SSE1-NEXT:    movzwl (%esp), %eax
671; X86-SSE1-NEXT:    orl $3072, %eax # imm = 0xC00
672; X86-SSE1-NEXT:    movw %ax, {{[0-9]+}}(%esp)
673; X86-SSE1-NEXT:    fldcw {{[0-9]+}}(%esp)
674; X86-SSE1-NEXT:    fistpl {{[0-9]+}}(%esp)
675; X86-SSE1-NEXT:    fldcw (%esp)
676; X86-SSE1-NEXT:    movl {{[0-9]+}}(%esp), %eax
677; X86-SSE1-NEXT:    addl $8, %esp
678; X86-SSE1-NEXT:    retl
679;
680; X87-LABEL: x_to_s32:
681; X87:       # %bb.0:
682; X87-NEXT:    subl $8, %esp
683; X87-NEXT:    fldt {{[0-9]+}}(%esp)
684; X87-NEXT:    fnstcw (%esp)
685; X87-NEXT:    movzwl (%esp), %eax
686; X87-NEXT:    orl $3072, %eax # imm = 0xC00
687; X87-NEXT:    movw %ax, {{[0-9]+}}(%esp)
688; X87-NEXT:    fldcw {{[0-9]+}}(%esp)
689; X87-NEXT:    fistpl {{[0-9]+}}(%esp)
690; X87-NEXT:    fldcw (%esp)
691; X87-NEXT:    movl {{[0-9]+}}(%esp), %eax
692; X87-NEXT:    addl $8, %esp
693; X87-NEXT:    retl
694  %r = fptosi x86_fp80 %a to i32
695  ret i32 %r
696}
697
698define i32 @t_to_u32(fp128 %a) nounwind {
699; X86-AVX512-WIN-LABEL: t_to_u32:
700; X86-AVX512-WIN:       # %bb.0:
701; X86-AVX512-WIN-NEXT:    subl $16, %esp
702; X86-AVX512-WIN-NEXT:    vmovups {{[0-9]+}}(%esp), %xmm0
703; X86-AVX512-WIN-NEXT:    vmovups %xmm0, (%esp)
704; X86-AVX512-WIN-NEXT:    calll ___fixunstfsi
705; X86-AVX512-WIN-NEXT:    addl $16, %esp
706; X86-AVX512-WIN-NEXT:    retl
707;
708; X86-AVX512-LIN-LABEL: t_to_u32:
709; X86-AVX512-LIN:       # %bb.0:
710; X86-AVX512-LIN-NEXT:    subl $28, %esp
711; X86-AVX512-LIN-NEXT:    vmovaps {{[0-9]+}}(%esp), %xmm0
712; X86-AVX512-LIN-NEXT:    vmovups %xmm0, (%esp)
713; X86-AVX512-LIN-NEXT:    calll __fixunstfsi
714; X86-AVX512-LIN-NEXT:    addl $28, %esp
715; X86-AVX512-LIN-NEXT:    retl
716;
717; X64-AVX512-WIN-LABEL: t_to_u32:
718; X64-AVX512-WIN:       # %bb.0:
719; X64-AVX512-WIN-NEXT:    subq $40, %rsp
720; X64-AVX512-WIN-NEXT:    callq __fixunstfsi
721; X64-AVX512-WIN-NEXT:    addq $40, %rsp
722; X64-AVX512-WIN-NEXT:    retq
723;
724; X64-AVX512-LIN-LABEL: t_to_u32:
725; X64-AVX512-LIN:       # %bb.0:
726; X64-AVX512-LIN-NEXT:    pushq %rax
727; X64-AVX512-LIN-NEXT:    callq __fixunstfsi
728; X64-AVX512-LIN-NEXT:    popq %rcx
729; X64-AVX512-LIN-NEXT:    retq
730;
731; X86-SSE-WIN-LABEL: t_to_u32:
732; X86-SSE-WIN:       # %bb.0:
733; X86-SSE-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
734; X86-SSE-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
735; X86-SSE-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
736; X86-SSE-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
737; X86-SSE-WIN-NEXT:    calll ___fixunstfsi
738; X86-SSE-WIN-NEXT:    addl $16, %esp
739; X86-SSE-WIN-NEXT:    retl
740;
741; X86-SSE-LIN-LABEL: t_to_u32:
742; X86-SSE-LIN:       # %bb.0:
743; X86-SSE-LIN-NEXT:    subl $12, %esp
744; X86-SSE-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
745; X86-SSE-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
746; X86-SSE-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
747; X86-SSE-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
748; X86-SSE-LIN-NEXT:    calll __fixunstfsi
749; X86-SSE-LIN-NEXT:    addl $28, %esp
750; X86-SSE-LIN-NEXT:    retl
751;
752; X64-SSE-WIN-LABEL: t_to_u32:
753; X64-SSE-WIN:       # %bb.0:
754; X64-SSE-WIN-NEXT:    subq $40, %rsp
755; X64-SSE-WIN-NEXT:    callq __fixunstfsi
756; X64-SSE-WIN-NEXT:    addq $40, %rsp
757; X64-SSE-WIN-NEXT:    retq
758;
759; X64-SSE-LIN-LABEL: t_to_u32:
760; X64-SSE-LIN:       # %bb.0:
761; X64-SSE-LIN-NEXT:    pushq %rax
762; X64-SSE-LIN-NEXT:    callq __fixunstfsi
763; X64-SSE-LIN-NEXT:    popq %rcx
764; X64-SSE-LIN-NEXT:    retq
765;
766; X87-WIN-LABEL: t_to_u32:
767; X87-WIN:       # %bb.0:
768; X87-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
769; X87-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
770; X87-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
771; X87-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
772; X87-WIN-NEXT:    calll ___fixunstfsi
773; X87-WIN-NEXT:    addl $16, %esp
774; X87-WIN-NEXT:    retl
775;
776; X87-LIN-LABEL: t_to_u32:
777; X87-LIN:       # %bb.0:
778; X87-LIN-NEXT:    subl $12, %esp
779; X87-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
780; X87-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
781; X87-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
782; X87-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
783; X87-LIN-NEXT:    calll __fixunstfsi
784; X87-LIN-NEXT:    addl $28, %esp
785; X87-LIN-NEXT:    retl
786  %r = fptoui fp128 %a to i32
787  ret i32 %r
788}
789
790define i32 @t_to_s32(fp128 %a) nounwind {
791; X86-AVX512-WIN-LABEL: t_to_s32:
792; X86-AVX512-WIN:       # %bb.0:
793; X86-AVX512-WIN-NEXT:    subl $16, %esp
794; X86-AVX512-WIN-NEXT:    vmovups {{[0-9]+}}(%esp), %xmm0
795; X86-AVX512-WIN-NEXT:    vmovups %xmm0, (%esp)
796; X86-AVX512-WIN-NEXT:    calll ___fixtfsi
797; X86-AVX512-WIN-NEXT:    addl $16, %esp
798; X86-AVX512-WIN-NEXT:    retl
799;
800; X86-AVX512-LIN-LABEL: t_to_s32:
801; X86-AVX512-LIN:       # %bb.0:
802; X86-AVX512-LIN-NEXT:    subl $28, %esp
803; X86-AVX512-LIN-NEXT:    vmovaps {{[0-9]+}}(%esp), %xmm0
804; X86-AVX512-LIN-NEXT:    vmovups %xmm0, (%esp)
805; X86-AVX512-LIN-NEXT:    calll __fixtfsi
806; X86-AVX512-LIN-NEXT:    addl $28, %esp
807; X86-AVX512-LIN-NEXT:    retl
808;
809; X64-AVX512-WIN-LABEL: t_to_s32:
810; X64-AVX512-WIN:       # %bb.0:
811; X64-AVX512-WIN-NEXT:    subq $40, %rsp
812; X64-AVX512-WIN-NEXT:    callq __fixtfsi
813; X64-AVX512-WIN-NEXT:    addq $40, %rsp
814; X64-AVX512-WIN-NEXT:    retq
815;
816; X64-AVX512-LIN-LABEL: t_to_s32:
817; X64-AVX512-LIN:       # %bb.0:
818; X64-AVX512-LIN-NEXT:    pushq %rax
819; X64-AVX512-LIN-NEXT:    callq __fixtfsi
820; X64-AVX512-LIN-NEXT:    popq %rcx
821; X64-AVX512-LIN-NEXT:    retq
822;
823; X86-SSE-WIN-LABEL: t_to_s32:
824; X86-SSE-WIN:       # %bb.0:
825; X86-SSE-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
826; X86-SSE-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
827; X86-SSE-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
828; X86-SSE-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
829; X86-SSE-WIN-NEXT:    calll ___fixtfsi
830; X86-SSE-WIN-NEXT:    addl $16, %esp
831; X86-SSE-WIN-NEXT:    retl
832;
833; X86-SSE-LIN-LABEL: t_to_s32:
834; X86-SSE-LIN:       # %bb.0:
835; X86-SSE-LIN-NEXT:    subl $12, %esp
836; X86-SSE-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
837; X86-SSE-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
838; X86-SSE-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
839; X86-SSE-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
840; X86-SSE-LIN-NEXT:    calll __fixtfsi
841; X86-SSE-LIN-NEXT:    addl $28, %esp
842; X86-SSE-LIN-NEXT:    retl
843;
844; X64-SSE-WIN-LABEL: t_to_s32:
845; X64-SSE-WIN:       # %bb.0:
846; X64-SSE-WIN-NEXT:    subq $40, %rsp
847; X64-SSE-WIN-NEXT:    callq __fixtfsi
848; X64-SSE-WIN-NEXT:    addq $40, %rsp
849; X64-SSE-WIN-NEXT:    retq
850;
851; X64-SSE-LIN-LABEL: t_to_s32:
852; X64-SSE-LIN:       # %bb.0:
853; X64-SSE-LIN-NEXT:    pushq %rax
854; X64-SSE-LIN-NEXT:    callq __fixtfsi
855; X64-SSE-LIN-NEXT:    popq %rcx
856; X64-SSE-LIN-NEXT:    retq
857;
858; X87-WIN-LABEL: t_to_s32:
859; X87-WIN:       # %bb.0:
860; X87-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
861; X87-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
862; X87-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
863; X87-WIN-NEXT:    pushl {{[0-9]+}}(%esp)
864; X87-WIN-NEXT:    calll ___fixtfsi
865; X87-WIN-NEXT:    addl $16, %esp
866; X87-WIN-NEXT:    retl
867;
868; X87-LIN-LABEL: t_to_s32:
869; X87-LIN:       # %bb.0:
870; X87-LIN-NEXT:    subl $12, %esp
871; X87-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
872; X87-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
873; X87-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
874; X87-LIN-NEXT:    pushl {{[0-9]+}}(%esp)
875; X87-LIN-NEXT:    calll __fixtfsi
876; X87-LIN-NEXT:    addl $28, %esp
877; X87-LIN-NEXT:    retl
878  %r = fptosi fp128 %a to i32
879  ret i32 %r
880}
881