1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve,+fullfp16 -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-MVE
3 ; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve.fp -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-MVEFP
5 define arm_aapcs_vfpcc <8 x half> @fneg_float16_t(<8 x half> %src) {
6 ; CHECK-MVE-LABEL: fneg_float16_t:
7 ; CHECK-MVE: @ %bb.0: @ %entry
8 ; CHECK-MVE-NEXT: vmovx.f16 s4, s0
9 ; CHECK-MVE-NEXT: vneg.f16 s8, s1
10 ; CHECK-MVE-NEXT: vneg.f16 s4, s4
11 ; CHECK-MVE-NEXT: vmov r0, s4
12 ; CHECK-MVE-NEXT: vneg.f16 s4, s0
13 ; CHECK-MVE-NEXT: vmov r1, s4
14 ; CHECK-MVE-NEXT: vmovx.f16 s0, s3
15 ; CHECK-MVE-NEXT: vmov.16 q1[0], r1
16 ; CHECK-MVE-NEXT: vneg.f16 s0, s0
17 ; CHECK-MVE-NEXT: vmov.16 q1[1], r0
18 ; CHECK-MVE-NEXT: vmov r0, s8
19 ; CHECK-MVE-NEXT: vmovx.f16 s8, s1
20 ; CHECK-MVE-NEXT: vmov.16 q1[2], r0
21 ; CHECK-MVE-NEXT: vneg.f16 s8, s8
22 ; CHECK-MVE-NEXT: vmov r0, s8
23 ; CHECK-MVE-NEXT: vneg.f16 s8, s2
24 ; CHECK-MVE-NEXT: vmov.16 q1[3], r0
25 ; CHECK-MVE-NEXT: vmov r0, s8
26 ; CHECK-MVE-NEXT: vmovx.f16 s8, s2
27 ; CHECK-MVE-NEXT: vmov.16 q1[4], r0
28 ; CHECK-MVE-NEXT: vneg.f16 s8, s8
29 ; CHECK-MVE-NEXT: vmov r0, s8
30 ; CHECK-MVE-NEXT: vneg.f16 s8, s3
31 ; CHECK-MVE-NEXT: vmov.16 q1[5], r0
32 ; CHECK-MVE-NEXT: vmov r0, s8
33 ; CHECK-MVE-NEXT: vmov.16 q1[6], r0
34 ; CHECK-MVE-NEXT: vmov r0, s0
35 ; CHECK-MVE-NEXT: vmov.16 q1[7], r0
36 ; CHECK-MVE-NEXT: vmov q0, q1
37 ; CHECK-MVE-NEXT: bx lr
39 ; CHECK-MVEFP-LABEL: fneg_float16_t:
40 ; CHECK-MVEFP: @ %bb.0: @ %entry
41 ; CHECK-MVEFP-NEXT: vneg.f16 q0, q0
42 ; CHECK-MVEFP-NEXT: bx lr
44 %0 = fsub nnan ninf nsz <8 x half> <half 0.0e0, half 0.0e0, half 0.0e0, half 0.0e0, half 0.0e0, half 0.0e0, half 0.0e0, half 0.0e0>, %src
48 define arm_aapcs_vfpcc <4 x float> @fneg_float32_t(<4 x float> %src) {
49 ; CHECK-MVE-LABEL: fneg_float32_t:
50 ; CHECK-MVE: @ %bb.0: @ %entry
51 ; CHECK-MVE-NEXT: vneg.f32 s7, s3
52 ; CHECK-MVE-NEXT: vneg.f32 s6, s2
53 ; CHECK-MVE-NEXT: vneg.f32 s5, s1
54 ; CHECK-MVE-NEXT: vneg.f32 s4, s0
55 ; CHECK-MVE-NEXT: vmov q0, q1
56 ; CHECK-MVE-NEXT: bx lr
58 ; CHECK-MVEFP-LABEL: fneg_float32_t:
59 ; CHECK-MVEFP: @ %bb.0: @ %entry
60 ; CHECK-MVEFP-NEXT: vneg.f32 q0, q0
61 ; CHECK-MVEFP-NEXT: bx lr
63 %0 = fsub nnan ninf nsz <4 x float> <float 0.0e0, float 0.0e0, float 0.0e0, float 0.0e0>, %src
67 define arm_aapcs_vfpcc <2 x double> @fneg_float64_t(<2 x double> %src) {
68 ; CHECK-LABEL: fneg_float64_t:
69 ; CHECK: @ %bb.0: @ %entry
70 ; CHECK-NEXT: .save {r4, r5, r7, lr}
71 ; CHECK-NEXT: push {r4, r5, r7, lr}
72 ; CHECK-NEXT: .vsave {d8, d9}
73 ; CHECK-NEXT: vpush {d8, d9}
74 ; CHECK-NEXT: vmov q4, q0
75 ; CHECK-NEXT: vldr d0, .LCPI2_0
76 ; CHECK-NEXT: vmov r2, r3, d9
77 ; CHECK-NEXT: vmov r4, r5, d0
78 ; CHECK-NEXT: mov r0, r4
79 ; CHECK-NEXT: mov r1, r5
80 ; CHECK-NEXT: bl __aeabi_dsub
81 ; CHECK-NEXT: vmov r2, r3, d8
82 ; CHECK-NEXT: vmov d9, r0, r1
83 ; CHECK-NEXT: mov r0, r4
84 ; CHECK-NEXT: mov r1, r5
85 ; CHECK-NEXT: bl __aeabi_dsub
86 ; CHECK-NEXT: vmov d8, r0, r1
87 ; CHECK-NEXT: vmov q0, q4
88 ; CHECK-NEXT: vpop {d8, d9}
89 ; CHECK-NEXT: pop {r4, r5, r7, pc}
90 ; CHECK-NEXT: .p2align 3
91 ; CHECK-NEXT: @ %bb.1:
92 ; CHECK-NEXT: .LCPI2_0:
93 ; CHECK-NEXT: .long 0 @ double -0
94 ; CHECK-NEXT: .long 2147483648
96 %0 = fsub nnan ninf nsz <2 x double> <double 0.0e0, double 0.0e0>, %src
100 define arm_aapcs_vfpcc <8 x half> @fabs_float16_t(<8 x half> %src) {
101 ; CHECK-MVE-LABEL: fabs_float16_t:
102 ; CHECK-MVE: @ %bb.0: @ %entry
103 ; CHECK-MVE-NEXT: vmovx.f16 s4, s0
104 ; CHECK-MVE-NEXT: vabs.f16 s8, s1
105 ; CHECK-MVE-NEXT: vabs.f16 s4, s4
106 ; CHECK-MVE-NEXT: vmov r0, s4
107 ; CHECK-MVE-NEXT: vabs.f16 s4, s0
108 ; CHECK-MVE-NEXT: vmov r1, s4
109 ; CHECK-MVE-NEXT: vmovx.f16 s0, s3
110 ; CHECK-MVE-NEXT: vmov.16 q1[0], r1
111 ; CHECK-MVE-NEXT: vabs.f16 s0, s0
112 ; CHECK-MVE-NEXT: vmov.16 q1[1], r0
113 ; CHECK-MVE-NEXT: vmov r0, s8
114 ; CHECK-MVE-NEXT: vmovx.f16 s8, s1
115 ; CHECK-MVE-NEXT: vmov.16 q1[2], r0
116 ; CHECK-MVE-NEXT: vabs.f16 s8, s8
117 ; CHECK-MVE-NEXT: vmov r0, s8
118 ; CHECK-MVE-NEXT: vabs.f16 s8, s2
119 ; CHECK-MVE-NEXT: vmov.16 q1[3], r0
120 ; CHECK-MVE-NEXT: vmov r0, s8
121 ; CHECK-MVE-NEXT: vmovx.f16 s8, s2
122 ; CHECK-MVE-NEXT: vmov.16 q1[4], r0
123 ; CHECK-MVE-NEXT: vabs.f16 s8, s8
124 ; CHECK-MVE-NEXT: vmov r0, s8
125 ; CHECK-MVE-NEXT: vabs.f16 s8, s3
126 ; CHECK-MVE-NEXT: vmov.16 q1[5], r0
127 ; CHECK-MVE-NEXT: vmov r0, s8
128 ; CHECK-MVE-NEXT: vmov.16 q1[6], r0
129 ; CHECK-MVE-NEXT: vmov r0, s0
130 ; CHECK-MVE-NEXT: vmov.16 q1[7], r0
131 ; CHECK-MVE-NEXT: vmov q0, q1
132 ; CHECK-MVE-NEXT: bx lr
134 ; CHECK-MVEFP-LABEL: fabs_float16_t:
135 ; CHECK-MVEFP: @ %bb.0: @ %entry
136 ; CHECK-MVEFP-NEXT: vabs.f16 q0, q0
137 ; CHECK-MVEFP-NEXT: bx lr
139 %0 = call nnan ninf nsz <8 x half> @llvm.fabs.v8f16(<8 x half> %src)
143 define arm_aapcs_vfpcc <4 x float> @fabs_float32_t(<4 x float> %src) {
144 ; CHECK-MVE-LABEL: fabs_float32_t:
145 ; CHECK-MVE: @ %bb.0: @ %entry
146 ; CHECK-MVE-NEXT: vabs.f32 s7, s3
147 ; CHECK-MVE-NEXT: vabs.f32 s6, s2
148 ; CHECK-MVE-NEXT: vabs.f32 s5, s1
149 ; CHECK-MVE-NEXT: vabs.f32 s4, s0
150 ; CHECK-MVE-NEXT: vmov q0, q1
151 ; CHECK-MVE-NEXT: bx lr
153 ; CHECK-MVEFP-LABEL: fabs_float32_t:
154 ; CHECK-MVEFP: @ %bb.0: @ %entry
155 ; CHECK-MVEFP-NEXT: vabs.f32 q0, q0
156 ; CHECK-MVEFP-NEXT: bx lr
158 %0 = call nnan ninf nsz <4 x float> @llvm.fabs.v4f32(<4 x float> %src)
162 define arm_aapcs_vfpcc <2 x double> @fabs_float64_t(<2 x double> %src) {
163 ; CHECK-LABEL: fabs_float64_t:
164 ; CHECK: @ %bb.0: @ %entry
165 ; CHECK-NEXT: vldr d2, .LCPI5_0
166 ; CHECK-NEXT: vmov r12, r3, d0
167 ; CHECK-NEXT: vmov r0, r1, d2
168 ; CHECK-NEXT: vmov r0, r2, d1
169 ; CHECK-NEXT: lsrs r1, r1, #31
170 ; CHECK-NEXT: bfi r2, r1, #31, #1
171 ; CHECK-NEXT: bfi r3, r1, #31, #1
172 ; CHECK-NEXT: vmov d1, r0, r2
173 ; CHECK-NEXT: vmov d0, r12, r3
175 ; CHECK-NEXT: .p2align 3
176 ; CHECK-NEXT: @ %bb.1:
177 ; CHECK-NEXT: .LCPI5_0:
178 ; CHECK-NEXT: .long 0 @ double 0
179 ; CHECK-NEXT: .long 0
181 %0 = call nnan ninf nsz <2 x double> @llvm.fabs.v2f64(<2 x double> %src)
185 declare <4 x float> @llvm.fabs.v4f32(<4 x float>)
186 declare <8 x half> @llvm.fabs.v8f16(<8 x half>)
187 declare <2 x double> @llvm.fabs.v2f64(<2 x double>)