1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=avx512fp16,avx512vl -O3 | FileCheck %s --check-prefixes=CHECK,X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512fp16,avx512vl -O3 | FileCheck %s --check-prefixes=CHECK,X64
5 declare <16 x half> @llvm.experimental.constrained.sitofp.v16f16.v16i1(<16 x i1>, metadata, metadata)
6 declare <16 x half> @llvm.experimental.constrained.uitofp.v16f16.v16i1(<16 x i1>, metadata, metadata)
7 declare <16 x half> @llvm.experimental.constrained.sitofp.v16f16.v16i8(<16 x i8>, metadata, metadata)
8 declare <16 x half> @llvm.experimental.constrained.uitofp.v16f16.v16i8(<16 x i8>, metadata, metadata)
9 declare <16 x half> @llvm.experimental.constrained.sitofp.v16f16.v16i16(<16 x i16>, metadata, metadata)
10 declare <16 x half> @llvm.experimental.constrained.uitofp.v16f16.v16i16(<16 x i16>, metadata, metadata)
11 declare <8 x half> @llvm.experimental.constrained.sitofp.v8f16.v8i32(<8 x i32>, metadata, metadata)
12 declare <8 x half> @llvm.experimental.constrained.uitofp.v8f16.v8i32(<8 x i32>, metadata, metadata)
13 declare <4 x half> @llvm.experimental.constrained.sitofp.v4f16.v4i64(<4 x i64>, metadata, metadata)
14 declare <4 x half> @llvm.experimental.constrained.uitofp.v4f16.v4i64(<4 x i64>, metadata, metadata)
16 define <16 x half> @sitofp_v16i1_v16f16(<16 x i1> %x) #0 {
17 ; CHECK-LABEL: sitofp_v16i1_v16f16:
19 ; CHECK-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
20 ; CHECK-NEXT: vpsllw $15, %ymm0, %ymm0
21 ; CHECK-NEXT: vpsraw $15, %ymm0, %ymm0
22 ; CHECK-NEXT: vcvtw2ph %ymm0, %ymm0
23 ; CHECK-NEXT: ret{{[l|q]}}
24 %result = call <16 x half> @llvm.experimental.constrained.sitofp.v16f16.v16i1(<16 x i1> %x,
25 metadata !"round.dynamic",
26 metadata !"fpexcept.strict") #0
27 ret <16 x half> %result
30 define <16 x half> @uitofp_v16i1_v16f16(<16 x i1> %x) #0 {
31 ; X86-LABEL: uitofp_v16i1_v16f16:
33 ; X86-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
34 ; X86-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
35 ; X86-NEXT: vcvtuw2ph %ymm0, %ymm0
38 ; X64-LABEL: uitofp_v16i1_v16f16:
40 ; X64-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
41 ; X64-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
42 ; X64-NEXT: vcvtuw2ph %ymm0, %ymm0
44 %result = call <16 x half> @llvm.experimental.constrained.uitofp.v16f16.v16i1(<16 x i1> %x,
45 metadata !"round.dynamic",
46 metadata !"fpexcept.strict") #0
47 ret <16 x half> %result
50 define <16 x half> @sitofp_v16i8_v16f16(<16 x i8> %x) #0 {
51 ; CHECK-LABEL: sitofp_v16i8_v16f16:
53 ; CHECK-NEXT: vpmovsxbw %xmm0, %ymm0
54 ; CHECK-NEXT: vcvtw2ph %ymm0, %ymm0
55 ; CHECK-NEXT: ret{{[l|q]}}
56 %result = call <16 x half> @llvm.experimental.constrained.sitofp.v16f16.v16i8(<16 x i8> %x,
57 metadata !"round.dynamic",
58 metadata !"fpexcept.strict") #0
59 ret <16 x half> %result
62 define <16 x half> @uitofp_v16i8_v16f16(<16 x i8> %x) #0 {
63 ; CHECK-LABEL: uitofp_v16i8_v16f16:
65 ; CHECK-NEXT: vpmovzxbw {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero,xmm0[8],zero,xmm0[9],zero,xmm0[10],zero,xmm0[11],zero,xmm0[12],zero,xmm0[13],zero,xmm0[14],zero,xmm0[15],zero
66 ; CHECK-NEXT: vcvtuw2ph %ymm0, %ymm0
67 ; CHECK-NEXT: ret{{[l|q]}}
68 %result = call <16 x half> @llvm.experimental.constrained.uitofp.v16f16.v16i8(<16 x i8> %x,
69 metadata !"round.dynamic",
70 metadata !"fpexcept.strict") #0
71 ret <16 x half> %result
74 define <16 x half> @sitofp_v16i16_v16f16(<16 x i16> %x) #0 {
75 ; CHECK-LABEL: sitofp_v16i16_v16f16:
77 ; CHECK-NEXT: vcvtw2ph %ymm0, %ymm0
78 ; CHECK-NEXT: ret{{[l|q]}}
79 %result = call <16 x half> @llvm.experimental.constrained.sitofp.v16f16.v16i16(<16 x i16> %x,
80 metadata !"round.dynamic",
81 metadata !"fpexcept.strict") #0
82 ret <16 x half> %result
85 define <16 x half> @uitofp_v16i16_v16f16(<16 x i16> %x) #0 {
86 ; CHECK-LABEL: uitofp_v16i16_v16f16:
88 ; CHECK-NEXT: vcvtuw2ph %ymm0, %ymm0
89 ; CHECK-NEXT: ret{{[l|q]}}
90 %result = call <16 x half> @llvm.experimental.constrained.uitofp.v16f16.v16i16(<16 x i16> %x,
91 metadata !"round.dynamic",
92 metadata !"fpexcept.strict") #0
93 ret <16 x half> %result
96 define <8 x half> @sitofp_v8i32_v8f16(<8 x i32> %x) #0 {
97 ; CHECK-LABEL: sitofp_v8i32_v8f16:
99 ; CHECK-NEXT: vcvtdq2ph %ymm0, %xmm0
100 ; CHECK-NEXT: vzeroupper
101 ; CHECK-NEXT: ret{{[l|q]}}
102 %result = call <8 x half> @llvm.experimental.constrained.sitofp.v8f16.v8i32(<8 x i32> %x,
103 metadata !"round.dynamic",
104 metadata !"fpexcept.strict") #0
105 ret <8 x half> %result
108 define <8 x half> @uitofp_v8i32_v8f16(<8 x i32> %x) #0 {
109 ; CHECK-LABEL: uitofp_v8i32_v8f16:
111 ; CHECK-NEXT: vcvtudq2ph %ymm0, %xmm0
112 ; CHECK-NEXT: vzeroupper
113 ; CHECK-NEXT: ret{{[l|q]}}
114 %result = call <8 x half> @llvm.experimental.constrained.uitofp.v8f16.v8i32(<8 x i32> %x,
115 metadata !"round.dynamic",
116 metadata !"fpexcept.strict") #0
117 ret <8 x half> %result
120 define <4 x half> @sitofp_v4i64_v4f16(<4 x i64> %x) #0 {
121 ; CHECK-LABEL: sitofp_v4i64_v4f16:
123 ; CHECK-NEXT: vcvtqq2ph %ymm0, %xmm0
124 ; CHECK-NEXT: vzeroupper
125 ; CHECK-NEXT: ret{{[l|q]}}
126 %result = call <4 x half> @llvm.experimental.constrained.sitofp.v4f16.v4i64(<4 x i64> %x,
127 metadata !"round.dynamic",
128 metadata !"fpexcept.strict") #0
129 ret <4 x half> %result
132 define <4 x half> @uitofp_v4i64_v4f16(<4 x i64> %x) #0 {
133 ; CHECK-LABEL: uitofp_v4i64_v4f16:
135 ; CHECK-NEXT: vcvtuqq2ph %ymm0, %xmm0
136 ; CHECK-NEXT: vzeroupper
137 ; CHECK-NEXT: ret{{[l|q]}}
138 %result = call <4 x half> @llvm.experimental.constrained.uitofp.v4f16.v4i64(<4 x i64> %x,
139 metadata !"round.dynamic",
140 metadata !"fpexcept.strict") #0
141 ret <4 x half> %result
144 attributes #0 = { strictfp }