1 //===-- VEInstrFormats.td - VE Instruction Formats ---------*- tablegen -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // SX-Aurora uses little endian, but instructions are encoded little bit
10 // different manner. Therefore, we need to tranlate the address of each
11 // bitfield described in ISA documentation like below.
13 // ISA | InstrFormats.td
14 // ---------------------------
19 //===----------------------------------------------------------------------===//
21 //===----------------------------------------------------------------------===//
23 class InstVE<dag outs, dag ins, string asmstr, list<dag> pattern>
33 dag OutOperandList = outs;
34 dag InOperandList = ins;
35 let AsmString = asmstr;
36 let Pattern = pattern;
38 bits<1> VE_Vector = 0;
39 bits<1> VE_VLInUse = 0;
40 bits<3> VE_VLIndex = 0;
41 bits<1> VE_VLWithMask = 0;
43 /// These fields correspond to the fields in VEInstrInfo.h. Any changes to
44 /// these must be reflected there! See comments there for what these are.
46 /// VLIndex is the index of VL register in MI's operands. The HW instruction
47 /// doesn't have that field, but we add is in MI for the ease of optimization.
48 /// For example, the index of VL of (VST $sy, $sz, $sx, $vl) is 3 (beginning
49 /// from 0), and the index of VL of (VST $sy, $sz, $sx, $vm, $vl) is 4. We
50 /// define vector instructions hierarchically, so use VE_VLIndex which is
51 /// defined by the type of instruction and VE_VLWithMask which is defined
52 /// whether the insturction use mask or not.
53 let TSFlags{0} = VE_Vector;
54 let TSFlags{1} = VE_VLInUse;
55 let TSFlags{4-2} = !add(VE_VLIndex, VE_VLWithMask);
57 let DecoderNamespace = "VE";
58 field bits<64> SoftFail = 0;
61 //-----------------------------------------------------------------------------
62 // Section 5.1 RM Type
64 // RM type has sx, sy, sz, and imm32.
65 // The effective address is generated by sz + sy + imm32.
66 //-----------------------------------------------------------------------------
68 class RM<bits<8>opVal, dag outs, dag ins, string asmstr, list<dag> pattern = []>
69 : InstVE<outs, ins, asmstr, pattern> {
73 bits<7> sz; // defines sz prior to sy to assign from sz
84 let Inst{31-0} = imm32;
87 //-----------------------------------------------------------------------------
88 // Section 5.2 RRM Type
90 // RRM type is identical to RM, but the effective address is generated
91 // by sz + imm32. The sy field is used by other purposes.
92 //-----------------------------------------------------------------------------
94 class RRM<bits<8>opVal, dag outs, dag ins, string asmstr,
95 list<dag> pattern = []>
96 : RM<opVal, outs, ins, asmstr, pattern>;
98 // RRMHM type is to load/store host memory
99 // It is similar to RRM and not use sy.
100 class RRMHM<bits<8>opVal, dag outs, dag ins, string asmstr,
101 list<dag> pattern = []>
102 : RRM<opVal, outs, ins, asmstr, pattern> {
109 //-----------------------------------------------------------------------------
110 // Section 5.3 CF Type
112 // CF type is used for control flow.
113 //-----------------------------------------------------------------------------
115 class CF<bits<8>opVal, dag outs, dag ins, string asmstr, list<dag> pattern = []>
116 : InstVE<outs, ins, asmstr, pattern> {
129 let Inst{53-52} = bpf;
130 let Inst{51-48} = cond;
132 let Inst{46-40} = sy;
134 let Inst{38-32} = sz;
135 let Inst{31-0} = imm32;
138 //-----------------------------------------------------------------------------
139 // Section 5.4 RR Type
141 // RR type is for generic arithmetic instructions.
142 //-----------------------------------------------------------------------------
144 class RR<bits<8>opVal, dag outs, dag ins, string asmstr, list<dag> pattern = []>
145 : InstVE<outs, ins, asmstr, pattern> {
151 bits<7> sz; // m field places at the top sz field
159 let Inst{54-48} = sx;
161 let Inst{46-40} = sy;
163 let Inst{38-32} = sz;
164 let Inst{31-24} = vx;
173 // RRFENCE type is special RR type for a FENCE instruction.
174 class RRFENCE<bits<8>opVal, dag outs, dag ins, string asmstr,
175 list<dag> pattern = []>
176 : InstVE<outs, ins, asmstr, pattern> {
195 //-----------------------------------------------------------------------------
196 // Section 5.5 RW Type
197 //-----------------------------------------------------------------------------
199 //-----------------------------------------------------------------------------
200 // Section 5.6 RVM Type
202 // RVM type is for vector transfer instructions.
203 //-----------------------------------------------------------------------------
205 class RVM<bits<8>opVal, dag outs, dag ins, string asmstr,
206 list<dag> pattern = []>
207 : InstVE<outs, ins, asmstr, pattern> {
226 let Inst{46-40} = sy;
228 let Inst{38-32} = sz;
229 let Inst{31-24} = vx;
230 let Inst{23-16} = vy;
238 //-----------------------------------------------------------------------------
239 // Section 5.7 RV Type
241 // RV type is for vector instructions.
242 //-----------------------------------------------------------------------------
244 class RV<bits<8>opVal, dag outs, dag ins, string asmstr, list<dag> pattern = []>
245 : InstVE<outs, ins, asmstr, pattern> {
266 let Inst{46-40} = sy;
268 let Inst{38-32} = sz;
269 let Inst{31-24} = vx;
270 let Inst{23-16} = vy;
277 // Pseudo instructions.
278 class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern = []>
279 : InstVE<outs, ins, asmstr, pattern> {
280 let isCodeGenOnly = 1;