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
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512fp16 -mattr=+avx512vl -O3 | FileCheck %s
5 declare <32 x half> @llvm.experimental.constrained.fadd.v32f16(<32 x half>, <32 x half>, metadata, metadata)
6 declare <32 x half> @llvm.experimental.constrained.fsub.v32f16(<32 x half>, <32 x half>, metadata, metadata)
7 declare <32 x half> @llvm.experimental.constrained.fmul.v32f16(<32 x half>, <32 x half>, metadata, metadata)
8 declare <32 x half> @llvm.experimental.constrained.fdiv.v32f16(<32 x half>, <32 x half>, metadata, metadata)
9 declare <32 x half> @llvm.experimental.constrained.sqrt.v32f16(<32 x half>, metadata, metadata)
10 declare <8 x double> @llvm.experimental.constrained.fpext.v8f64.v8f16(<8 x half>, metadata)
11 declare <16 x float> @llvm.experimental.constrained.fpext.v16f32.v16f16(<16 x half>, metadata)
12 declare <8 x half> @llvm.experimental.constrained.fptrunc.v8f16.v8f64(<8 x double>, metadata, metadata)
13 declare <16 x half> @llvm.experimental.constrained.fptrunc.v16f16.v16f32(<16 x float>, metadata, metadata)
14 declare <32 x half> @llvm.experimental.constrained.fma.v32f16(<32 x half>, <32 x half>, <32 x half>, metadata, metadata)
15 declare <32 x half> @llvm.experimental.constrained.ceil.v32f16(<32 x half>, metadata)
16 declare <32 x half> @llvm.experimental.constrained.floor.v32f16(<32 x half>, metadata)
17 declare <32 x half> @llvm.experimental.constrained.trunc.v32f16(<32 x half>, metadata)
18 declare <32 x half> @llvm.experimental.constrained.rint.v32f16(<32 x half>, metadata, metadata)
19 declare <32 x half> @llvm.experimental.constrained.nearbyint.v32f16(<32 x half>, metadata, metadata)
21 define <32 x half> @f2(<32 x half> %a, <32 x half> %b) #0 {
24 ; CHECK-NEXT: vaddph %zmm1, %zmm0, %zmm0
25 ; CHECK-NEXT: ret{{[l|q]}}
26 %ret = call <32 x half> @llvm.experimental.constrained.fadd.v32f16(<32 x half> %a, <32 x half> %b,
27 metadata !"round.dynamic",
28 metadata !"fpexcept.strict") #0
32 define <32 x half> @f4(<32 x half> %a, <32 x half> %b) #0 {
35 ; CHECK-NEXT: vsubph %zmm1, %zmm0, %zmm0
36 ; CHECK-NEXT: ret{{[l|q]}}
37 %ret = call <32 x half> @llvm.experimental.constrained.fsub.v32f16(<32 x half> %a, <32 x half> %b,
38 metadata !"round.dynamic",
39 metadata !"fpexcept.strict") #0
43 define <32 x half> @f6(<32 x half> %a, <32 x half> %b) #0 {
46 ; CHECK-NEXT: vmulph %zmm1, %zmm0, %zmm0
47 ; CHECK-NEXT: ret{{[l|q]}}
48 %ret = call <32 x half> @llvm.experimental.constrained.fmul.v32f16(<32 x half> %a, <32 x half> %b,
49 metadata !"round.dynamic",
50 metadata !"fpexcept.strict") #0
54 define <32 x half> @f8(<32 x half> %a, <32 x half> %b) #0 {
57 ; CHECK-NEXT: vdivph %zmm1, %zmm0, %zmm0
58 ; CHECK-NEXT: ret{{[l|q]}}
59 %ret = call <32 x half> @llvm.experimental.constrained.fdiv.v32f16(<32 x half> %a, <32 x half> %b,
60 metadata !"round.dynamic",
61 metadata !"fpexcept.strict") #0
65 define <32 x half> @f10(<32 x half> %a) #0 {
68 ; CHECK-NEXT: vsqrtph %zmm0, %zmm0
69 ; CHECK-NEXT: ret{{[l|q]}}
70 %ret = call <32 x half> @llvm.experimental.constrained.sqrt.v32f16(
72 metadata !"round.dynamic",
73 metadata !"fpexcept.strict") #0
77 define <8 x double> @f11(<8 x half> %a) #0 {
80 ; CHECK-NEXT: vcvtph2pd %xmm0, %zmm0
81 ; CHECK-NEXT: ret{{[l|q]}}
82 %ret = call <8 x double> @llvm.experimental.constrained.fpext.v8f64.v8f16(
84 metadata !"fpexcept.strict") #0
88 define <8 x half> @f12(<8 x double> %a) #0 {
91 ; CHECK-NEXT: vcvtpd2ph %zmm0, %xmm0
92 ; CHECK-NEXT: vzeroupper
93 ; CHECK-NEXT: ret{{[l|q]}}
94 %ret = call <8 x half> @llvm.experimental.constrained.fptrunc.v8f16.v8f64(
96 metadata !"round.dynamic",
97 metadata !"fpexcept.strict") #0
101 define <32 x half> @f13(<32 x half> %a, <32 x half> %b, <32 x half> %c) #0 {
104 ; CHECK-NEXT: vfmadd213ph %zmm2, %zmm1, %zmm0
105 ; CHECK-NEXT: ret{{[l|q]}}
106 %res = call <32 x half> @llvm.experimental.constrained.fma.v32f16(<32 x half> %a, <32 x half> %b, <32 x half> %c,
107 metadata !"round.dynamic",
108 metadata !"fpexcept.strict") #0
112 define <16 x float> @f14(<16 x half> %a) #0 {
115 ; CHECK-NEXT: vcvtph2psx %ymm0, %zmm0
116 ; CHECK-NEXT: ret{{[l|q]}}
117 %ret = call <16 x float> @llvm.experimental.constrained.fpext.v16f32.v16f16(
119 metadata !"fpexcept.strict") #0
120 ret <16 x float> %ret
123 define <16 x half> @f15(<16 x float> %a) #0 {
126 ; CHECK-NEXT: vcvtps2phx %zmm0, %ymm0
127 ; CHECK-NEXT: ret{{[l|q]}}
128 %ret = call <16 x half> @llvm.experimental.constrained.fptrunc.v16f16.v16f32(
130 metadata !"round.dynamic",
131 metadata !"fpexcept.strict") #0
135 define <32 x half> @strict_vector_fceil_v32f16(<32 x half> %f) #0 {
136 ; CHECK-LABEL: strict_vector_fceil_v32f16:
138 ; CHECK-NEXT: vrndscaleph $10, %zmm0, %zmm0
139 ; CHECK-NEXT: ret{{[l|q]}}
140 %res = call <32 x half> @llvm.experimental.constrained.ceil.v32f16(<32 x half> %f, metadata !"fpexcept.strict") #0
144 define <32 x half> @strict_vector_ffloor_v32f16(<32 x half> %f) #0 {
145 ; CHECK-LABEL: strict_vector_ffloor_v32f16:
147 ; CHECK-NEXT: vrndscaleph $9, %zmm0, %zmm0
148 ; CHECK-NEXT: ret{{[l|q]}}
149 %res = call <32 x half> @llvm.experimental.constrained.floor.v32f16(<32 x half> %f, metadata !"fpexcept.strict") #0
153 define <32 x half> @strict_vector_ftrunc_v32f16(<32 x half> %f) #0 {
154 ; CHECK-LABEL: strict_vector_ftrunc_v32f16:
156 ; CHECK-NEXT: vrndscaleph $11, %zmm0, %zmm0
157 ; CHECK-NEXT: ret{{[l|q]}}
158 %res = call <32 x half> @llvm.experimental.constrained.trunc.v32f16(<32 x half> %f, metadata !"fpexcept.strict") #0
162 define <32 x half> @strict_vector_frint_v32f16(<32 x half> %f) #0 {
163 ; CHECK-LABEL: strict_vector_frint_v32f16:
165 ; CHECK-NEXT: vrndscaleph $4, %zmm0, %zmm0
166 ; CHECK-NEXT: ret{{[l|q]}}
167 %res = call <32 x half> @llvm.experimental.constrained.rint.v32f16(<32 x half> %f,
168 metadata !"round.dynamic", metadata !"fpexcept.strict") #0
172 define <32 x half> @strict_vector_fnearbyint_v32f16(<32 x half> %f) #0 {
173 ; CHECK-LABEL: strict_vector_fnearbyint_v32f16:
175 ; CHECK-NEXT: vrndscaleph $12, %zmm0, %zmm0
176 ; CHECK-NEXT: ret{{[l|q]}}
177 %res = call <32 x half> @llvm.experimental.constrained.nearbyint.v32f16(<32 x half> %f,
178 metadata !"round.dynamic", metadata !"fpexcept.strict") #0
182 attributes #0 = { strictfp }