1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
6 define <vscale x 8 x half> @fdiv_8f16(<vscale x 8 x half> %a, <vscale x 8 x half> %b) {
7 ; CHECK-LABEL: fdiv_8f16:
9 ; CHECK-NEXT: ptrue p0.h
10 ; CHECK-NEXT: fdiv z0.h, p0/m, z0.h, z1.h
12 %fdiv = fdiv fast <vscale x 8 x half> %a, %b
13 ret <vscale x 8 x half> %fdiv
16 define <vscale x 8 x half> @fdiv_recip_8f16(<vscale x 8 x half> %a, <vscale x 8 x half> %b) #0 {
17 ; CHECK-LABEL: fdiv_recip_8f16:
19 ; CHECK-NEXT: frecpe z2.h, z1.h
20 ; CHECK-NEXT: frecps z1.h, z1.h, z2.h
21 ; CHECK-NEXT: fmul z1.h, z2.h, z1.h
22 ; CHECK-NEXT: fmul z0.h, z1.h, z0.h
24 %fdiv = fdiv fast <vscale x 8 x half> %a, %b
25 ret <vscale x 8 x half> %fdiv
28 define <vscale x 4 x float> @fdiv_4f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
29 ; CHECK-LABEL: fdiv_4f32:
31 ; CHECK-NEXT: ptrue p0.s
32 ; CHECK-NEXT: fdiv z0.s, p0/m, z0.s, z1.s
34 %fdiv = fdiv fast <vscale x 4 x float> %a, %b
35 ret <vscale x 4 x float> %fdiv
38 define <vscale x 4 x float> @fdiv_recip_4f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b) #0 {
39 ; CHECK-LABEL: fdiv_recip_4f32:
41 ; CHECK-NEXT: frecpe z2.s, z1.s
42 ; CHECK-NEXT: frecps z3.s, z1.s, z2.s
43 ; CHECK-NEXT: fmul z2.s, z2.s, z3.s
44 ; CHECK-NEXT: frecps z1.s, z1.s, z2.s
45 ; CHECK-NEXT: fmul z1.s, z2.s, z1.s
46 ; CHECK-NEXT: fmul z0.s, z1.s, z0.s
48 %fdiv = fdiv fast <vscale x 4 x float> %a, %b
49 ret <vscale x 4 x float> %fdiv
52 define <vscale x 2 x double> @fdiv_2f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b) {
53 ; CHECK-LABEL: fdiv_2f64:
55 ; CHECK-NEXT: ptrue p0.d
56 ; CHECK-NEXT: fdiv z0.d, p0/m, z0.d, z1.d
58 %fdiv = fdiv fast <vscale x 2 x double> %a, %b
59 ret <vscale x 2 x double> %fdiv
62 define <vscale x 2 x double> @fdiv_recip_2f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b) #0 {
63 ; CHECK-LABEL: fdiv_recip_2f64:
65 ; CHECK-NEXT: frecpe z2.d, z1.d
66 ; CHECK-NEXT: frecps z3.d, z1.d, z2.d
67 ; CHECK-NEXT: fmul z2.d, z2.d, z3.d
68 ; CHECK-NEXT: frecps z3.d, z1.d, z2.d
69 ; CHECK-NEXT: fmul z2.d, z2.d, z3.d
70 ; CHECK-NEXT: frecps z1.d, z1.d, z2.d
71 ; CHECK-NEXT: fmul z1.d, z2.d, z1.d
72 ; CHECK-NEXT: fmul z0.d, z1.d, z0.d
74 %fdiv = fdiv fast <vscale x 2 x double> %a, %b
75 ret <vscale x 2 x double> %fdiv
80 define <vscale x 8 x half> @fsqrt_8f16(<vscale x 8 x half> %a) {
81 ; CHECK-LABEL: fsqrt_8f16:
83 ; CHECK-NEXT: ptrue p0.h
84 ; CHECK-NEXT: fsqrt z0.h, p0/m, z0.h
86 %fsqrt = call fast <vscale x 8 x half> @llvm.sqrt.nxv8f16(<vscale x 8 x half> %a)
87 ret <vscale x 8 x half> %fsqrt
90 define <vscale x 8 x half> @fsqrt_recip_8f16(<vscale x 8 x half> %a) #0 {
91 ; CHECK-LABEL: fsqrt_recip_8f16:
93 ; CHECK-NEXT: frsqrte z1.h, z0.h
94 ; CHECK-NEXT: ptrue p0.h
95 ; CHECK-NEXT: fcmne p0.h, p0/z, z0.h, #0.0
96 ; CHECK-NEXT: fmul z2.h, z1.h, z1.h
97 ; CHECK-NEXT: frsqrts z2.h, z0.h, z2.h
98 ; CHECK-NEXT: fmul z1.h, z1.h, z2.h
99 ; CHECK-NEXT: fmul z0.h, p0/m, z0.h, z1.h
101 %fsqrt = call fast <vscale x 8 x half> @llvm.sqrt.nxv8f16(<vscale x 8 x half> %a)
102 ret <vscale x 8 x half> %fsqrt
105 define <vscale x 4 x float> @fsqrt_4f32(<vscale x 4 x float> %a) {
106 ; CHECK-LABEL: fsqrt_4f32:
108 ; CHECK-NEXT: ptrue p0.s
109 ; CHECK-NEXT: fsqrt z0.s, p0/m, z0.s
111 %fsqrt = call fast <vscale x 4 x float> @llvm.sqrt.nxv4f32(<vscale x 4 x float> %a)
112 ret <vscale x 4 x float> %fsqrt
115 define <vscale x 4 x float> @fsqrt_recip_4f32(<vscale x 4 x float> %a) #0 {
116 ; CHECK-LABEL: fsqrt_recip_4f32:
118 ; CHECK-NEXT: frsqrte z1.s, z0.s
119 ; CHECK-NEXT: ptrue p0.s
120 ; CHECK-NEXT: fcmne p0.s, p0/z, z0.s, #0.0
121 ; CHECK-NEXT: fmul z2.s, z1.s, z1.s
122 ; CHECK-NEXT: frsqrts z2.s, z0.s, z2.s
123 ; CHECK-NEXT: fmul z1.s, z1.s, z2.s
124 ; CHECK-NEXT: fmul z2.s, z1.s, z1.s
125 ; CHECK-NEXT: frsqrts z2.s, z0.s, z2.s
126 ; CHECK-NEXT: fmul z1.s, z1.s, z2.s
127 ; CHECK-NEXT: fmul z0.s, p0/m, z0.s, z1.s
129 %fsqrt = call fast <vscale x 4 x float> @llvm.sqrt.nxv4f32(<vscale x 4 x float> %a)
130 ret <vscale x 4 x float> %fsqrt
133 define <vscale x 2 x double> @fsqrt_2f64(<vscale x 2 x double> %a) {
134 ; CHECK-LABEL: fsqrt_2f64:
136 ; CHECK-NEXT: ptrue p0.d
137 ; CHECK-NEXT: fsqrt z0.d, p0/m, z0.d
139 %fsqrt = call fast <vscale x 2 x double> @llvm.sqrt.nxv2f64(<vscale x 2 x double> %a)
140 ret <vscale x 2 x double> %fsqrt
143 define <vscale x 2 x double> @fsqrt_recip_2f64(<vscale x 2 x double> %a) #0 {
144 ; CHECK-LABEL: fsqrt_recip_2f64:
146 ; CHECK-NEXT: frsqrte z1.d, z0.d
147 ; CHECK-NEXT: ptrue p0.d
148 ; CHECK-NEXT: fcmne p0.d, p0/z, z0.d, #0.0
149 ; CHECK-NEXT: fmul z2.d, z1.d, z1.d
150 ; CHECK-NEXT: frsqrts z2.d, z0.d, z2.d
151 ; CHECK-NEXT: fmul z1.d, z1.d, z2.d
152 ; CHECK-NEXT: fmul z2.d, z1.d, z1.d
153 ; CHECK-NEXT: frsqrts z2.d, z0.d, z2.d
154 ; CHECK-NEXT: fmul z1.d, z1.d, z2.d
155 ; CHECK-NEXT: fmul z2.d, z1.d, z1.d
156 ; CHECK-NEXT: frsqrts z2.d, z0.d, z2.d
157 ; CHECK-NEXT: fmul z1.d, z1.d, z2.d
158 ; CHECK-NEXT: fmul z0.d, p0/m, z0.d, z1.d
160 %fsqrt = call fast <vscale x 2 x double> @llvm.sqrt.nxv2f64(<vscale x 2 x double> %a)
161 ret <vscale x 2 x double> %fsqrt
164 declare <vscale x 2 x half> @llvm.sqrt.nxv2f16(<vscale x 2 x half>)
165 declare <vscale x 4 x half> @llvm.sqrt.nxv4f16(<vscale x 4 x half>)
166 declare <vscale x 8 x half> @llvm.sqrt.nxv8f16(<vscale x 8 x half>)
167 declare <vscale x 2 x float> @llvm.sqrt.nxv2f32(<vscale x 2 x float>)
168 declare <vscale x 4 x float> @llvm.sqrt.nxv4f32(<vscale x 4 x float>)
169 declare <vscale x 2 x double> @llvm.sqrt.nxv2f64(<vscale x 2 x double>)
171 attributes #0 = { "reciprocal-estimates"="all" }