1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512fp16 -mattr=+avx512vl -O3 | FileCheck %s --check-prefixes=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512fp16 -mattr=+avx512vl -O3 | FileCheck %s --check-prefixes=X64
5 declare i1 @llvm.experimental.constrained.fptosi.i1.f16(half, metadata)
6 declare i8 @llvm.experimental.constrained.fptosi.i8.f16(half, metadata)
7 declare i16 @llvm.experimental.constrained.fptosi.i16.f16(half, metadata)
8 declare i32 @llvm.experimental.constrained.fptosi.i32.f16(half, metadata)
9 declare i64 @llvm.experimental.constrained.fptosi.i64.f16(half, metadata)
10 declare i1 @llvm.experimental.constrained.fptoui.i1.f16(half, metadata)
11 declare i8 @llvm.experimental.constrained.fptoui.i8.f16(half, metadata)
12 declare i16 @llvm.experimental.constrained.fptoui.i16.f16(half, metadata)
13 declare i32 @llvm.experimental.constrained.fptoui.i32.f16(half, metadata)
14 declare i64 @llvm.experimental.constrained.fptoui.i64.f16(half, metadata)
16 define i1 @fptosi_f16toi1(half %x) #0 {
17 ; X86-LABEL: fptosi_f16toi1:
19 ; X86-NEXT: vcvttsh2si {{[0-9]+}}(%esp), %eax
20 ; X86-NEXT: # kill: def $al killed $al killed $eax
23 ; X64-LABEL: fptosi_f16toi1:
25 ; X64-NEXT: vcvttsh2si %xmm0, %eax
26 ; X64-NEXT: # kill: def $al killed $al killed $eax
28 %result = call i1 @llvm.experimental.constrained.fptosi.i1.f16(half %x,
29 metadata !"fpexcept.strict") #0
33 define i8 @fptosi_f16toi8(half %x) #0 {
34 ; X86-LABEL: fptosi_f16toi8:
36 ; X86-NEXT: vcvttsh2si {{[0-9]+}}(%esp), %eax
37 ; X86-NEXT: # kill: def $al killed $al killed $eax
40 ; X64-LABEL: fptosi_f16toi8:
42 ; X64-NEXT: vcvttsh2si %xmm0, %eax
43 ; X64-NEXT: # kill: def $al killed $al killed $eax
45 %result = call i8 @llvm.experimental.constrained.fptosi.i8.f16(half %x,
46 metadata !"fpexcept.strict") #0
50 define i16 @fptosi_f16toi16(half %x) #0 {
51 ; X86-LABEL: fptosi_f16toi16:
53 ; X86-NEXT: vcvttsh2si {{[0-9]+}}(%esp), %eax
54 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
57 ; X64-LABEL: fptosi_f16toi16:
59 ; X64-NEXT: vcvttsh2si %xmm0, %eax
60 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
62 %result = call i16 @llvm.experimental.constrained.fptosi.i16.f16(half %x,
63 metadata !"fpexcept.strict") #0
67 define i32 @fptosi_f16toi32(half %x) #0 {
68 ; X86-LABEL: fptosi_f16toi32:
70 ; X86-NEXT: vcvttsh2si {{[0-9]+}}(%esp), %eax
73 ; X64-LABEL: fptosi_f16toi32:
75 ; X64-NEXT: vcvttsh2si %xmm0, %eax
77 %result = call i32 @llvm.experimental.constrained.fptosi.i32.f16(half %x,
78 metadata !"fpexcept.strict") #0
82 define i64 @fptosi_f16toi64(half %x) #0 {
83 ; X86-LABEL: fptosi_f16toi64:
85 ; X86-NEXT: vmovsh {{[0-9]+}}(%esp), %xmm0
86 ; X86-NEXT: vcvttph2qq %xmm0, %xmm0
87 ; X86-NEXT: vmovd %xmm0, %eax
88 ; X86-NEXT: vpextrd $1, %xmm0, %edx
91 ; X64-LABEL: fptosi_f16toi64:
93 ; X64-NEXT: vcvttsh2si %xmm0, %rax
95 %result = call i64 @llvm.experimental.constrained.fptosi.i64.f16(half %x,
96 metadata !"fpexcept.strict") #0
100 define i1 @fptoui_f16toi1(half %x) #0 {
101 ; X86-LABEL: fptoui_f16toi1:
103 ; X86-NEXT: vcvttsh2si {{[0-9]+}}(%esp), %eax
104 ; X86-NEXT: # kill: def $al killed $al killed $eax
107 ; X64-LABEL: fptoui_f16toi1:
109 ; X64-NEXT: vcvttsh2si %xmm0, %eax
110 ; X64-NEXT: # kill: def $al killed $al killed $eax
112 %result = call i1 @llvm.experimental.constrained.fptoui.i1.f16(half %x,
113 metadata !"fpexcept.strict") #0
117 define i8 @fptoui_f16toi8(half %x) #0 {
118 ; X86-LABEL: fptoui_f16toi8:
120 ; X86-NEXT: vcvttsh2si {{[0-9]+}}(%esp), %eax
121 ; X86-NEXT: # kill: def $al killed $al killed $eax
124 ; X64-LABEL: fptoui_f16toi8:
126 ; X64-NEXT: vcvttsh2si %xmm0, %eax
127 ; X64-NEXT: # kill: def $al killed $al killed $eax
129 %result = call i8 @llvm.experimental.constrained.fptoui.i8.f16(half %x,
130 metadata !"fpexcept.strict") #0
134 define i16 @fptoui_f16toi16(half %x) #0 {
135 ; X86-LABEL: fptoui_f16toi16:
137 ; X86-NEXT: vcvttsh2si {{[0-9]+}}(%esp), %eax
138 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
141 ; X64-LABEL: fptoui_f16toi16:
143 ; X64-NEXT: vcvttsh2si %xmm0, %eax
144 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
146 %result = call i16 @llvm.experimental.constrained.fptoui.i16.f16(half %x,
147 metadata !"fpexcept.strict") #0
151 define i32 @fptoui_f16toi32(half %x) #0 {
152 ; X86-LABEL: fptoui_f16toi32:
154 ; X86-NEXT: vcvttsh2usi {{[0-9]+}}(%esp), %eax
157 ; X64-LABEL: fptoui_f16toi32:
159 ; X64-NEXT: vcvttsh2usi %xmm0, %eax
161 %result = call i32 @llvm.experimental.constrained.fptoui.i32.f16(half %x,
162 metadata !"fpexcept.strict") #0
166 define i64 @fptoui_f16toi64(half %x) #0 {
167 ; X86-LABEL: fptoui_f16toi64:
169 ; X86-NEXT: vmovsh {{[0-9]+}}(%esp), %xmm0
170 ; X86-NEXT: vcvttph2uqq %xmm0, %xmm0
171 ; X86-NEXT: vmovd %xmm0, %eax
172 ; X86-NEXT: vpextrd $1, %xmm0, %edx
175 ; X64-LABEL: fptoui_f16toi64:
177 ; X64-NEXT: vcvttsh2usi %xmm0, %rax
179 %result = call i64 @llvm.experimental.constrained.fptoui.i64.f16(half %x,
180 metadata !"fpexcept.strict") #0
184 attributes #0 = { strictfp }