@@ -229,6 +229,14 @@ multiclass Binary_rv_vv<
229229 defm : Binary_vv<OpNode, DataVT, MaskVT, OpBaseName>;
230230}
231231
232+ multiclass Binary_rv_vr_vv<
233+ SDPatternOperator OpNode,
234+ ValueType ScalarVT, ValueType DataVT, ValueType MaskVT,
235+ string OpBaseName> {
236+ defm : Binary_rv<OpNode, ScalarVT, DataVT, MaskVT, OpBaseName>;
237+ defm : Binary_vr_vv<OpNode, ScalarVT, DataVT, MaskVT, OpBaseName>;
238+ }
239+
232240// Expand both 64bit and 32 bit variant (256 elements)
233241multiclass Binary_rv_vv_ShortLong<
234242 SDPatternOperator OpNode,
@@ -254,23 +262,6 @@ multiclass Binary_vr_vv_ShortLong<
254262 ShortOpBaseName>;
255263}
256264
257- // Binary operators that support broadcasts on LHS and RHS.
258- multiclass Binary_all<
259- SDPatternOperator OpNode,
260- ValueType ScalarVT, ValueType DataVT,
261- ValueType MaskVT, string OpBaseName> {
262- defm : Binary_rv<OpNode, ScalarVT, DataVT, MaskVT, OpBaseName>;
263- defm : Binary_vr_vv<OpNode, ScalarVT, DataVT, MaskVT, OpBaseName>;
264- }
265-
266- multiclass Binary_ShortLong<
267- SDPatternOperator OpNode,
268- ValueType LongScalarVT, ValueType LongDataVT, string LongOpBaseName,
269- ValueType ShortScalarVT, ValueType ShortDataVT, string ShortOpBaseName> {
270- defm : Binary_all<OpNode, LongScalarVT, LongDataVT, v256i1, LongOpBaseName>;
271- defm : Binary_all<OpNode, ShortScalarVT, ShortDataVT, v256i1, ShortOpBaseName>;
272- }
273-
274265multiclass Ternary<
275266 SDPatternOperator OpNode,
276267 ValueType ScalarVT, ValueType DataVT,
@@ -332,6 +323,18 @@ multiclass Ternary_ShortLong<
332323// Integer arithmetic (256 elements)
333324defm : Unary_ShortLong<vvp_ctpop, i64, v256i64, "VPCNT", i32, v256i32, "PVPCNTLO">;
334325
326+ multiclass Binary_rv_vr_vv_ShortLong<
327+ SDPatternOperator OpNode,
328+ ValueType LongScalarVT, ValueType LongDataVT, string LongOpBaseName,
329+ ValueType ShortScalarVT, ValueType ShortDataVT, string ShortOpBaseName> {
330+ defm : Binary_rv_vr_vv<OpNode,
331+ LongScalarVT, LongDataVT, v256i1,
332+ LongOpBaseName>;
333+ defm : Binary_rv_vr_vv<OpNode,
334+ ShortScalarVT, ShortDataVT, v256i1,
335+ ShortOpBaseName>;
336+ }
337+
335338defm : Binary_rv_vv_ShortLong<c_vvp_add,
336339 i64, v256i64, "VADDSL",
337340 i32, v256i32, "VADDSWSX">;
@@ -341,6 +344,12 @@ defm : Binary_rv_vv_ShortLong<vvp_sub,
341344defm : Binary_rv_vv_ShortLong<c_vvp_mul,
342345 i64, v256i64, "VMULSL",
343346 i32, v256i32, "VMULSWSX">;
347+ defm : Binary_rv_vr_vv_ShortLong<vvp_sdiv,
348+ i64, v256i64, "VDIVSL",
349+ i32, v256i32, "VDIVSWSX">;
350+ defm : Binary_rv_vr_vv_ShortLong<vvp_udiv,
351+ i64, v256i64, "VDIVUL",
352+ i32, v256i32, "VDIVUW">;
344353defm : Binary_rv_vv_ShortLong<c_vvp_and,
345354 i64, v256i64, "VAND",
346355 i32, v256i32, "PVANDLO">;
@@ -351,9 +360,6 @@ defm : Binary_rv_vv_ShortLong<c_vvp_xor,
351360 i64, v256i64, "VXOR",
352361 i32, v256i32, "PVXORLO">;
353362
354- defm : Binary_ShortLong<vvp_sdiv, i64, v256i64, "VDIVSL", i32, v256i32, "VDIVSWSX">;
355- defm : Binary_ShortLong<vvp_udiv, i64, v256i64, "VDIVUL", i32, v256i32, "VDIVUW">;
356-
357363defm : Binary_vr_vv_ShortLong<vvp_shl,
358364 i64, v256i64, "VSLL",
359365 i32, v256i32, "PVSLLLO">;
@@ -370,7 +376,7 @@ defm : Unary_ShortLong<vvp_fsqrt, f64, v256f64, "VFSQRTD", f32, v256f32, "VFSQRT
370376defm : Binary_rv_vv_ShortLong<c_vvp_fadd, f64, v256f64, "VFADDD", f32, v256f32, "PVFADDUP">;
371377defm : Binary_rv_vv_ShortLong<vvp_fsub, f64, v256f64, "VFSUBD", f32, v256f32, "PVFSUBUP">;
372378defm : Binary_rv_vv_ShortLong<c_vvp_fmul, f64, v256f64, "VFMULD", f32, v256f32, "PVFMULUP">;
373- defm : Binary_ShortLong <vvp_fdiv, f64, v256f64, "VFDIVD", f32, v256f32, "VFDIVS">;
379+ defm : Binary_rv_vr_vv_ShortLong <vvp_fdiv, f64, v256f64, "VFDIVD", f32, v256f32, "VFDIVS">;
374380
375381defm : Binary_rv_vv_ShortLong<c_vvp_fminnum, f64, v256f64, "VFMIND", f32, v256f32, "VFMINS">;
376382defm : Binary_rv_vv_ShortLong<c_vvp_fmaxnum, f64, v256f64, "VFMAXD", f32, v256f32, "VFMAXS">;
0 commit comments