1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=armv8a -mattr=+armv8.2-a,+fullfp16,+neon -target-abi=aapcs-gnu -float-abi=soft -o - %s | FileCheck %s --check-prefix=SOFT
; RUN: llc -mtriple=armv8a -mattr=+armv8.2-a,+fullfp16,+neon -target-abi=aapcs-gnu -float-abi=hard -o - %s | FileCheck %s --check-prefix=HARD
; RUN: llc -mtriple=armeb-eabi -mattr=+armv8.2-a,+fullfp16,+neon -target-abi=aapcs-gnu -float-abi=soft -o - %s | FileCheck %s --check-prefix=SOFTEB
; RUN: llc -mtriple=armeb-eabi -mattr=+armv8.2-a,+fullfp16,+neon -target-abi=aapcs-gnu -float-abi=hard -o - %s | FileCheck %s --check-prefix=HARDEB
declare <4 x half> @llvm.fabs.v4f16(<4 x half>)
declare <8 x half> @llvm.fabs.v8f16(<8 x half>)
declare void @use(double, float, <4 x half>, i16, <8 x half>)
define <4 x half> @test_vabs_f16(<4 x half> %a) {
; SOFT-LABEL: test_vabs_f16:
; SOFT: @ %bb.0: @ %entry
; SOFT-NEXT: vmov d16, r0, r1
; SOFT-NEXT: vabs.f16 d16, d16
; SOFT-NEXT: vmov r0, r1, d16
; SOFT-NEXT: bx lr
;
; HARD-LABEL: test_vabs_f16:
; HARD: @ %bb.0: @ %entry
; HARD-NEXT: vabs.f16 d0, d0
; HARD-NEXT: bx lr
;
; SOFTEB-LABEL: test_vabs_f16:
; SOFTEB: @ %bb.0: @ %entry
; SOFTEB-NEXT: vmov d16, r1, r0
; SOFTEB-NEXT: vrev64.16 d16, d16
; SOFTEB-NEXT: vabs.f16 d16, d16
; SOFTEB-NEXT: vrev64.16 d16, d16
; SOFTEB-NEXT: vmov r1, r0, d16
; SOFTEB-NEXT: bx lr
;
; HARDEB-LABEL: test_vabs_f16:
; HARDEB: @ %bb.0: @ %entry
; HARDEB-NEXT: vrev64.16 d16, d0
; HARDEB-NEXT: vabs.f16 d16, d16
; HARDEB-NEXT: vrev64.16 d0, d16
; HARDEB-NEXT: bx lr
entry:
%vabs1.i = tail call <4 x half> @llvm.fabs.v4f16(<4 x half> %a)
ret <4 x half> %vabs1.i
}
define <8 x half> @test2_vabs_f16(<8 x half> %a) {
; SOFT-LABEL: test2_vabs_f16:
; SOFT: @ %bb.0: @ %entry
; SOFT-NEXT: vmov d17, r2, r3
; SOFT-NEXT: vmov d16, r0, r1
; SOFT-NEXT: vabs.f16 q8, q8
; SOFT-NEXT: vmov r0, r1, d16
; SOFT-NEXT: vmov r2, r3, d17
; SOFT-NEXT: bx lr
;
; HARD-LABEL: test2_vabs_f16:
; HARD: @ %bb.0: @ %entry
; HARD-NEXT: vabs.f16 q0, q0
; HARD-NEXT: bx lr
;
; SOFTEB-LABEL: test2_vabs_f16:
; SOFTEB: @ %bb.0: @ %entry
; SOFTEB-NEXT: vmov d17, r3, r2
; SOFTEB-NEXT: vmov d16, r1, r0
; SOFTEB-NEXT: vrev64.16 q8, q8
; SOFTEB-NEXT: vabs.f16 q8, q8
; SOFTEB-NEXT: vrev64.16 q8, q8
; SOFTEB-NEXT: vmov r1, r0, d16
; SOFTEB-NEXT: vmov r3, r2, d17
; SOFTEB-NEXT: bx lr
;
; HARDEB-LABEL: test2_vabs_f16:
; HARDEB: @ %bb.0: @ %entry
; HARDEB-NEXT: vrev64.16 q8, q0
; HARDEB-NEXT: vabs.f16 q8, q8
; HARDEB-NEXT: vrev64.16 q0, q8
; HARDEB-NEXT: bx lr
entry:
%vabs1.i = tail call <8 x half> @llvm.fabs.v8f16(<8 x half> %a)
ret <8 x half> %vabs1.i
}
define void @test(double, float, i16, <4 x half>, <8 x half>) {
; SOFT-LABEL: test:
; SOFT: @ %bb.0: @ %entry
; SOFT-NEXT: push {r11, lr}
; SOFT-NEXT: sub sp, sp, #32
; SOFT-NEXT: vldr d16, [sp, #40]
; SOFT-NEXT: mov r12, #16
; SOFT-NEXT: vabs.f16 d16, d16
; SOFT-NEXT: mov lr, sp
; SOFT-NEXT: vst1.16 {d16}, [lr:64], r12
; SOFT-NEXT: add r12, sp, #48
; SOFT-NEXT: vld1.64 {d16, d17}, [r12]
; SOFT-NEXT: vabs.f16 q8, q8
; SOFT-NEXT: str r3, [sp, #8]
; SOFT-NEXT: vst1.64 {d16, d17}, [lr]
; SOFT-NEXT: bl use
; SOFT-NEXT: add sp, sp, #32
; SOFT-NEXT: pop {r11, pc}
;
; HARD-LABEL: test:
; HARD: @ %bb.0: @ %entry
; HARD-NEXT: vabs.f16 q2, q2
; HARD-NEXT: vabs.f16 d2, d2
; HARD-NEXT: b use
;
; SOFTEB-LABEL: test:
; SOFTEB: @ %bb.0: @ %entry
; SOFTEB-NEXT: .save {r11, lr}
; SOFTEB-NEXT: push {r11, lr}
; SOFTEB-NEXT: .pad #32
; SOFTEB-NEXT: sub sp, sp, #32
; SOFTEB-NEXT: vldr d16, [sp, #40]
; SOFTEB-NEXT: mov r12, #16
; SOFTEB-NEXT: mov lr, sp
; SOFTEB-NEXT: str r3, [sp, #8]
; SOFTEB-NEXT: vrev64.16 d16, d16
; SOFTEB-NEXT: vabs.f16 d16, d16
; SOFTEB-NEXT: vst1.16 {d16}, [lr:64], r12
; SOFTEB-NEXT: add r12, sp, #48
; SOFTEB-NEXT: vld1.64 {d16, d17}, [r12]
; SOFTEB-NEXT: vrev64.16 q8, q8
; SOFTEB-NEXT: vabs.f16 q8, q8
; SOFTEB-NEXT: vrev64.16 q8, q8
; SOFTEB-NEXT: vst1.64 {d16, d17}, [lr]
; SOFTEB-NEXT: bl use
; SOFTEB-NEXT: add sp, sp, #32
; SOFTEB-NEXT: pop {r11, pc}
;
; HARDEB-LABEL: test:
; HARDEB: @ %bb.0: @ %entry
; HARDEB-NEXT: vrev64.16 d16, d2
; HARDEB-NEXT: vabs.f16 d16, d16
; HARDEB-NEXT: vrev64.16 d2, d16
; HARDEB-NEXT: vrev64.16 q8, q2
; HARDEB-NEXT: vabs.f16 q8, q8
; HARDEB-NEXT: vrev64.16 q2, q8
; HARDEB-NEXT: b use
entry:
%5 = tail call <4 x half> @llvm.fabs.v4f16(<4 x half> %3)
%6 = tail call <8 x half> @llvm.fabs.v8f16(<8 x half> %4)
tail call void @use(double %0, float %1, <4 x half> %5, i16 %2, <8 x half> %6)
ret void
}
define void @many_args_test(double, float, i16, <4 x half>, <8 x half>, <8 x half>, <8 x half>) {
; SOFT-LABEL: many_args_test:
; SOFT: @ %bb.0: @ %entry
; SOFT-NEXT: push {r11, lr}
; SOFT-NEXT: sub sp, sp, #32
; SOFT-NEXT: add r12, sp, #80
; SOFT-NEXT: mov lr, sp
; SOFT-NEXT: vld1.64 {d16, d17}, [r12]
; SOFT-NEXT: add r12, sp, #48
; SOFT-NEXT: vabs.f16 q8, q8
; SOFT-NEXT: vld1.64 {d18, d19}, [r12]
; SOFT-NEXT: add r12, sp, #64
; SOFT-NEXT: str r3, [sp, #8]
; SOFT-NEXT: vadd.f16 q8, q8, q9
; SOFT-NEXT: vld1.64 {d18, d19}, [r12]
; SOFT-NEXT: mov r12, #16
; SOFT-NEXT: vmul.f16 q8, q9, q8
; SOFT-NEXT: vldr d18, [sp, #40]
; SOFT-NEXT: vst1.16 {d18}, [lr:64], r12
; SOFT-NEXT: vst1.64 {d16, d17}, [lr]
; SOFT-NEXT: bl use
; SOFT-NEXT: add sp, sp, #32
; SOFT-NEXT: pop {r11, pc}
;
; HARD-LABEL: many_args_test:
; HARD: @ %bb.0: @ %entry
; HARD-NEXT: mov r1, sp
; HARD-NEXT: vld1.64 {d16, d17}, [r1]
; HARD-NEXT: vabs.f16 q8, q8
; HARD-NEXT: vadd.f16 q8, q8, q2
; HARD-NEXT: vmul.f16 q2, q3, q8
; HARD-NEXT: b use
;
; SOFTEB-LABEL: many_args_test:
; SOFTEB: @ %bb.0: @ %entry
; SOFTEB-NEXT: .save {r11, lr}
; SOFTEB-NEXT: push {r11, lr}
; SOFTEB-NEXT: .pad #32
; SOFTEB-NEXT: sub sp, sp, #32
; SOFTEB-NEXT: vldr d16, [sp, #40]
; SOFTEB-NEXT: mov r12, #16
; SOFTEB-NEXT: mov lr, sp
; SOFTEB-NEXT: str r3, [sp, #8]
; SOFTEB-NEXT: vrev64.16 d16, d16
; SOFTEB-NEXT: vst1.16 {d16}, [lr:64], r12
; SOFTEB-NEXT: add r12, sp, #80
; SOFTEB-NEXT: vld1.64 {d16, d17}, [r12]
; SOFTEB-NEXT: add r12, sp, #48
; SOFTEB-NEXT: vrev64.16 q8, q8
; SOFTEB-NEXT: vabs.f16 q8, q8
; SOFTEB-NEXT: vld1.64 {d18, d19}, [r12]
; SOFTEB-NEXT: add r12, sp, #64
; SOFTEB-NEXT: vrev64.16 q9, q9
; SOFTEB-NEXT: vadd.f16 q8, q8, q9
; SOFTEB-NEXT: vld1.64 {d18, d19}, [r12]
; SOFTEB-NEXT: vrev64.16 q9, q9
; SOFTEB-NEXT: vmul.f16 q8, q9, q8
; SOFTEB-NEXT: vrev64.16 q8, q8
; SOFTEB-NEXT: vst1.64 {d16, d17}, [lr]
; SOFTEB-NEXT: bl use
; SOFTEB-NEXT: add sp, sp, #32
; SOFTEB-NEXT: pop {r11, pc}
;
; HARDEB-LABEL: many_args_test:
; HARDEB: @ %bb.0: @ %entry
; HARDEB-NEXT: mov r1, sp
; HARDEB-NEXT: vld1.64 {d16, d17}, [r1]
; HARDEB-NEXT: vrev64.16 q8, q8
; HARDEB-NEXT: vabs.f16 q8, q8
; HARDEB-NEXT: vrev64.16 q9, q2
; HARDEB-NEXT: vadd.f16 q8, q8, q9
; HARDEB-NEXT: vrev64.16 q9, q3
; HARDEB-NEXT: vmul.f16 q8, q9, q8
; HARDEB-NEXT: vrev64.16 q2, q8
; HARDEB-NEXT: b use
entry:
%7 = tail call <8 x half> @llvm.fabs.v8f16(<8 x half> %6)
%8 = fadd <8 x half> %7, %4
%9 = fmul <8 x half> %5, %8
tail call void @use(double %0, float %1, <4 x half> %3, i16 %2, <8 x half> %9)
ret void
}
|