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: add r12, sp, #48
87 ; SOFT-NEXT: vld1.64 {d16, d17}, [r12]
88 ; SOFT-NEXT: add r12, sp, #16
89 ; SOFT-NEXT: vabs.f16 q8, q8
90 ; SOFT-NEXT: vst1.64 {d16, d17}, [r12]
91 ; SOFT-NEXT: mov r12, sp
92 ; SOFT-NEXT: vldr d16, [sp, #40]
93 ; SOFT-NEXT: vabs.f16 d16, d16
94 ; SOFT-NEXT: vst1.16 {d16}, [r12:64]!
95 ; SOFT-NEXT: str r3, [r12]
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 {r4, lr}
109 ; SOFTEB-NEXT: push {r4, lr}
110 ; SOFTEB-NEXT: .pad #32
111 ; SOFTEB-NEXT: sub sp, sp, #32
112 ; SOFTEB-NEXT: vldr d16, [sp, #40]
113 ; SOFTEB-NEXT: mov lr, sp
114 ; SOFTEB-NEXT: add r4, sp, #48
115 ; SOFTEB-NEXT: add r12, sp, #16
116 ; SOFTEB-NEXT: vrev64.16 d16, d16
117 ; SOFTEB-NEXT: vabs.f16 d16, d16
118 ; SOFTEB-NEXT: vst1.16 {d16}, [lr:64]!
119 ; SOFTEB-NEXT: vld1.64 {d16, d17}, [r4]
120 ; SOFTEB-NEXT: vrev64.16 q8, q8
121 ; SOFTEB-NEXT: str r3, [lr]
122 ; SOFTEB-NEXT: vabs.f16 q8, q8
123 ; SOFTEB-NEXT: vrev64.16 q8, q8
124 ; SOFTEB-NEXT: vst1.64 {d16, d17}, [r12]
125 ; SOFTEB-NEXT: bl use
126 ; SOFTEB-NEXT: add sp, sp, #32
127 ; SOFTEB-NEXT: pop {r4, 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: add r12, sp, #40
149 ; SOFT-NEXT: vld1.64 {d16, d17}, [r12]
150 ; SOFT-NEXT: add r12, sp, #8
151 ; SOFT-NEXT: vabs.f16 q8, q8
152 ; SOFT-NEXT: vld1.64 {d18, d19}, [r12]
153 ; SOFT-NEXT: add r12, sp, #24
154 ; SOFT-NEXT: vadd.f16 q8, q8, q9
155 ; SOFT-NEXT: vld1.64 {d18, d19}, [r12]
156 ; SOFT-NEXT: add r12, sp, #16
157 ; SOFT-NEXT: vmul.f16 q8, q9, q8
158 ; SOFT-NEXT: vst1.64 {d16, d17}, [r12]
159 ; SOFT-NEXT: vldr d16, [sp]
160 ; SOFT-NEXT: vstr d16, [sp]
161 ; SOFT-NEXT: str r3, [sp, #8]
164 ; HARD-LABEL: many_args_test:
165 ; HARD: @ %bb.0: @ %entry
166 ; HARD-NEXT: mov r1, sp
167 ; HARD-NEXT: vld1.64 {d16, d17}, [r1]
168 ; HARD-NEXT: vabs.f16 q8, q8
169 ; HARD-NEXT: vadd.f16 q8, q8, q2
170 ; HARD-NEXT: vmul.f16 q2, q3, q8
173 ; SOFTEB-LABEL: many_args_test:
174 ; SOFTEB: @ %bb.0: @ %entry
175 ; SOFTEB-NEXT: add r12, sp, #40
176 ; SOFTEB-NEXT: vld1.64 {d16, d17}, [r12]
177 ; SOFTEB-NEXT: add r12, sp, #8
178 ; SOFTEB-NEXT: vrev64.16 q8, q8
179 ; SOFTEB-NEXT: vabs.f16 q8, q8
180 ; SOFTEB-NEXT: vld1.64 {d18, d19}, [r12]
181 ; SOFTEB-NEXT: add r12, sp, #24
182 ; SOFTEB-NEXT: vrev64.16 q9, q9
183 ; SOFTEB-NEXT: vadd.f16 q8, q8, q9
184 ; SOFTEB-NEXT: vld1.64 {d18, d19}, [r12]
185 ; SOFTEB-NEXT: add r12, sp, #16
186 ; SOFTEB-NEXT: vrev64.16 q9, q9
187 ; SOFTEB-NEXT: vmul.f16 q8, q9, q8
188 ; SOFTEB-NEXT: vldr d18, [sp]
189 ; SOFTEB-NEXT: vrev64.16 q8, q8
190 ; SOFTEB-NEXT: vst1.64 {d16, d17}, [r12]
191 ; SOFTEB-NEXT: vstr d18, [sp]
192 ; SOFTEB-NEXT: str r3, [sp, #8]
195 ; HARDEB-LABEL: many_args_test:
196 ; HARDEB: @ %bb.0: @ %entry
197 ; HARDEB-NEXT: mov r1, sp
198 ; HARDEB-NEXT: vld1.64 {d16, d17}, [r1]
199 ; HARDEB-NEXT: vrev64.16 q8, q8
200 ; HARDEB-NEXT: vabs.f16 q8, q8
201 ; HARDEB-NEXT: vrev64.16 q9, q2
202 ; HARDEB-NEXT: vadd.f16 q8, q8, q9
203 ; HARDEB-NEXT: vrev64.16 q9, q3
204 ; HARDEB-NEXT: vmul.f16 q8, q9, q8
205 ; HARDEB-NEXT: vrev64.16 q2, q8
208 %7 = tail call <8 x half> @llvm.fabs.v8f16(<8 x half> %6)
209 %8 = fadd <8 x half> %7, %4
210 %9 = fmul <8 x half> %5, %8
211 tail call void @use(double %0, float %1, <4 x half> %3, i16 %2, <8 x half> %9)