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 half @llvm.experimental.constrained.sitofp.f16.i1(i1, metadata, metadata)
6 declare half @llvm.experimental.constrained.sitofp.f16.i8(i8, metadata, metadata)
7 declare half @llvm.experimental.constrained.sitofp.f16.i16(i16, metadata, metadata)
8 declare half @llvm.experimental.constrained.sitofp.f16.i32(i32, metadata, metadata)
9 declare half @llvm.experimental.constrained.sitofp.f16.i64(i64, metadata, metadata)
10 declare half @llvm.experimental.constrained.uitofp.f16.i1(i1, metadata, metadata)
11 declare half @llvm.experimental.constrained.uitofp.f16.i8(i8, metadata, metadata)
12 declare half @llvm.experimental.constrained.uitofp.f16.i16(i16, metadata, metadata)
13 declare half @llvm.experimental.constrained.uitofp.f16.i32(i32, metadata, metadata)
14 declare half @llvm.experimental.constrained.uitofp.f16.i64(i64, metadata, metadata)
16 define half @sitofp_i1tof16(i1 %x) #0 {
17 ; X86-LABEL: sitofp_i1tof16:
19 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
20 ; X86-NEXT: andb $1, %al
22 ; X86-NEXT: movsbl %al, %eax
23 ; X86-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
26 ; X64-LABEL: sitofp_i1tof16:
28 ; X64-NEXT: andb $1, %dil
30 ; X64-NEXT: movsbl %dil, %eax
31 ; X64-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
33 %result = call half @llvm.experimental.constrained.sitofp.f16.i1(i1 %x,
34 metadata !"round.dynamic",
35 metadata !"fpexcept.strict") #0
39 define half @sitofp_i8tof16(i8 %x) #0 {
40 ; X86-LABEL: sitofp_i8tof16:
42 ; X86-NEXT: movsbl {{[0-9]+}}(%esp), %eax
43 ; X86-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
46 ; X64-LABEL: sitofp_i8tof16:
48 ; X64-NEXT: movsbl %dil, %eax
49 ; X64-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
51 %result = call half @llvm.experimental.constrained.sitofp.f16.i8(i8 %x,
52 metadata !"round.dynamic",
53 metadata !"fpexcept.strict") #0
57 define half @sitofp_i16tof16(i16 %x) #0 {
58 ; X86-LABEL: sitofp_i16tof16:
60 ; X86-NEXT: movswl {{[0-9]+}}(%esp), %eax
61 ; X86-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
64 ; X64-LABEL: sitofp_i16tof16:
66 ; X64-NEXT: movswl %di, %eax
67 ; X64-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
69 %result = call half @llvm.experimental.constrained.sitofp.f16.i16(i16 %x,
70 metadata !"round.dynamic",
71 metadata !"fpexcept.strict") #0
75 define half @sitofp_i32tof16(i32 %x) #0 {
76 ; X86-LABEL: sitofp_i32tof16:
78 ; X86-NEXT: vcvtsi2shl {{[0-9]+}}(%esp), %xmm0, %xmm0
81 ; X64-LABEL: sitofp_i32tof16:
83 ; X64-NEXT: vcvtsi2sh %edi, %xmm0, %xmm0
85 %result = call half @llvm.experimental.constrained.sitofp.f16.i32(i32 %x,
86 metadata !"round.dynamic",
87 metadata !"fpexcept.strict") #0
91 define half @sitofp_i64tof16(i64 %x) #0 {
92 ; X86-LABEL: sitofp_i64tof16:
94 ; X86-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
95 ; X86-NEXT: vcvtqq2ph %xmm0, %xmm0
98 ; X64-LABEL: sitofp_i64tof16:
100 ; X64-NEXT: vcvtsi2sh %rdi, %xmm0, %xmm0
102 %result = call half @llvm.experimental.constrained.sitofp.f16.i64(i64 %x,
103 metadata !"round.dynamic",
104 metadata !"fpexcept.strict") #0
108 define half @uitofp_i1tof16(i1 %x) #0 {
109 ; X86-LABEL: uitofp_i1tof16:
111 ; X86-NEXT: movb {{[0-9]+}}(%esp), %al
112 ; X86-NEXT: andb $1, %al
113 ; X86-NEXT: movzbl %al, %eax
114 ; X86-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
117 ; X64-LABEL: uitofp_i1tof16:
119 ; X64-NEXT: andl $1, %edi
120 ; X64-NEXT: vcvtsi2sh %edi, %xmm0, %xmm0
122 %result = call half @llvm.experimental.constrained.uitofp.f16.i1(i1 %x,
123 metadata !"round.dynamic",
124 metadata !"fpexcept.strict") #0
128 define half @uitofp_i8tof16(i8 %x) #0 {
129 ; X86-LABEL: uitofp_i8tof16:
131 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
132 ; X86-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
135 ; X64-LABEL: uitofp_i8tof16:
137 ; X64-NEXT: movzbl %dil, %eax
138 ; X64-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
140 %result = call half @llvm.experimental.constrained.uitofp.f16.i8(i8 %x,
141 metadata !"round.dynamic",
142 metadata !"fpexcept.strict") #0
146 define half @uitofp_i16tof16(i16 %x) #0 {
147 ; X86-LABEL: uitofp_i16tof16:
149 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
150 ; X86-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
153 ; X64-LABEL: uitofp_i16tof16:
155 ; X64-NEXT: movzwl %di, %eax
156 ; X64-NEXT: vcvtsi2sh %eax, %xmm0, %xmm0
158 %result = call half @llvm.experimental.constrained.uitofp.f16.i16(i16 %x,
159 metadata !"round.dynamic",
160 metadata !"fpexcept.strict") #0
164 define half @uitofp_i32tof16(i32 %x) #0 {
165 ; X86-LABEL: uitofp_i32tof16:
167 ; X86-NEXT: vcvtusi2shl {{[0-9]+}}(%esp), %xmm0, %xmm0
170 ; X64-LABEL: uitofp_i32tof16:
172 ; X64-NEXT: vcvtusi2sh %edi, %xmm0, %xmm0
174 %result = call half @llvm.experimental.constrained.uitofp.f16.i32(i32 %x,
175 metadata !"round.dynamic",
176 metadata !"fpexcept.strict") #0
180 define half @uitofp_i64tof16(i64 %x) #0 {
181 ; X86-LABEL: uitofp_i64tof16:
183 ; X86-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
184 ; X86-NEXT: vcvtuqq2ph %xmm0, %xmm0
187 ; X64-LABEL: uitofp_i64tof16:
189 ; X64-NEXT: vcvtusi2sh %rdi, %xmm0, %xmm0
191 %result = call half @llvm.experimental.constrained.uitofp.f16.i64(i64 %x,
192 metadata !"round.dynamic",
193 metadata !"fpexcept.strict") #0
197 attributes #0 = { strictfp }