1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc -mtriple=aarch64-none-eabi -global-isel=0 -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3 ; RUN: llc -mtriple=aarch64-none-eabi -global-isel=1 -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GI
5 define float @fptrunc_f64_f32(double %a) {
6 ; CHECK-LABEL: fptrunc_f64_f32:
7 ; CHECK: // %bb.0: // %entry
8 ; CHECK-NEXT: fcvt s0, d0
11 %c = fptrunc double %a to float
15 define half @fptrunc_f64_f16(double %a) {
16 ; CHECK-LABEL: fptrunc_f64_f16:
17 ; CHECK: // %bb.0: // %entry
18 ; CHECK-NEXT: fcvt h0, d0
21 %c = fptrunc double %a to half
25 define half @fptrunc_f32_f16(float %a) {
26 ; CHECK-LABEL: fptrunc_f32_f16:
27 ; CHECK: // %bb.0: // %entry
28 ; CHECK-NEXT: fcvt h0, s0
31 %c = fptrunc float %a to half
35 define <2 x float> @fptrunc_v2f64_v2f32(<2 x double> %a) {
36 ; CHECK-LABEL: fptrunc_v2f64_v2f32:
37 ; CHECK: // %bb.0: // %entry
38 ; CHECK-NEXT: fcvtn v0.2s, v0.2d
41 %c = fptrunc <2 x double> %a to <2 x float>
45 define <3 x float> @fptrunc_v3f64_v3f32(<3 x double> %a) {
46 ; CHECK-SD-LABEL: fptrunc_v3f64_v3f32:
47 ; CHECK-SD: // %bb.0: // %entry
48 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
49 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1
50 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2
51 ; CHECK-SD-NEXT: mov v0.d[1], v1.d[0]
52 ; CHECK-SD-NEXT: fcvtn v0.2s, v0.2d
53 ; CHECK-SD-NEXT: fcvtn2 v0.4s, v2.2d
56 ; CHECK-GI-LABEL: fptrunc_v3f64_v3f32:
57 ; CHECK-GI: // %bb.0: // %entry
58 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
59 ; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
60 ; CHECK-GI-NEXT: fcvt s2, d2
61 ; CHECK-GI-NEXT: mov v0.d[1], v1.d[0]
62 ; CHECK-GI-NEXT: fcvtn v0.2s, v0.2d
63 ; CHECK-GI-NEXT: mov s1, v0.s[1]
64 ; CHECK-GI-NEXT: mov v0.s[1], v1.s[0]
65 ; CHECK-GI-NEXT: mov v0.s[2], v2.s[0]
66 ; CHECK-GI-NEXT: mov v0.s[3], v0.s[0]
69 %c = fptrunc <3 x double> %a to <3 x float>
73 define <4 x float> @fptrunc_v4f64_v4f32(<4 x double> %a) {
74 ; CHECK-LABEL: fptrunc_v4f64_v4f32:
75 ; CHECK: // %bb.0: // %entry
76 ; CHECK-NEXT: fcvtn v0.2s, v0.2d
77 ; CHECK-NEXT: fcvtn2 v0.4s, v1.2d
80 %c = fptrunc <4 x double> %a to <4 x float>
84 define <2 x half> @fptrunc_v2f64_v2f16(<2 x double> %a) {
85 ; CHECK-SD-LABEL: fptrunc_v2f64_v2f16:
86 ; CHECK-SD: // %bb.0: // %entry
87 ; CHECK-SD-NEXT: mov d1, v0.d[1]
88 ; CHECK-SD-NEXT: fcvt h0, d0
89 ; CHECK-SD-NEXT: fcvt h1, d1
90 ; CHECK-SD-NEXT: mov v0.h[1], v1.h[0]
91 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0
94 ; CHECK-GI-LABEL: fptrunc_v2f64_v2f16:
95 ; CHECK-GI: // %bb.0: // %entry
96 ; CHECK-GI-NEXT: mov d1, v0.d[1]
97 ; CHECK-GI-NEXT: fcvt h0, d0
98 ; CHECK-GI-NEXT: fcvt h1, d1
99 ; CHECK-GI-NEXT: mov v0.h[1], v1.h[0]
100 ; CHECK-GI-NEXT: mov v0.h[2], v0.h[0]
101 ; CHECK-GI-NEXT: mov v0.h[3], v0.h[0]
102 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
105 %c = fptrunc <2 x double> %a to <2 x half>
109 define <3 x half> @fptrunc_v3f64_v3f16(<3 x double> %a) {
110 ; CHECK-SD-LABEL: fptrunc_v3f64_v3f16:
111 ; CHECK-SD: // %bb.0: // %entry
112 ; CHECK-SD-NEXT: fcvt h1, d1
113 ; CHECK-SD-NEXT: fcvt h0, d0
114 ; CHECK-SD-NEXT: mov v0.h[1], v1.h[0]
115 ; CHECK-SD-NEXT: fcvt h1, d2
116 ; CHECK-SD-NEXT: mov v0.h[2], v1.h[0]
117 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0
120 ; CHECK-GI-LABEL: fptrunc_v3f64_v3f16:
121 ; CHECK-GI: // %bb.0: // %entry
122 ; CHECK-GI-NEXT: fcvt h0, d0
123 ; CHECK-GI-NEXT: fcvt h1, d1
124 ; CHECK-GI-NEXT: fcvt h2, d2
125 ; CHECK-GI-NEXT: mov v0.h[1], v1.h[0]
126 ; CHECK-GI-NEXT: mov v0.h[2], v2.h[0]
127 ; CHECK-GI-NEXT: mov v0.h[3], v0.h[0]
128 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
131 %c = fptrunc <3 x double> %a to <3 x half>
135 define <4 x half> @fptrunc_v4f64_v4f16(<4 x double> %a) {
136 ; CHECK-SD-LABEL: fptrunc_v4f64_v4f16:
137 ; CHECK-SD: // %bb.0: // %entry
138 ; CHECK-SD-NEXT: mov d2, v0.d[1]
139 ; CHECK-SD-NEXT: fcvt h0, d0
140 ; CHECK-SD-NEXT: fcvt h2, d2
141 ; CHECK-SD-NEXT: mov v0.h[1], v2.h[0]
142 ; CHECK-SD-NEXT: fcvt h2, d1
143 ; CHECK-SD-NEXT: mov d1, v1.d[1]
144 ; CHECK-SD-NEXT: mov v0.h[2], v2.h[0]
145 ; CHECK-SD-NEXT: fcvt h1, d1
146 ; CHECK-SD-NEXT: mov v0.h[3], v1.h[0]
147 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0
150 ; CHECK-GI-LABEL: fptrunc_v4f64_v4f16:
151 ; CHECK-GI: // %bb.0: // %entry
152 ; CHECK-GI-NEXT: mov d2, v0.d[1]
153 ; CHECK-GI-NEXT: fcvt h0, d0
154 ; CHECK-GI-NEXT: mov d3, v1.d[1]
155 ; CHECK-GI-NEXT: fcvt h1, d1
156 ; CHECK-GI-NEXT: fcvt h2, d2
157 ; CHECK-GI-NEXT: mov v0.h[1], v2.h[0]
158 ; CHECK-GI-NEXT: fcvt h2, d3
159 ; CHECK-GI-NEXT: mov v0.h[2], v1.h[0]
160 ; CHECK-GI-NEXT: mov v0.h[3], v2.h[0]
161 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
164 %c = fptrunc <4 x double> %a to <4 x half>
168 define <2 x half> @fptrunc_v2f32_v2f16(<2 x float> %a) {
169 ; CHECK-SD-LABEL: fptrunc_v2f32_v2f16:
170 ; CHECK-SD: // %bb.0: // %entry
171 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
172 ; CHECK-SD-NEXT: fcvtn v0.4h, v0.4s
175 ; CHECK-GI-LABEL: fptrunc_v2f32_v2f16:
176 ; CHECK-GI: // %bb.0: // %entry
177 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
178 ; CHECK-GI-NEXT: mov s1, v0.s[1]
179 ; CHECK-GI-NEXT: mov v0.s[1], v1.s[0]
180 ; CHECK-GI-NEXT: mov v0.s[2], v0.s[0]
181 ; CHECK-GI-NEXT: mov v0.s[3], v0.s[0]
182 ; CHECK-GI-NEXT: fcvtn v0.4h, v0.4s
183 ; CHECK-GI-NEXT: mov h1, v0.h[1]
184 ; CHECK-GI-NEXT: mov v0.h[1], v1.h[0]
185 ; CHECK-GI-NEXT: mov v0.h[2], v0.h[0]
186 ; CHECK-GI-NEXT: mov v0.h[3], v0.h[0]
187 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
190 %c = fptrunc <2 x float> %a to <2 x half>
194 define <3 x half> @fptrunc_v3f32_v3f16(<3 x float> %a) {
195 ; CHECK-LABEL: fptrunc_v3f32_v3f16:
196 ; CHECK: // %bb.0: // %entry
197 ; CHECK-NEXT: fcvtn v0.4h, v0.4s
200 %c = fptrunc <3 x float> %a to <3 x half>
204 define <4 x half> @fptrunc_v4f32_v4f16(<4 x float> %a) {
205 ; CHECK-LABEL: fptrunc_v4f32_v4f16:
206 ; CHECK: // %bb.0: // %entry
207 ; CHECK-NEXT: fcvtn v0.4h, v0.4s
210 %c = fptrunc <4 x float> %a to <4 x half>
214 define <8 x half> @fptrunc_v8f32_v8f16(<8 x float> %a) {
215 ; CHECK-LABEL: fptrunc_v8f32_v8f16:
216 ; CHECK: // %bb.0: // %entry
217 ; CHECK-NEXT: fcvtn v0.4h, v0.4s
218 ; CHECK-NEXT: fcvtn2 v0.8h, v1.4s
221 %c = fptrunc <8 x float> %a to <8 x half>