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