1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64 -o - %s -mattr=+neon,+fullfp16 | FileCheck %s
4 define double @t1(double %x) {
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: fcvtzs d0, d0
8 ; CHECK-NEXT: scvtf d0, d0
11 %conv = fptosi double %x to i64
12 %conv1 = sitofp i64 %conv to double
16 define float @t2(float %x) {
18 ; CHECK: // %bb.0: // %entry
19 ; CHECK-NEXT: fcvtzs s0, s0
20 ; CHECK-NEXT: scvtf s0, s0
23 %conv = fptosi float %x to i32
24 %conv1 = sitofp i32 %conv to float
28 define half @t3(half %x) {
30 ; CHECK: // %bb.0: // %entry
31 ; CHECK-NEXT: fcvtzs h0, h0
32 ; CHECK-NEXT: scvtf h0, h0
35 %conv = fptosi half %x to i32
36 %conv1 = sitofp i32 %conv to half
40 define double @t4(double %x) {
42 ; CHECK: // %bb.0: // %entry
43 ; CHECK-NEXT: fcvtzu d0, d0
44 ; CHECK-NEXT: ucvtf d0, d0
47 %conv = fptoui double %x to i64
48 %conv1 = uitofp i64 %conv to double
52 define float @t5(float %x) {
54 ; CHECK: // %bb.0: // %entry
55 ; CHECK-NEXT: fcvtzu s0, s0
56 ; CHECK-NEXT: ucvtf s0, s0
59 %conv = fptoui float %x to i32
60 %conv1 = uitofp i32 %conv to float
64 define half @t6(half %x) {
66 ; CHECK: // %bb.0: // %entry
67 ; CHECK-NEXT: fcvtzu h0, h0
68 ; CHECK-NEXT: ucvtf h0, h0
71 %conv = fptoui half %x to i32
72 %conv1 = uitofp i32 %conv to half
76 define bfloat @t7(bfloat %x) {
78 ; CHECK: // %bb.0: // %entry
79 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $s0
80 ; CHECK-NEXT: fmov w9, s0
81 ; CHECK-NEXT: mov w8, #32767 // =0x7fff
82 ; CHECK-NEXT: lsl w9, w9, #16
83 ; CHECK-NEXT: fmov s0, w9
84 ; CHECK-NEXT: fcvtzs w9, s0
85 ; CHECK-NEXT: scvtf d0, w9
86 ; CHECK-NEXT: fcvtxn s0, d0
87 ; CHECK-NEXT: fmov w9, s0
88 ; CHECK-NEXT: ubfx w10, w9, #16, #1
89 ; CHECK-NEXT: add w8, w9, w8
90 ; CHECK-NEXT: add w8, w10, w8
91 ; CHECK-NEXT: lsr w8, w8, #16
92 ; CHECK-NEXT: fmov s0, w8
93 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
96 %conv = fptosi bfloat %x to i32
97 %conv1 = sitofp i32 %conv to bfloat
101 define bfloat @t8(bfloat %x) {
103 ; CHECK: // %bb.0: // %entry
104 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $s0
105 ; CHECK-NEXT: fmov w9, s0
106 ; CHECK-NEXT: mov w8, #32767 // =0x7fff
107 ; CHECK-NEXT: lsl w9, w9, #16
108 ; CHECK-NEXT: fmov s0, w9
109 ; CHECK-NEXT: fcvtzu w9, s0
110 ; CHECK-NEXT: ucvtf d0, w9
111 ; CHECK-NEXT: fcvtxn s0, d0
112 ; CHECK-NEXT: fmov w9, s0
113 ; CHECK-NEXT: ubfx w10, w9, #16, #1
114 ; CHECK-NEXT: add w8, w9, w8
115 ; CHECK-NEXT: add w8, w10, w8
116 ; CHECK-NEXT: lsr w8, w8, #16
117 ; CHECK-NEXT: fmov s0, w8
118 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
121 %conv = fptoui bfloat %x to i32
122 %conv1 = uitofp i32 %conv to bfloat
126 define double @t1_strict(double %x) #0 {
127 ; CHECK-LABEL: t1_strict:
128 ; CHECK: // %bb.0: // %entry
129 ; CHECK-NEXT: fcvtzs d0, d0
130 ; CHECK-NEXT: scvtf d0, d0
133 %conv = call i64 @llvm.experimental.constrained.fptosi.i64.f64(double %x, metadata !"fpexcept.strict") #0
134 %conv1 = call double @llvm.experimental.constrained.sitofp.f64.i64(i64 %conv, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
138 define float @t2_strict(float %x) #0 {
139 ; CHECK-LABEL: t2_strict:
140 ; CHECK: // %bb.0: // %entry
141 ; CHECK-NEXT: fcvtzs s0, s0
142 ; CHECK-NEXT: scvtf s0, s0
145 %conv = call i32 @llvm.experimental.constrained.fptosi.i32.f32(float %x, metadata !"fpexcept.strict") #0
146 %conv1 = call float @llvm.experimental.constrained.sitofp.f32.i32(i32 %conv, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
150 define half @t3_strict(half %x) #0 {
151 ; CHECK-LABEL: t3_strict:
152 ; CHECK: // %bb.0: // %entry
153 ; CHECK-NEXT: fcvtzs h0, h0
154 ; CHECK-NEXT: scvtf h0, h0
157 %conv = call i32 @llvm.experimental.constrained.fptosi.i32.f16(half %x, metadata !"fpexcept.strict") #0
158 %conv1 = call half @llvm.experimental.constrained.sitofp.f16.i32(i32 %conv, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
162 define double @t4_strict(double %x) #0 {
163 ; CHECK-LABEL: t4_strict:
164 ; CHECK: // %bb.0: // %entry
165 ; CHECK-NEXT: fcvtzu d0, d0
166 ; CHECK-NEXT: ucvtf d0, d0
169 %conv = call i64 @llvm.experimental.constrained.fptoui.i64.f64(double %x, metadata !"fpexcept.strict") #0
170 %conv1 = call double @llvm.experimental.constrained.uitofp.f64.i64(i64 %conv, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
174 define float @t5_strict(float %x) #0 {
175 ; CHECK-LABEL: t5_strict:
176 ; CHECK: // %bb.0: // %entry
177 ; CHECK-NEXT: fcvtzu s0, s0
178 ; CHECK-NEXT: ucvtf s0, s0
181 %conv = call i32 @llvm.experimental.constrained.fptoui.i32.f32(float %x, metadata !"fpexcept.strict") #0
182 %conv1 = call float @llvm.experimental.constrained.uitofp.f32.i32(i32 %conv, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
186 define half @t6_strict(half %x) #0 {
187 ; CHECK-LABEL: t6_strict:
188 ; CHECK: // %bb.0: // %entry
189 ; CHECK-NEXT: fcvtzu h0, h0
190 ; CHECK-NEXT: ucvtf h0, h0
193 %conv = call i32 @llvm.experimental.constrained.fptoui.i32.f16(half %x, metadata !"fpexcept.strict") #0
194 %conv1 = call half @llvm.experimental.constrained.uitofp.f16.i32(i32 %conv, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
198 define bfloat @t7_strict(bfloat %x) #0 {
199 ; CHECK-LABEL: t7_strict:
200 ; CHECK: // %bb.0: // %entry
201 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $s0
202 ; CHECK-NEXT: fmov w9, s0
203 ; CHECK-NEXT: mov w8, #32767 // =0x7fff
204 ; CHECK-NEXT: lsl w9, w9, #16
205 ; CHECK-NEXT: fmov s0, w9
206 ; CHECK-NEXT: fcvtzs w9, s0
207 ; CHECK-NEXT: scvtf d0, w9
208 ; CHECK-NEXT: fcvtxn s0, d0
209 ; CHECK-NEXT: fmov w9, s0
210 ; CHECK-NEXT: ubfx w10, w9, #16, #1
211 ; CHECK-NEXT: add w8, w9, w8
212 ; CHECK-NEXT: add w8, w10, w8
213 ; CHECK-NEXT: lsr w8, w8, #16
214 ; CHECK-NEXT: fmov s0, w8
215 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
218 %conv = call i32 @llvm.experimental.constrained.fptosi.i32.bf16(bfloat %x, metadata !"fpexcept.strict") #0
219 %conv1 = call bfloat @llvm.experimental.constrained.sitofp.bf16.i32(i32 %conv, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
223 define bfloat @t8_strict(bfloat %x) #0 {
224 ; CHECK-LABEL: t8_strict:
225 ; CHECK: // %bb.0: // %entry
226 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $s0
227 ; CHECK-NEXT: fmov w9, s0
228 ; CHECK-NEXT: mov w8, #32767 // =0x7fff
229 ; CHECK-NEXT: lsl w9, w9, #16
230 ; CHECK-NEXT: fmov s0, w9
231 ; CHECK-NEXT: fcvtzu w9, s0
232 ; CHECK-NEXT: ucvtf d0, w9
233 ; CHECK-NEXT: fcvtxn s0, d0
234 ; CHECK-NEXT: fmov w9, s0
235 ; CHECK-NEXT: ubfx w10, w9, #16, #1
236 ; CHECK-NEXT: add w8, w9, w8
237 ; CHECK-NEXT: add w8, w10, w8
238 ; CHECK-NEXT: lsr w8, w8, #16
239 ; CHECK-NEXT: fmov s0, w8
240 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $s0
243 %conv = call i32 @llvm.experimental.constrained.fptoui.i32.bf16(bfloat %x, metadata !"fpexcept.strict") #0
244 %conv1 = call bfloat @llvm.experimental.constrained.uitofp.bf16.i32(i32 %conv, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
248 attributes #0 = { strictfp }
250 declare i32 @llvm.experimental.constrained.fptosi.i32.bf16(bfloat, metadata)
251 declare i32 @llvm.experimental.constrained.fptoui.i32.bf16(bfloat, metadata)
252 declare i32 @llvm.experimental.constrained.fptosi.i32.f16(half, metadata)
253 declare i32 @llvm.experimental.constrained.fptoui.i32.f16(half, metadata)
254 declare i32 @llvm.experimental.constrained.fptosi.i32.f32(float, metadata)
255 declare i32 @llvm.experimental.constrained.fptoui.i32.f32(float, metadata)
256 declare i64 @llvm.experimental.constrained.fptosi.i64.f64(double, metadata)
257 declare i64 @llvm.experimental.constrained.fptoui.i64.f64(double, metadata)
258 declare bfloat @llvm.experimental.constrained.sitofp.bf16.i32(i32, metadata, metadata)
259 declare bfloat @llvm.experimental.constrained.uitofp.bf16.i32(i32, metadata, metadata)
260 declare half @llvm.experimental.constrained.sitofp.f16.i32(i32, metadata, metadata)
261 declare half @llvm.experimental.constrained.uitofp.f16.i32(i32, metadata, metadata)
262 declare float @llvm.experimental.constrained.sitofp.f32.i32(i32, metadata, metadata)
263 declare float @llvm.experimental.constrained.uitofp.f32.i32(i32, metadata, metadata)
264 declare double @llvm.experimental.constrained.sitofp.f64.i64(i64, metadata, metadata)
265 declare double @llvm.experimental.constrained.uitofp.f64.i64(i64, metadata, metadata)