//===----------- VVPInstrPatternsVec.td - VVP_* SDNode patterns -----------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file describes how VVP_* SDNodes are lowered to machine instructions. // //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // // VVP SDNode definitions. // //===----------------------------------------------------------------------===// include "VVPInstrInfo.td" multiclass Binary_rv { // Masked with passthru, broadcast. def : Pat<(vvp_select (OpNode (any_broadcast ScalarVT:$sx), DataVT:$vy, (MaskVT srcvalue), (i32 srcvalue)), DataVT:$vfalse, MaskVT:$mask, i32:$pivot), (!cast(OpBaseName#"rvml_v") ScalarVT:$sx, $vy, $mask, $pivot, $vfalse)>; // Unmasked, broadcast. def : Pat<(OpNode (any_broadcast ScalarVT:$sx), DataVT:$vy, (MaskVT true_mask), i32:$avl), (!cast(OpBaseName#"rvl") ScalarVT:$sx, $vy, $avl)>; // Masked, broadcast. def : Pat<(OpNode (any_broadcast ScalarVT:$sx), DataVT:$vy, MaskVT:$mask, i32:$avl), (!cast(OpBaseName#"rvml") ScalarVT:$sx, $vy, $mask, $avl)>; } multiclass Binary_vr { // Masked with passthru, broadcast. def : Pat<(vvp_select (OpNode DataVT:$vx, (any_broadcast ScalarVT:$sy), (MaskVT srcvalue), (i32 srcvalue)), DataVT:$vfalse, MaskVT:$mask, i32:$pivot), (!cast(OpBaseName#"vrml_v") $vx, ScalarVT:$sy, $mask, $pivot, $vfalse)>; // Unmasked, broadcast. def : Pat<(OpNode DataVT:$vx, (any_broadcast ScalarVT:$sy), (MaskVT true_mask), i32:$avl), (!cast(OpBaseName#"vrl") $vx, ScalarVT:$sy, $avl)>; // Masked, broadcast. def : Pat<(OpNode DataVT:$vx, (any_broadcast ScalarVT:$sy), MaskVT:$mask, i32:$avl), (!cast(OpBaseName#"vrml") $vx, ScalarVT:$sy, $mask, $avl)>; } multiclass Binary_vv { // Masked with passthru, broadcast. def : Pat<(vvp_select (OpNode DataVT:$vx, DataVT:$vy, (MaskVT srcvalue), (i32 srcvalue)), DataVT:$vfalse, MaskVT:$mask, i32:$pivot), (!cast(OpBaseName#"vvml_v") $vx, $vy, $mask, $pivot, $vfalse)>; // Masked with select. // TODO // Unmasked. def : Pat<(OpNode DataVT:$vx, DataVT:$vy, (MaskVT true_mask), i32:$avl), (!cast(OpBaseName#"vvl") $vx, $vy, $avl)>; // Masked. def : Pat<(OpNode DataVT:$vx, DataVT:$vy, MaskVT:$mask, i32:$avl), (!cast(OpBaseName#"vvml") $vx, $vy, $mask, $avl)>; } multiclass Binary_rv_vv< SDPatternOperator OpNode, ValueType ScalarVT, ValueType DataVT, ValueType MaskVT, string OpBaseName> { defm : Binary_rv; defm : Binary_vv; } multiclass Binary_vr_vv< SDPatternOperator OpNode, ValueType ScalarVT, ValueType DataVT, ValueType MaskVT, string OpBaseName> { defm : Binary_vr; defm : Binary_vv; } multiclass Binary_rv_vr_vv< SDPatternOperator OpNode, ValueType ScalarVT, ValueType DataVT, ValueType MaskVT, string OpBaseName> { defm : Binary_rv; defm : Binary_vr_vv; } // Expand both 64bit and 32 bit variant (256 elements) multiclass Binary_rv_vv_ShortLong< SDPatternOperator OpNode, ValueType LongScalarVT, ValueType LongDataVT, string LongOpBaseName, ValueType ShortScalarVT, ValueType ShortDataVT, string ShortOpBaseName> { defm : Binary_rv_vv; defm : Binary_rv_vv; } multiclass Binary_vr_vv_ShortLong< SDPatternOperator OpNode, ValueType LongScalarVT, ValueType LongDataVT, string LongOpBaseName, ValueType ShortScalarVT, ValueType ShortDataVT, string ShortOpBaseName> { defm : Binary_vr_vv; defm : Binary_vr_vv; } multiclass Binary_rv_vr_vv_ShortLong< SDPatternOperator OpNode, ValueType LongScalarVT, ValueType LongDataVT, string LongOpBaseName, ValueType ShortScalarVT, ValueType ShortDataVT, string ShortOpBaseName> { defm : Binary_rv_vr_vv; defm : Binary_rv_vr_vv; } defm : Binary_rv_vv_ShortLong; defm : Binary_rv_vv_ShortLong; defm : Binary_rv_vv_ShortLong; defm : Binary_rv_vr_vv_ShortLong; defm : Binary_rv_vr_vv_ShortLong; defm : Binary_rv_vv_ShortLong; defm : Binary_rv_vv_ShortLong; defm : Binary_rv_vv_ShortLong; defm : Binary_vr_vv_ShortLong; defm : Binary_vr_vv_ShortLong; defm : Binary_vr_vv_ShortLong; defm : Binary_rv_vv_ShortLong; defm : Binary_rv_vv_ShortLong; defm : Binary_rv_vv_ShortLong; defm : Binary_rv_vr_vv_ShortLong; multiclass Merge_mvv< SDPatternOperator OpNode, ValueType DataVT, ValueType MaskVT, string OpBaseName> { // Masked. def : Pat<(OpNode DataVT:$vtrue, DataVT:$vfalse, MaskVT:$vm, i32:$avl), (!cast(OpBaseName#"vvml_v") $vfalse, $vtrue, $vm, $avl, $vfalse)>; } multiclass Merge_mvv_ShortLong< SDPatternOperator OpNode, ValueType LongDataVT, ValueType ShortDataVT, string OpBaseName> { defm : Merge_mvv; defm : Merge_mvv; } defm : Merge_mvv_ShortLong; defm : Merge_mvv_ShortLong;