1 //===-- SIInstrFormats.td - SI Instruction Formats ------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // SI Instruction format definitions.
12 // Instructions with _32 take 32-bit operands.
13 // Instructions with _64 take 64-bit operands.
15 // VOP_* instructions can use either a 32-bit or 64-bit encoding. The 32-bit
16 // encoding is the standard encoding, but instruction that make use of
17 // any of the instruction modifiers must use the 64-bit encoding.
19 // Instructions with _e32 use the 32-bit encoding.
20 // Instructions with _e64 use the 64-bit encoding.
22 //===----------------------------------------------------------------------===//
25 class VOP3_32 <bits<9> op, string opName, list<dag> pattern>
26 : VOP3 <op, (outs VReg_32:$dst), (ins AllReg_32:$src0, AllReg_32:$src1, AllReg_32:$src2, i32imm:$src3, i32imm:$src4, i32imm:$src5, i32imm:$src6), opName, pattern>;
28 class VOP3_64 <bits<9> op, string opName, list<dag> pattern>
29 : VOP3 <op, (outs VReg_64:$dst), (ins AllReg_64:$src0, AllReg_64:$src1, AllReg_64:$src2, i32imm:$src3, i32imm:$src4, i32imm:$src5, i32imm:$src6), opName, pattern>;
32 class SOP1_32 <bits<8> op, string opName, list<dag> pattern>
33 : SOP1 <op, (outs SReg_32:$dst), (ins SReg_32:$src0), opName, pattern>;
35 class SOP1_64 <bits<8> op, string opName, list<dag> pattern>
36 : SOP1 <op, (outs SReg_64:$dst), (ins SReg_64:$src0), opName, pattern>;
38 class SOP2_32 <bits<7> op, string opName, list<dag> pattern>
39 : SOP2 <op, (outs SReg_32:$dst), (ins SReg_32:$src0, SReg_32:$src1), opName, pattern>;
41 class SOP2_64 <bits<7> op, string opName, list<dag> pattern>
42 : SOP2 <op, (outs SReg_64:$dst), (ins SReg_64:$src0, SReg_64:$src1), opName, pattern>;
44 class VOP1_Helper <bits<8> op, RegisterClass vrc, RegisterClass arc,
45 string opName, list<dag> pattern> :
47 op, (outs vrc:$dst), (ins arc:$src0), opName, pattern
50 multiclass VOP1_32 <bits<8> op, string opName, list<dag> pattern> {
51 def _e32: VOP1_Helper <op, VReg_32, AllReg_32, opName, pattern>;
52 def _e64 : VOP3_32 <{1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
57 multiclass VOP1_64 <bits<8> op, string opName, list<dag> pattern> {
59 def _e32 : VOP1_Helper <op, VReg_64, AllReg_64, opName, pattern>;
62 {1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
67 class VOP2_Helper <bits<6> op, RegisterClass vrc, RegisterClass arc,
68 string opName, list<dag> pattern> :
70 op, (outs vrc:$dst), (ins arc:$src0, vrc:$src1), opName, pattern
73 multiclass VOP2_32 <bits<6> op, string opName, list<dag> pattern> {
75 def _e32 : VOP2_Helper <op, VReg_32, AllReg_32, opName, pattern>;
77 def _e64 : VOP3_32 <{1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
82 multiclass VOP2_64 <bits<6> op, string opName, list<dag> pattern> {
83 def _e32: VOP2_Helper <op, VReg_64, AllReg_64, opName, pattern>;
86 {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
91 class SOPK_32 <bits<5> op, string opName, list<dag> pattern>
92 : SOPK <op, (outs SReg_32:$dst), (ins i16imm:$src0), opName, pattern>;
94 class SOPK_64 <bits<5> op, string opName, list<dag> pattern>
95 : SOPK <op, (outs SReg_64:$dst), (ins i16imm:$src0), opName, pattern>;
97 class VOPC_Helper <bits<8> op, RegisterClass vrc, RegisterClass arc,
98 string opName, list<dag> pattern> :
100 op, (outs), (ins arc:$src0, vrc:$src1), opName, pattern
103 multiclass VOPC_32 <bits<8> op, string opName, list<dag> pattern> {
105 def _e32 : VOPC_Helper <op, VReg_32, AllReg_32, opName, pattern>;
108 {0, op{7}, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
113 multiclass VOPC_64 <bits<8> op, string opName, list<dag> pattern> {
115 def _e32 : VOPC_Helper <op, VReg_64, AllReg_64, opName, pattern>;
118 {0, op{7}, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}},
123 class SOPC_32 <bits<7> op, string opName, list<dag> pattern>
124 : SOPC <op, (outs CCReg:$dst), (ins SReg_32:$src0, SReg_32:$src1), opName, pattern>;
126 class SOPC_64 <bits<7> op, string opName, list<dag> pattern>
127 : SOPC <op, (outs CCReg:$dst), (ins SReg_64:$src0, SReg_64:$src1), opName, pattern>;