1*e8d8bef9SDimitry Andric//===-- VEInstrPatternsVec.td - VEC_-type SDNodes and isel for VE Target --===// 2*e8d8bef9SDimitry Andric// 3*e8d8bef9SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*e8d8bef9SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5*e8d8bef9SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*e8d8bef9SDimitry Andric// 7*e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 8*e8d8bef9SDimitry Andric// 9*e8d8bef9SDimitry Andric// This file describes the VEC_* prefixed intermediate SDNodes and their 10*e8d8bef9SDimitry Andric// isel patterns. 11*e8d8bef9SDimitry Andric// 12*e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 13*e8d8bef9SDimitry Andric 14*e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 15*e8d8bef9SDimitry Andric// Instruction format superclass 16*e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 17*e8d8bef9SDimitry Andric 18*e8d8bef9SDimitry Andricmulticlass vbrd_elem32<ValueType v32, ValueType s32, SDPatternOperator ImmOp, 19*e8d8bef9SDimitry Andric SDNodeXForm ImmCast, SDNodeXForm SuperRegCast> { 20*e8d8bef9SDimitry Andric // VBRDil 21*e8d8bef9SDimitry Andric def : Pat<(v32 (vec_broadcast (s32 ImmOp:$sy), i32:$vl)), 22*e8d8bef9SDimitry Andric (VBRDil (ImmCast $sy), i32:$vl)>; 23*e8d8bef9SDimitry Andric 24*e8d8bef9SDimitry Andric // VBRDrl 25*e8d8bef9SDimitry Andric def : Pat<(v32 (vec_broadcast s32:$sy, i32:$vl)), 26*e8d8bef9SDimitry Andric (VBRDrl (SuperRegCast $sy), i32:$vl)>; 27*e8d8bef9SDimitry Andric} 28*e8d8bef9SDimitry Andric 29*e8d8bef9SDimitry Andricmulticlass vbrd_elem64<ValueType v64, ValueType s64, 30*e8d8bef9SDimitry Andric SDPatternOperator ImmOp, SDNodeXForm ImmCast> { 31*e8d8bef9SDimitry Andric // VBRDil 32*e8d8bef9SDimitry Andric def : Pat<(v64 (vec_broadcast (s64 ImmOp:$sy), i32:$vl)), 33*e8d8bef9SDimitry Andric (VBRDil (ImmCast $sy), i32:$vl)>; 34*e8d8bef9SDimitry Andric 35*e8d8bef9SDimitry Andric // VBRDrl 36*e8d8bef9SDimitry Andric def : Pat<(v64 (vec_broadcast s64:$sy, i32:$vl)), 37*e8d8bef9SDimitry Andric (VBRDrl s64:$sy, i32:$vl)>; 38*e8d8bef9SDimitry Andric} 39*e8d8bef9SDimitry Andric 40*e8d8bef9SDimitry Andricmulticlass extract_insert_elem32<ValueType v32, ValueType s32, 41*e8d8bef9SDimitry Andric SDNodeXForm SubRegCast, 42*e8d8bef9SDimitry Andric SDNodeXForm SuperRegCast> { 43*e8d8bef9SDimitry Andric // LVSvi 44*e8d8bef9SDimitry Andric def: Pat<(s32 (extractelt v32:$vec, uimm7:$idx)), 45*e8d8bef9SDimitry Andric (SubRegCast (LVSvi v32:$vec, (ULO7 $idx)))>; 46*e8d8bef9SDimitry Andric // LVSvr 47*e8d8bef9SDimitry Andric def: Pat<(s32 (extractelt v32:$vec, i64:$idx)), 48*e8d8bef9SDimitry Andric (SubRegCast (LVSvr v32:$vec, $idx))>; 49*e8d8bef9SDimitry Andric 50*e8d8bef9SDimitry Andric // LSVir 51*e8d8bef9SDimitry Andric def: Pat<(v32 (insertelt v32:$vec, s32:$val, uimm7:$idx)), 52*e8d8bef9SDimitry Andric (LSVir_v (ULO7 $idx), (SuperRegCast $val), $vec)>; 53*e8d8bef9SDimitry Andric // LSVrr 54*e8d8bef9SDimitry Andric def: Pat<(v32 (insertelt v32:$vec, s32:$val, i64:$idx)), 55*e8d8bef9SDimitry Andric (LSVrr_v $idx, (SuperRegCast $val), $vec)>; 56*e8d8bef9SDimitry Andric} 57*e8d8bef9SDimitry Andric 58*e8d8bef9SDimitry Andricmulticlass extract_insert_elem64<ValueType v64, ValueType s64> { 59*e8d8bef9SDimitry Andric // LVSvi 60*e8d8bef9SDimitry Andric def: Pat<(s64 (extractelt v64:$vec, uimm7:$idx)), 61*e8d8bef9SDimitry Andric (LVSvi v64:$vec, (ULO7 $idx))>; 62*e8d8bef9SDimitry Andric // LVSvr 63*e8d8bef9SDimitry Andric def: Pat<(s64 (extractelt v64:$vec, i64:$idx)), 64*e8d8bef9SDimitry Andric (LVSvr v64:$vec, $idx)>; 65*e8d8bef9SDimitry Andric 66*e8d8bef9SDimitry Andric // LSVir 67*e8d8bef9SDimitry Andric def: Pat<(v64 (insertelt v64:$vec, s64:$val, uimm7:$idx)), 68*e8d8bef9SDimitry Andric (LSVir_v (ULO7 $idx), $val, $vec)>; 69*e8d8bef9SDimitry Andric // LSVrr 70*e8d8bef9SDimitry Andric def: Pat<(v64 (insertelt v64:$vec, s64:$val, i64:$idx)), 71*e8d8bef9SDimitry Andric (LSVrr_v $idx, $val, $vec)>; 72*e8d8bef9SDimitry Andric} 73*e8d8bef9SDimitry Andric 74*e8d8bef9SDimitry Andricmulticlass patterns_elem32<ValueType v32, ValueType s32, 75*e8d8bef9SDimitry Andric SDPatternOperator ImmOp, SDNodeXForm ImmCast, 76*e8d8bef9SDimitry Andric SDNodeXForm SubRegCast, SDNodeXForm SuperRegCast> { 77*e8d8bef9SDimitry Andric defm : vbrd_elem32<v32, s32, ImmOp, ImmCast, SuperRegCast>; 78*e8d8bef9SDimitry Andric defm : extract_insert_elem32<v32, s32, SubRegCast, SuperRegCast>; 79*e8d8bef9SDimitry Andric} 80*e8d8bef9SDimitry Andric 81*e8d8bef9SDimitry Andricmulticlass patterns_elem64<ValueType v64, ValueType s64, 82*e8d8bef9SDimitry Andric SDPatternOperator ImmOp, SDNodeXForm ImmCast> { 83*e8d8bef9SDimitry Andric defm : vbrd_elem64<v64, s64, ImmOp, ImmCast>; 84*e8d8bef9SDimitry Andric defm : extract_insert_elem64<v64, s64>; 85*e8d8bef9SDimitry Andric} 86*e8d8bef9SDimitry Andric 87*e8d8bef9SDimitry Andricdefm : patterns_elem32<v256i32, i32, simm7, LO7, l2i, i2l>; 88*e8d8bef9SDimitry Andricdefm : patterns_elem32<v256f32, f32, simm7fp, LO7FP, l2f, f2l>; 89*e8d8bef9SDimitry Andric 90*e8d8bef9SDimitry Andricdefm : patterns_elem64<v256i64, i64, simm7, LO7>; 91*e8d8bef9SDimitry Andricdefm : patterns_elem64<v256f64, f64, simm7fp, LO7FP>; 92