@@ -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">;
@@ -365,19 +371,36 @@ defm : Binary_vr_vv_ShortLong<vvp_srl,
365371 i32, v256i32, "PVSRLLO">;
366372
367373// Floating-point arithmetic (256 elements)
368- defm : Unary_ShortLong<vvp_frcp, f64, v256f64, "VRCPD", f32, v256f32, "VRCPS">;
369- defm : Unary_ShortLong<vvp_fsqrt, f64, v256f64, "VFSQRTD", f32, v256f32, "VFSQRTS">;
370- defm : Binary_rv_vv_ShortLong<c_vvp_fadd, f64, v256f64, "VFADDD", f32, v256f32, "PVFADDUP">;
371- defm : Binary_rv_vv_ShortLong<vvp_fsub, f64, v256f64, "VFSUBD", f32, v256f32, "PVFSUBUP">;
372- defm : 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">;
374-
375- defm : Binary_rv_vv_ShortLong<c_vvp_fminnum, f64, v256f64, "VFMIND", f32, v256f32, "VFMINS">;
376- defm : Binary_rv_vv_ShortLong<c_vvp_fmaxnum, f64, v256f64, "VFMAXD", f32, v256f32, "VFMAXS">;
377-
378- defm : Ternary_ShortLong<c_vvp_ffma, f64, v256f64, "VFMADD", f32, v256f32, "VFMADS">;
379- defm : Ternary_ShortLong<c_vvp_ffms, f64, v256f64, "VFMSBD", f32, v256f32, "VFMSBS">;
380- defm : Ternary_ShortLong<c_vvp_ffmsn, f64, v256f64, "VFNMSBD", f32, v256f32, "VFNMSBS">;
374+ defm : Unary_ShortLong<vvp_frcp,
375+ f64, v256f64, "VRCPD", f32, v256f32, "VRCPS">;
376+ defm : Unary_ShortLong<vvp_fsqrt,
377+ f64, v256f64, "VFSQRTD", f32, v256f32, "VFSQRTS">;
378+ defm : Binary_rv_vv_ShortLong<c_vvp_fadd,
379+ f64, v256f64, "VFADDD",
380+ f32, v256f32, "PVFADDUP">;
381+ defm : Binary_rv_vv_ShortLong<c_vvp_fmul,
382+ f64, v256f64, "VFMULD",
383+ f32, v256f32, "PVFMULUP">;
384+ defm : Binary_rv_vv_ShortLong<vvp_fsub,
385+ f64, v256f64, "VFSUBD",
386+ f32, v256f32, "PVFSUBUP">;
387+ defm : Binary_rv_vr_vv_ShortLong<vvp_fdiv,
388+ f64, v256f64, "VFDIVD",
389+ f32, v256f32, "VFDIVS">;
390+
391+ defm : Binary_rv_vv_ShortLong<c_vvp_fminnum,
392+ f64, v256f64, "VFMIND",
393+ f32, v256f32, "VFMINS">;
394+ defm : Binary_rv_vv_ShortLong<c_vvp_fmaxnum,
395+ f64, v256f64, "VFMAXD",
396+ f32, v256f32, "VFMAXS">;
397+
398+ defm : Ternary_ShortLong<c_vvp_ffma,
399+ f64, v256f64, "VFMADD", f32, v256f32, "VFMADS">;
400+ defm : Ternary_ShortLong<c_vvp_ffms,
401+ f64, v256f64, "VFMSBD", f32, v256f32, "VFMSBS">;
402+ defm : Ternary_ShortLong<c_vvp_ffmsn,
403+ f64, v256f64, "VFNMSBD", f32, v256f32, "VFNMSBS">;
381404// TODO: vvp_ffman
382405
383406///// Selection /////
0 commit comments