1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible-sve < %s | FileCheck %s
4 target triple = "aarch64-unknown-linux-gnu"
10 define <4 x half> @fma_v4f16(<4 x half> %op1, <4 x half> %op2, <4 x half> %op3) {
11 ; CHECK-LABEL: fma_v4f16:
13 ; CHECK-NEXT: ptrue p0.h, vl4
14 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
15 ; CHECK-NEXT: // kill: def $d2 killed $d2 def $z2
16 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
17 ; CHECK-NEXT: fmad z0.h, p0/m, z1.h, z2.h
18 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
20 %mul = fmul contract <4 x half> %op1, %op2
21 %res = fadd contract <4 x half> %mul, %op3
25 define <8 x half> @fma_v8f16(<8 x half> %op1, <8 x half> %op2, <8 x half> %op3) {
26 ; CHECK-LABEL: fma_v8f16:
28 ; CHECK-NEXT: ptrue p0.h, vl8
29 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
30 ; CHECK-NEXT: // kill: def $q2 killed $q2 def $z2
31 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
32 ; CHECK-NEXT: fmad z0.h, p0/m, z1.h, z2.h
33 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
35 %mul = fmul contract <8 x half> %op1, %op2
36 %res = fadd contract <8 x half> %mul, %op3
40 define void @fma_v16f16(ptr %a, ptr %b, ptr %c) {
41 ; CHECK-LABEL: fma_v16f16:
43 ; CHECK-NEXT: ptrue p0.h, vl8
44 ; CHECK-NEXT: ldp q0, q4, [x1]
45 ; CHECK-NEXT: ldp q1, q5, [x2]
46 ; CHECK-NEXT: ldp q2, q3, [x0]
47 ; CHECK-NEXT: fmad z0.h, p0/m, z2.h, z1.h
48 ; CHECK-NEXT: movprfx z1, z5
49 ; CHECK-NEXT: fmla z1.h, p0/m, z3.h, z4.h
50 ; CHECK-NEXT: stp q0, q1, [x0]
52 %op1 = load <16 x half>, ptr %a
53 %op2 = load <16 x half>, ptr %b
54 %op3 = load <16 x half>, ptr %c
55 %mul = fmul contract <16 x half> %op1, %op2
56 %res = fadd contract <16 x half> %mul, %op3
57 store <16 x half> %res, ptr %a
61 define <2 x float> @fma_v2f32(<2 x float> %op1, <2 x float> %op2, <2 x float> %op3) {
62 ; CHECK-LABEL: fma_v2f32:
64 ; CHECK-NEXT: ptrue p0.s, vl2
65 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
66 ; CHECK-NEXT: // kill: def $d2 killed $d2 def $z2
67 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
68 ; CHECK-NEXT: fmad z0.s, p0/m, z1.s, z2.s
69 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
71 %mul = fmul contract <2 x float> %op1, %op2
72 %res = fadd contract <2 x float> %mul, %op3
76 define <4 x float> @fma_v4f32(<4 x float> %op1, <4 x float> %op2, <4 x float> %op3) {
77 ; CHECK-LABEL: fma_v4f32:
79 ; CHECK-NEXT: ptrue p0.s, vl4
80 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
81 ; CHECK-NEXT: // kill: def $q2 killed $q2 def $z2
82 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
83 ; CHECK-NEXT: fmad z0.s, p0/m, z1.s, z2.s
84 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
86 %mul = fmul contract <4 x float> %op1, %op2
87 %res = fadd contract <4 x float> %mul, %op3
91 define void @fma_v8f32(ptr %a, ptr %b, ptr %c) {
92 ; CHECK-LABEL: fma_v8f32:
94 ; CHECK-NEXT: ptrue p0.s, vl4
95 ; CHECK-NEXT: ldp q0, q4, [x1]
96 ; CHECK-NEXT: ldp q1, q5, [x2]
97 ; CHECK-NEXT: ldp q2, q3, [x0]
98 ; CHECK-NEXT: fmad z0.s, p0/m, z2.s, z1.s
99 ; CHECK-NEXT: movprfx z1, z5
100 ; CHECK-NEXT: fmla z1.s, p0/m, z3.s, z4.s
101 ; CHECK-NEXT: stp q0, q1, [x0]
103 %op1 = load <8 x float>, ptr %a
104 %op2 = load <8 x float>, ptr %b
105 %op3 = load <8 x float>, ptr %c
106 %mul = fmul contract <8 x float> %op1, %op2
107 %res = fadd contract <8 x float> %mul, %op3
108 store <8 x float> %res, ptr %a
112 define <1 x double> @fma_v1f64(<1 x double> %op1, <1 x double> %op2, <1 x double> %op3) {
113 ; CHECK-LABEL: fma_v1f64:
115 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
116 ; CHECK-NEXT: // kill: def $d2 killed $d2 def $z2
117 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
118 ; CHECK-NEXT: fmadd d0, d0, d1, d2
120 %mul = fmul contract <1 x double> %op1, %op2
121 %res = fadd contract <1 x double> %mul, %op3
122 ret <1 x double> %res
125 define <2 x double> @fma_v2f64(<2 x double> %op1, <2 x double> %op2, <2 x double> %op3) {
126 ; CHECK-LABEL: fma_v2f64:
128 ; CHECK-NEXT: ptrue p0.d, vl2
129 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
130 ; CHECK-NEXT: // kill: def $q2 killed $q2 def $z2
131 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
132 ; CHECK-NEXT: fmad z0.d, p0/m, z1.d, z2.d
133 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
135 %mul = fmul contract <2 x double> %op1, %op2
136 %res = fadd contract <2 x double> %mul, %op3
137 ret <2 x double> %res
140 define void @fma_v4f64(ptr %a, ptr %b, ptr %c) {
141 ; CHECK-LABEL: fma_v4f64:
143 ; CHECK-NEXT: ptrue p0.d, vl2
144 ; CHECK-NEXT: ldp q0, q4, [x1]
145 ; CHECK-NEXT: ldp q1, q5, [x2]
146 ; CHECK-NEXT: ldp q2, q3, [x0]
147 ; CHECK-NEXT: fmad z0.d, p0/m, z2.d, z1.d
148 ; CHECK-NEXT: movprfx z1, z5
149 ; CHECK-NEXT: fmla z1.d, p0/m, z3.d, z4.d
150 ; CHECK-NEXT: stp q0, q1, [x0]
152 %op1 = load <4 x double>, ptr %a
153 %op2 = load <4 x double>, ptr %b
154 %op3 = load <4 x double>, ptr %c
155 %mul = fmul contract <4 x double> %op1, %op2
156 %res = fadd contract <4 x double> %mul, %op3
157 store <4 x double> %res, ptr %a