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
8 define <vscale x 16 x i8> @masked_add_nxv16i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b, <vscale x 16 x i1> %mask) {
9 ; CHECK-LABEL: masked_add_nxv16i8:
11 ; CHECK-NEXT: add z0.b, p0/m, z0.b, z1.b
13 %select = select <vscale x 16 x i1> %mask, <vscale x 16 x i8> %b, <vscale x 16 x i8> zeroinitializer
14 %ret = add <vscale x 16 x i8> %a, %select
15 ret <vscale x 16 x i8> %ret
18 define <vscale x 8 x i16> @masked_add_nxv8i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b, <vscale x 8 x i1> %mask) {
19 ; CHECK-LABEL: masked_add_nxv8i16:
21 ; CHECK-NEXT: add z0.h, p0/m, z0.h, z1.h
23 %select = select <vscale x 8 x i1> %mask, <vscale x 8 x i16> %b, <vscale x 8 x i16> zeroinitializer
24 %ret = add <vscale x 8 x i16> %a, %select
25 ret <vscale x 8 x i16> %ret
28 define <vscale x 4 x i32> @masked_add_nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b, <vscale x 4 x i1> %mask) {
29 ; CHECK-LABEL: masked_add_nxv4i32:
31 ; CHECK-NEXT: add z0.s, p0/m, z0.s, z1.s
33 %select = select <vscale x 4 x i1> %mask, <vscale x 4 x i32> %b, <vscale x 4 x i32> zeroinitializer
34 %ret = add <vscale x 4 x i32> %a, %select
35 ret <vscale x 4 x i32> %ret
38 define <vscale x 2 x i64> @masked_add_nxv2i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b, <vscale x 2 x i1> %mask) {
39 ; CHECK-LABEL: masked_add_nxv2i64:
41 ; CHECK-NEXT: add z0.d, p0/m, z0.d, z1.d
43 %select = select <vscale x 2 x i1> %mask, <vscale x 2 x i64> %b, <vscale x 2 x i64> zeroinitializer
44 %ret = add <vscale x 2 x i64> %a, %select
45 ret <vscale x 2 x i64> %ret
52 define <vscale x 16 x i8> @masked_sub_nxv16i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b, <vscale x 16 x i1> %mask) {
53 ; CHECK-LABEL: masked_sub_nxv16i8:
55 ; CHECK-NEXT: sub z0.b, p0/m, z0.b, z1.b
57 %select = select <vscale x 16 x i1> %mask, <vscale x 16 x i8> %b, <vscale x 16 x i8> zeroinitializer
58 %ret = sub <vscale x 16 x i8> %a, %select
59 ret <vscale x 16 x i8> %ret
62 define <vscale x 8 x i16> @masked_sub_nxv8i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b, <vscale x 8 x i1> %mask) {
63 ; CHECK-LABEL: masked_sub_nxv8i16:
65 ; CHECK-NEXT: sub z0.h, p0/m, z0.h, z1.h
67 %select = select <vscale x 8 x i1> %mask, <vscale x 8 x i16> %b, <vscale x 8 x i16> zeroinitializer
68 %ret = sub <vscale x 8 x i16> %a, %select
69 ret <vscale x 8 x i16> %ret
72 define <vscale x 4 x i32> @masked_sub_nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b, <vscale x 4 x i1> %mask) {
73 ; CHECK-LABEL: masked_sub_nxv4i32:
75 ; CHECK-NEXT: sub z0.s, p0/m, z0.s, z1.s
77 %select = select <vscale x 4 x i1> %mask, <vscale x 4 x i32> %b, <vscale x 4 x i32> zeroinitializer
78 %ret = sub <vscale x 4 x i32> %a, %select
79 ret <vscale x 4 x i32> %ret
82 define <vscale x 2 x i64> @masked_sub_nxv2i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b, <vscale x 2 x i1> %mask) {
83 ; CHECK-LABEL: masked_sub_nxv2i64:
85 ; CHECK-NEXT: sub z0.d, p0/m, z0.d, z1.d
87 %select = select <vscale x 2 x i1> %mask, <vscale x 2 x i64> %b, <vscale x 2 x i64> zeroinitializer
88 %ret = sub <vscale x 2 x i64> %a, %select
89 ret <vscale x 2 x i64> %ret
96 define <vscale x 16 x i8> @masked_mla_nxv16i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b, <vscale x 16 x i8> %c, <vscale x 16 x i1> %mask) {
97 ; CHECK-LABEL: masked_mla_nxv16i8:
99 ; CHECK-NEXT: mla z0.b, p0/m, z1.b, z2.b
101 %mul = mul nsw <vscale x 16 x i8> %b, %c
102 %sel = select <vscale x 16 x i1> %mask, <vscale x 16 x i8> %mul, <vscale x 16 x i8> zeroinitializer
103 %add = add <vscale x 16 x i8> %a, %sel
104 ret <vscale x 16 x i8> %add
107 define <vscale x 8 x i16> @masked_mla_nxv8i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b, <vscale x 8 x i16> %c, <vscale x 8 x i1> %mask) {
108 ; CHECK-LABEL: masked_mla_nxv8i16:
110 ; CHECK-NEXT: mla z0.h, p0/m, z1.h, z2.h
112 %mul = mul nsw <vscale x 8 x i16> %b, %c
113 %sel = select <vscale x 8 x i1> %mask, <vscale x 8 x i16> %mul, <vscale x 8 x i16> zeroinitializer
114 %add = add <vscale x 8 x i16> %a, %sel
115 ret <vscale x 8 x i16> %add
118 define <vscale x 4 x i32> @masked_mla_nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b, <vscale x 4 x i32> %c, <vscale x 4 x i1> %mask) {
119 ; CHECK-LABEL: masked_mla_nxv4i32:
121 ; CHECK-NEXT: mla z0.s, p0/m, z1.s, z2.s
123 %mul = mul nsw <vscale x 4 x i32> %b, %c
124 %sel = select <vscale x 4 x i1> %mask, <vscale x 4 x i32> %mul, <vscale x 4 x i32> zeroinitializer
125 %add = add <vscale x 4 x i32> %a, %sel
126 ret <vscale x 4 x i32> %add
129 define <vscale x 2 x i64> @masked_mla_nxv2i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b, <vscale x 2 x i64> %c, <vscale x 2 x i1> %mask) {
130 ; CHECK-LABEL: masked_mla_nxv2i64:
132 ; CHECK-NEXT: mla z0.d, p0/m, z1.d, z2.d
134 %mul = mul nsw <vscale x 2 x i64> %b, %c
135 %sel = select <vscale x 2 x i1> %mask, <vscale x 2 x i64> %mul, <vscale x 2 x i64> zeroinitializer
136 %add = add <vscale x 2 x i64> %a, %sel
137 ret <vscale x 2 x i64> %add
141 ; Masked multiply-subtract
144 define <vscale x 16 x i8> @masked_mls_nxv16i8(<vscale x 16 x i8> %a, <vscale x 16 x i8> %b, <vscale x 16 x i8> %c, <vscale x 16 x i1> %mask) {
145 ; CHECK-LABEL: masked_mls_nxv16i8:
147 ; CHECK-NEXT: mls z0.b, p0/m, z1.b, z2.b
149 %mul = mul nsw <vscale x 16 x i8> %b, %c
150 %sel = select <vscale x 16 x i1> %mask, <vscale x 16 x i8> %mul, <vscale x 16 x i8> zeroinitializer
151 %sub = sub <vscale x 16 x i8> %a, %sel
152 ret <vscale x 16 x i8> %sub
155 define <vscale x 8 x i16> @masked_mls_nxv8i16(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b, <vscale x 8 x i16> %c, <vscale x 8 x i1> %mask) {
156 ; CHECK-LABEL: masked_mls_nxv8i16:
158 ; CHECK-NEXT: mls z0.h, p0/m, z1.h, z2.h
160 %mul = mul nsw <vscale x 8 x i16> %b, %c
161 %sel = select <vscale x 8 x i1> %mask, <vscale x 8 x i16> %mul, <vscale x 8 x i16> zeroinitializer
162 %sub = sub <vscale x 8 x i16> %a, %sel
163 ret <vscale x 8 x i16> %sub
166 define <vscale x 4 x i32> @masked_mls_nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b, <vscale x 4 x i32> %c, <vscale x 4 x i1> %mask) {
167 ; CHECK-LABEL: masked_mls_nxv4i32:
169 ; CHECK-NEXT: mls z0.s, p0/m, z1.s, z2.s
171 %mul = mul nsw <vscale x 4 x i32> %b, %c
172 %sel = select <vscale x 4 x i1> %mask, <vscale x 4 x i32> %mul, <vscale x 4 x i32> zeroinitializer
173 %sub = sub <vscale x 4 x i32> %a, %sel
174 ret <vscale x 4 x i32> %sub
177 define <vscale x 2 x i64> @masked_mls_nxv2i64(<vscale x 2 x i64> %a, <vscale x 2 x i64> %b, <vscale x 2 x i64> %c, <vscale x 2 x i1> %mask) {
178 ; CHECK-LABEL: masked_mls_nxv2i64:
180 ; CHECK-NEXT: mls z0.d, p0/m, z1.d, z2.d
182 %mul = mul nsw <vscale x 2 x i64> %b, %c
183 %sel = select <vscale x 2 x i1> %mask, <vscale x 2 x i64> %mul, <vscale x 2 x i64> zeroinitializer
184 %sub = sub <vscale x 2 x i64> %a, %sel
185 ret <vscale x 2 x i64> %sub