1//===-- VEInstrPatternsVec.td - VEC_-type SDNodes and isel for VE Target --===//
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 describes the VEC_* prefixed intermediate SDNodes and their
10// isel patterns.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// Instruction format superclass
16//===----------------------------------------------------------------------===//
17
18// Custom intermediate ISDs.
19class IsVLVT<int OpIdx> : SDTCisVT<OpIdx,i32>;
20def vec_broadcast   : SDNode<"VEISD::VEC_BROADCAST", SDTypeProfile<1, 2,  [SDTCisVec<0>, IsVLVT<2>]>>;
21
22multiclass vbrd_elem32<ValueType v32, ValueType s32, SDPatternOperator ImmOp, SDNodeXForm ImmCast, int SubRegIdx> {
23  // VBRDil
24  def : Pat<(v32 (vec_broadcast (s32 ImmOp:$sy), i32:$vl)),
25            (VBRDil (ImmCast $sy), i32:$vl)>;
26
27  // VBRDrl
28  def : Pat<(v32 (vec_broadcast s32:$sy, i32:$vl)),
29            (VBRDrl
30              (INSERT_SUBREG (i64 (IMPLICIT_DEF)), $sy, SubRegIdx),
31              i32:$vl)>;
32}
33
34defm : vbrd_elem32<v256f32, f32, simm7fp, LO7FP, sub_f32>;
35defm : vbrd_elem32<v256i32, i32, simm7, LO7, sub_i32>;
36
37multiclass vbrd_elem64<ValueType v64, ValueType s64, SDPatternOperator ImmOp, SDNodeXForm ImmCast> {
38  // VBRDil
39  def : Pat<(v64 (vec_broadcast (s64 ImmOp:$sy), i32:$vl)),
40            (VBRDil (ImmCast $sy), i32:$vl)>;
41
42  // VBRDrl
43  def : Pat<(v64 (vec_broadcast s64:$sy, i32:$vl)),
44            (VBRDrl s64:$sy, i32:$vl)>;
45}
46
47defm : vbrd_elem64<v256f64, f64, simm7fp, LO7FP>;
48defm : vbrd_elem64<v256i64, i64, simm7, LO7>;
49