xref: /freebsd/contrib/llvm-project/llvm/lib/Target/VE/VVPInstrInfo.td (revision 833a452e9f082a7982a31c21f0da437dbbe0a39d)
1//===-------------- VVPInstrInfo.td - VVP_* SDNode patterns ---------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the VE Vector Predicated SDNodes (VVP SDNodes).  VVP
10// SDNodes are an intermediate isel layer between the vector SDNodes emitted by
11// LLVM and the actual VE vector instructions. For example:
12//
13//  ADD(x,y)   -->   VVP_ADD(x,y,mask,evl)   -->   VADDSWSXrvml(x,y,mask,evl)
14//     ^                      ^                            ^
15//  The standard     The VVP layer SDNode.        The VE vector instruction.
16//  SDNode.
17//
18// TODO explain how VVP nodes relate to VP SDNodes once VP ISel is uptream.
19//===----------------------------------------------------------------------===//
20
21// Binary Operators {
22
23// BinaryOp(x,y,mask,vl)
24def SDTIntBinOpVVP : SDTypeProfile<1, 4, [     // vp_add, vp_and, etc.
25  SDTCisSameAs<0, 1>,
26  SDTCisSameAs<0, 2>,
27  SDTCisInt<0>,
28  SDTCisSameNumEltsAs<0, 3>,
29  IsVLVT<4>
30]>;
31
32// Binary operator commutative pattern.
33class vvp_commutative<SDNode RootOp> :
34  PatFrags<
35  (ops node:$lhs, node:$rhs, node:$mask, node:$vlen),
36  [(RootOp node:$lhs, node:$rhs, node:$mask, node:$vlen),
37   (RootOp node:$rhs, node:$lhs, node:$mask, node:$vlen)]>;
38
39// VVP node definitions.
40def vvp_add    : SDNode<"VEISD::VVP_ADD",  SDTIntBinOpVVP>;
41def c_vvp_add  : vvp_commutative<vvp_add>;
42
43def vvp_and    : SDNode<"VEISD::VVP_AND",  SDTIntBinOpVVP>;
44def c_vvp_and  : vvp_commutative<vvp_and>;
45
46// } Binary Operators
47