1# RUN: llc -verify-machineinstrs -mtriple aarch64--- \
2# RUN: -run-pass=legalizer -mattr=+fullfp16 -global-isel %s -o - \
3# RUN: | FileCheck %s
4...
5---
6name:            test_v4f16.exp
7alignment:       4
8tracksRegLiveness: true
9registers:
10  - { id: 0, class: _ }
11  - { id: 1, class: _ }
12body:             |
13  bb.0:
14    liveins: $d0
15    ; CHECK-LABEL: name:            test_v4f16.exp
16    ; CHECK: [[V1:%[0-9]+]]:_(s16), [[V2:%[0-9]+]]:_(s16), [[V3:%[0-9]+]]:_(s16), [[V4:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES %{{[0-9]+}}(<4 x s16>)
17
18    ; CHECK-DAG: [[V1_S32:%[0-9]+]]:_(s32) = G_FPEXT [[V1]](s16)
19    ; CHECK-NEXT: ADJCALLSTACKDOWN
20    ; CHECK-NEXT: $s0 = COPY [[V1_S32]](s32)
21    ; CHECK-NEXT: BL &expf
22    ; CHECK-NEXT: [[ELT1_S32:%[0-9]+]]:_(s32) = COPY $s0
23    ; CHECK-NEXT: ADJCALLSTACKUP
24    ; CHECK-NEXT: [[ELT1:%[0-9]+]]:_(s16) = G_FPTRUNC [[ELT1_S32]](s32)
25
26    ; CHECK-DAG: [[V2_S32:%[0-9]+]]:_(s32) = G_FPEXT [[V2]](s16)
27    ; CHECK-NEXT: ADJCALLSTACKDOWN
28    ; CHECK-NEXT: $s0 = COPY [[V2_S32]](s32)
29    ; CHECK-NEXT: BL &expf
30    ; CHECK-NEXT: [[ELT2_S32:%[0-9]+]]:_(s32) = COPY $s0
31    ; CHECK-NEXT: ADJCALLSTACKUP
32    ; CHECK-NEXT: [[ELT2:%[0-9]+]]:_(s16) = G_FPTRUNC [[ELT2_S32]](s32)
33
34    ; CHECK-DAG: [[V3_S32:%[0-9]+]]:_(s32) = G_FPEXT [[V3]](s16)
35    ; CHECK-NEXT: ADJCALLSTACKDOWN
36    ; CHECK-NEXT: $s0 = COPY [[V3_S32]](s32)
37    ; CHECK-NEXT: BL &expf
38    ; CHECK-NEXT: [[ELT3_S32:%[0-9]+]]:_(s32) = COPY $s0
39    ; CHECK-NEXT: ADJCALLSTACKUP
40    ; CHECK-NEXT: [[ELT3:%[0-9]+]]:_(s16) = G_FPTRUNC [[ELT3_S32]](s32)
41
42    ; CHECK-DAG: [[V4_S32:%[0-9]+]]:_(s32) = G_FPEXT [[V4]](s16)
43    ; CHECK-NEXT: ADJCALLSTACKDOWN
44    ; CHECK-NEXT: $s0 = COPY [[V4_S32]](s32)
45    ; CHECK-NEXT: BL &expf
46    ; CHECK-NEXT: [[ELT4_S32:%[0-9]+]]:_(s32) = COPY $s0
47    ; CHECK-NEXT: ADJCALLSTACKUP
48    ; CHECK-NEXT: [[ELT4:%[0-9]+]]:_(s16) = G_FPTRUNC [[ELT4_S32]](s32)
49
50    ; CHECK-DAG: %{{[0-9]+}}:_(<4 x s16>) = G_BUILD_VECTOR [[ELT1]](s16), [[ELT2]](s16), [[ELT3]](s16), [[ELT4]](s16)
51
52    %0:_(<4 x s16>) = COPY $d0
53    %1:_(<4 x s16>) = G_FEXP %0
54    $d0 = COPY %1(<4 x s16>)
55    RET_ReallyLR implicit $d0
56
57...
58---
59name:            test_v8f16.exp
60alignment:       4
61tracksRegLiveness: true
62registers:
63  - { id: 0, class: _ }
64  - { id: 1, class: _ }
65body:             |
66  bb.0:
67    liveins: $q0
68
69    ; CHECK-LABEL: name:            test_v8f16.exp
70
71    ; This is big, so let's just check for the 8 calls to expf, the the
72    ; G_UNMERGE_VALUES, and the G_BUILD_VECTOR. The other instructions ought
73    ; to be covered by the other tests.
74
75    ; CHECK: G_UNMERGE_VALUES
76    ; CHECK: BL &expf
77    ; CHECK: BL &expf
78    ; CHECK: BL &expf
79    ; CHECK: BL &expf
80    ; CHECK: BL &expf
81    ; CHECK: BL &expf
82    ; CHECK: BL &expf
83    ; CHECK: BL &expf
84    ; CHECK-DAG: G_BUILD_VECTOR
85
86    %0:_(<8 x s16>) = COPY $q0
87    %1:_(<8 x s16>) = G_FEXP %0
88    $q0 = COPY %1(<8 x s16>)
89    RET_ReallyLR implicit $q0
90
91...
92---
93name:            test_v2f32.exp
94alignment:       4
95tracksRegLiveness: true
96registers:
97  - { id: 0, class: _ }
98  - { id: 1, class: _ }
99body:             |
100  bb.0:
101    liveins: $d0
102
103    ; CHECK-LABEL: name:            test_v2f32.exp
104    ; CHECK: [[V1:%[0-9]+]]:_(s32), [[V2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES %{{[0-9]+}}(<2 x s32>)
105
106    ; CHECK-NEXT: ADJCALLSTACKDOWN
107    ; CHECK-DAG: $s0 = COPY [[V1]](s32)
108    ; CHECK-DAG: BL &expf
109    ; CHECK-DAG: [[ELT1:%[0-9]+]]:_(s32) = COPY $s0
110    ; CHECK-DAG: ADJCALLSTACKUP
111
112    ; CHECK-DAG: ADJCALLSTACKDOWN
113    ; CHECK-DAG: $s0 = COPY [[V2]](s32)
114    ; CHECK-DAG: BL &expf
115    ; CHECK-DAG: [[ELT2:%[0-9]+]]:_(s32) = COPY $s0
116    ; CHECK-DAG: ADJCALLSTACKUP
117
118    ; CHECK-DAG: %1:_(<2 x s32>) = G_BUILD_VECTOR [[ELT1]](s32), [[ELT2]](s32)
119
120    %0:_(<2 x s32>) = COPY $d0
121    %1:_(<2 x s32>) = G_FEXP %0
122    $d0 = COPY %1(<2 x s32>)
123    RET_ReallyLR implicit $d0
124
125...
126---
127name:            test_v4f32.exp
128alignment:       4
129tracksRegLiveness: true
130registers:
131  - { id: 0, class: _ }
132  - { id: 1, class: _ }
133body:             |
134  bb.0:
135    liveins: $q0
136    ; CHECK-LABEL: name:            test_v4f32.exp
137    ; CHECK: [[V1:%[0-9]+]]:_(s32), [[V2:%[0-9]+]]:_(s32), [[V3:%[0-9]+]]:_(s32), [[V4:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES %{{[0-9]+}}(<4 x s32>)
138
139    ; CHECK-NEXT: ADJCALLSTACKDOWN
140    ; CHECK-DAG: $s0 = COPY [[V1]](s32)
141    ; CHECK-DAG: BL &expf
142    ; CHECK-DAG: [[ELT1:%[0-9]+]]:_(s32) = COPY $s0
143    ; CHECK-DAG: ADJCALLSTACKUP
144
145    ; CHECK-DAG: ADJCALLSTACKDOWN
146    ; CHECK-DAG: $s0 = COPY [[V2]](s32)
147    ; CHECK-DAG: BL &expf
148    ; CHECK-DAG: [[ELT2:%[0-9]+]]:_(s32) = COPY $s0
149    ; CHECK-DAG: ADJCALLSTACKUP
150
151    ; CHECK-DAG: ADJCALLSTACKDOWN
152    ; CHECK-DAG: $s0 = COPY [[V3]](s32)
153    ; CHECK-DAG: BL &expf
154    ; CHECK-DAG: [[ELT3:%[0-9]+]]:_(s32) = COPY $s0
155    ; CHECK-DAG: ADJCALLSTACKUP
156
157    ; CHECK-DAG: ADJCALLSTACKDOWN
158    ; CHECK-DAG: $s0 = COPY [[V4]](s32)
159    ; CHECK-DAG: BL &expf
160    ; CHECK-DAG: [[ELT4:%[0-9]+]]:_(s32) = COPY $s0
161    ; CHECK-DAG: ADJCALLSTACKUP
162
163    ; CHECK-DAG: %1:_(<4 x s32>) = G_BUILD_VECTOR [[ELT1]](s32), [[ELT2]](s32), [[ELT3]](s32), [[ELT4]](s32)
164
165    %0:_(<4 x s32>) = COPY $q0
166    %1:_(<4 x s32>) = G_FEXP %0
167    $q0 = COPY %1(<4 x s32>)
168    RET_ReallyLR implicit $q0
169
170...
171---
172name:            test_v2f64.exp
173alignment:       4
174tracksRegLiveness: true
175registers:
176  - { id: 0, class: _ }
177  - { id: 1, class: _ }
178body:             |
179  bb.0:
180    liveins: $q0
181
182    ; CHECK-LABEL: name:            test_v2f64.exp
183    ; CHECK: [[V1:%[0-9]+]]:_(s64), [[V2:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES %{{[0-9]+}}(<2 x s64>)
184
185    ; CHECK-NEXT: ADJCALLSTACKDOWN
186    ; CHECK-DAG: $d0 = COPY [[V1]](s64)
187    ; CHECK-DAG: BL &exp
188    ; CHECK-DAG: [[ELT1:%[0-9]+]]:_(s64) = COPY $d0
189    ; CHECK-DAG: ADJCALLSTACKUP
190
191    ; CHECK-DAG: ADJCALLSTACKDOWN
192    ; CHECK-DAG: $d0 = COPY [[V2]](s64)
193    ; CHECK-DAG: BL &exp
194    ; CHECK-DAG: [[ELT2:%[0-9]+]]:_(s64) = COPY $d0
195    ; CHECK-DAG: ADJCALLSTACKUP
196
197    ; CHECK-DAG: %1:_(<2 x s64>) = G_BUILD_VECTOR [[ELT1]](s64), [[ELT2]](s64)
198
199    %0:_(<2 x s64>) = COPY $q0
200    %1:_(<2 x s64>) = G_FEXP %0
201    $q0 = COPY %1(<2 x s64>)
202    RET_ReallyLR implicit $q0
203
204...
205---
206name:            test_exp_half
207alignment:       4
208tracksRegLiveness: true
209registers:
210  - { id: 0, class: _ }
211  - { id: 1, class: _ }
212body:             |
213  bb.0:
214    liveins: $h0
215    ; CHECK-LABEL: name:            test_exp_half
216    ; CHECK: [[REG1:%[0-9]+]]:_(s32) = G_FPEXT %0(s16)
217    ; CHECK-NEXT: ADJCALLSTACKDOWN
218    ; CHECK-NEXT: $s0 = COPY [[REG1]](s32)
219    ; CHECK-NEXT: BL &expf
220    ; CHECK-NEXT: [[REG2:%[0-9]+]]:_(s32) = COPY $s0
221    ; CHECK-NEXT: ADJCALLSTACKUP
222    ; CHECK-NEXT: [[RES:%[0-9]+]]:_(s16) = G_FPTRUNC [[REG2]](s32)
223
224    %0:_(s16) = COPY $h0
225    %1:_(s16) = G_FEXP %0
226    $h0 = COPY %1(s16)
227    RET_ReallyLR implicit $h0
228