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 z3.h, z1.h, z2.h
21 ; CHECK-NEXT: fmul z2.h, z2.h, z3.h
22 ; CHECK-NEXT: frecps z1.h, z1.h, z2.h
23 ; CHECK-NEXT: fmul z1.h, z2.h, z1.h
24 ; CHECK-NEXT: fmul z0.h, z1.h, z0.h
26 %fdiv = fdiv fast <vscale x 8 x half> %a, %b
27 ret <vscale x 8 x half> %fdiv
30 define <vscale x 4 x float> @fdiv_4f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {
31 ; CHECK-LABEL: fdiv_4f32:
33 ; CHECK-NEXT: ptrue p0.s
34 ; CHECK-NEXT: fdiv z0.s, p0/m, z0.s, z1.s
36 %fdiv = fdiv fast <vscale x 4 x float> %a, %b
37 ret <vscale x 4 x float> %fdiv
40 define <vscale x 4 x float> @fdiv_recip_4f32(<vscale x 4 x float> %a, <vscale x 4 x float> %b) #0 {
41 ; CHECK-LABEL: fdiv_recip_4f32:
43 ; CHECK-NEXT: frecpe z2.s, z1.s
44 ; CHECK-NEXT: frecps z3.s, z1.s, z2.s
45 ; CHECK-NEXT: fmul z2.s, z2.s, z3.s
46 ; CHECK-NEXT: frecps z1.s, z1.s, z2.s
47 ; CHECK-NEXT: fmul z1.s, z2.s, z1.s
48 ; CHECK-NEXT: fmul z0.s, z1.s, z0.s
50 %fdiv = fdiv fast <vscale x 4 x float> %a, %b
51 ret <vscale x 4 x float> %fdiv
54 define <vscale x 2 x double> @fdiv_2f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b) {
55 ; CHECK-LABEL: fdiv_2f64:
57 ; CHECK-NEXT: ptrue p0.d
58 ; CHECK-NEXT: fdiv z0.d, p0/m, z0.d, z1.d
60 %fdiv = fdiv fast <vscale x 2 x double> %a, %b
61 ret <vscale x 2 x double> %fdiv
64 define <vscale x 2 x double> @fdiv_recip_2f64(<vscale x 2 x double> %a, <vscale x 2 x double> %b) #0 {
65 ; CHECK-LABEL: fdiv_recip_2f64:
67 ; CHECK-NEXT: frecpe z2.d, z1.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 z3.d, z1.d, z2.d
71 ; CHECK-NEXT: fmul z2.d, z2.d, z3.d
72 ; CHECK-NEXT: frecps z1.d, z1.d, z2.d
73 ; CHECK-NEXT: fmul z1.d, z2.d, z1.d
74 ; CHECK-NEXT: fmul z0.d, z1.d, z0.d
76 %fdiv = fdiv fast <vscale x 2 x double> %a, %b
77 ret <vscale x 2 x double> %fdiv
82 define <vscale x 8 x half> @fsqrt_8f16(<vscale x 8 x half> %a) {
83 ; CHECK-LABEL: fsqrt_8f16:
85 ; CHECK-NEXT: ptrue p0.h
86 ; CHECK-NEXT: fsqrt z0.h, p0/m, z0.h
88 %fsqrt = call fast <vscale x 8 x half> @llvm.sqrt.nxv8f16(<vscale x 8 x half> %a)
89 ret <vscale x 8 x half> %fsqrt
92 define <vscale x 8 x half> @fsqrt_recip_8f16(<vscale x 8 x half> %a) #0 {
93 ; CHECK-LABEL: fsqrt_recip_8f16:
95 ; CHECK-NEXT: frsqrte z1.h, z0.h
96 ; CHECK-NEXT: ptrue p0.h
97 ; CHECK-NEXT: fmul z2.h, z1.h, z1.h
98 ; CHECK-NEXT: fcmne p0.h, p0/z, z0.h, #0.0
99 ; CHECK-NEXT: frsqrts z2.h, z0.h, z2.h
100 ; CHECK-NEXT: fmul z1.h, z1.h, z2.h
101 ; CHECK-NEXT: fmul z2.h, z1.h, z1.h
102 ; CHECK-NEXT: frsqrts z2.h, z0.h, z2.h
103 ; CHECK-NEXT: fmul z1.h, z1.h, z2.h
104 ; CHECK-NEXT: fmul z0.h, p0/m, z0.h, z1.h
106 %fsqrt = call fast <vscale x 8 x half> @llvm.sqrt.nxv8f16(<vscale x 8 x half> %a)
107 ret <vscale x 8 x half> %fsqrt
110 define <vscale x 4 x float> @fsqrt_4f32(<vscale x 4 x float> %a) {
111 ; CHECK-LABEL: fsqrt_4f32:
113 ; CHECK-NEXT: ptrue p0.s
114 ; CHECK-NEXT: fsqrt z0.s, p0/m, z0.s
116 %fsqrt = call fast <vscale x 4 x float> @llvm.sqrt.nxv4f32(<vscale x 4 x float> %a)
117 ret <vscale x 4 x float> %fsqrt
120 define <vscale x 4 x float> @fsqrt_recip_4f32(<vscale x 4 x float> %a) #0 {
121 ; CHECK-LABEL: fsqrt_recip_4f32:
123 ; CHECK-NEXT: frsqrte z1.s, z0.s
124 ; CHECK-NEXT: ptrue p0.s
125 ; CHECK-NEXT: fmul z2.s, z1.s, z1.s
126 ; CHECK-NEXT: fcmne p0.s, p0/z, z0.s, #0.0
127 ; CHECK-NEXT: frsqrts z2.s, z0.s, z2.s
128 ; CHECK-NEXT: fmul z1.s, z1.s, z2.s
129 ; CHECK-NEXT: fmul z2.s, z1.s, z1.s
130 ; CHECK-NEXT: frsqrts z2.s, z0.s, z2.s
131 ; CHECK-NEXT: fmul z1.s, z1.s, z2.s
132 ; CHECK-NEXT: fmul z0.s, p0/m, z0.s, z1.s
134 %fsqrt = call fast <vscale x 4 x float> @llvm.sqrt.nxv4f32(<vscale x 4 x float> %a)
135 ret <vscale x 4 x float> %fsqrt
138 define <vscale x 2 x double> @fsqrt_2f64(<vscale x 2 x double> %a) {
139 ; CHECK-LABEL: fsqrt_2f64:
141 ; CHECK-NEXT: ptrue p0.d
142 ; CHECK-NEXT: fsqrt z0.d, p0/m, z0.d
144 %fsqrt = call fast <vscale x 2 x double> @llvm.sqrt.nxv2f64(<vscale x 2 x double> %a)
145 ret <vscale x 2 x double> %fsqrt
148 define <vscale x 2 x double> @fsqrt_recip_2f64(<vscale x 2 x double> %a) #0 {
149 ; CHECK-LABEL: fsqrt_recip_2f64:
151 ; CHECK-NEXT: frsqrte z1.d, z0.d
152 ; CHECK-NEXT: ptrue p0.d
153 ; CHECK-NEXT: fmul z2.d, z1.d, z1.d
154 ; CHECK-NEXT: fcmne p0.d, p0/z, z0.d, #0.0
155 ; CHECK-NEXT: frsqrts z2.d, z0.d, z2.d
156 ; CHECK-NEXT: fmul z1.d, z1.d, z2.d
157 ; CHECK-NEXT: fmul z2.d, z1.d, z1.d
158 ; CHECK-NEXT: frsqrts z2.d, z0.d, z2.d
159 ; CHECK-NEXT: fmul z1.d, z1.d, z2.d
160 ; CHECK-NEXT: fmul z2.d, z1.d, z1.d
161 ; CHECK-NEXT: frsqrts z2.d, z0.d, z2.d
162 ; CHECK-NEXT: fmul z1.d, z1.d, z2.d
163 ; CHECK-NEXT: fmul z0.d, p0/m, z0.d, z1.d
165 %fsqrt = call fast <vscale x 2 x double> @llvm.sqrt.nxv2f64(<vscale x 2 x double> %a)
166 ret <vscale x 2 x double> %fsqrt
169 declare <vscale x 2 x half> @llvm.sqrt.nxv2f16(<vscale x 2 x half>)
170 declare <vscale x 4 x half> @llvm.sqrt.nxv4f16(<vscale x 4 x half>)
171 declare <vscale x 8 x half> @llvm.sqrt.nxv8f16(<vscale x 8 x half>)
172 declare <vscale x 2 x float> @llvm.sqrt.nxv2f32(<vscale x 2 x float>)
173 declare <vscale x 4 x float> @llvm.sqrt.nxv4f32(<vscale x 4 x float>)
174 declare <vscale x 2 x double> @llvm.sqrt.nxv2f64(<vscale x 2 x double>)
176 attributes #0 = { "reciprocal-estimates"="all" }