Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 1 | //===- ARMInstrFormats.td - ARM Instruction Formats --*- tablegen -*---------=// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | //===----------------------------------------------------------------------===// |
| 11 | // |
| 12 | // ARM Instruction Format Definitions. |
| 13 | // |
| 14 | |
| 15 | // Format specifies the encoding used by the instruction. This is part of the |
| 16 | // ad-hoc solution used to emit machine instruction encodings by our machine |
| 17 | // code emitter. |
| 18 | class Format<bits<5> val> { |
| 19 | bits<5> Value = val; |
| 20 | } |
| 21 | |
| 22 | def Pseudo : Format<1>; |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 23 | def MulFrm1 : Format<2>; |
| 24 | def MulFrm2 : Format<3>; |
| 25 | def MulSMLAW : Format<4>; |
| 26 | def MulSMULW : Format<5>; |
| 27 | def MulSMLA : Format<6>; |
| 28 | def MulSMUL : Format<7>; |
| 29 | def Branch : Format<8>; |
| 30 | def BranchMisc : Format<9>; |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 31 | |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 32 | def DPFrm : Format<10>; |
| 33 | def DPSoRegFrm : Format<11>; |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 34 | |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 35 | def LdFrm : Format<12>; |
| 36 | def StFrm : Format<13>; |
| 37 | def LdMiscFrm : Format<14>; |
| 38 | def StMiscFrm : Format<15>; |
| 39 | def LdMulFrm : Format<16>; |
| 40 | def StMulFrm : Format<17>; |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 41 | |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 42 | def ArithMisc : Format<18>; |
| 43 | def ThumbFrm : Format<19>; |
| 44 | def VFPFrm : Format<20>; |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 45 | |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 46 | // Misc flag for data processing instructions that indicates whether |
| 47 | // the instruction has a Rn register operand. |
| 48 | class UnaryDP { bit isUnaryDataProc = 1; } |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 49 | |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 50 | //===----------------------------------------------------------------------===// |
| 51 | |
| 52 | // ARM Instruction templates. |
| 53 | // |
| 54 | |
| 55 | class InstARM<bits<4> opcod, AddrMode am, SizeFlagVal sz, IndexMode im, |
| 56 | Format f, string cstr> |
| 57 | : Instruction { |
Evan Cheng | d075035 | 2008-08-29 07:40:52 +0000 | [diff] [blame] | 58 | field bits<32> Inst; |
| 59 | |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 60 | let Namespace = "ARM"; |
| 61 | |
| 62 | bits<4> Opcode = opcod; |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 63 | |
| 64 | // TSFlagsFields |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 65 | AddrMode AM = am; |
| 66 | bits<4> AddrModeBits = AM.Value; |
| 67 | |
| 68 | SizeFlagVal SZ = sz; |
| 69 | bits<3> SizeFlag = SZ.Value; |
| 70 | |
| 71 | IndexMode IM = im; |
| 72 | bits<2> IndexModeBits = IM.Value; |
| 73 | |
| 74 | Format F = f; |
| 75 | bits<5> Form = F.Value; |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 76 | |
| 77 | // |
| 78 | // Attributes specific to ARM instructions... |
| 79 | // |
| 80 | bit isUnaryDataProc = 0; |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 81 | |
| 82 | let Constraints = cstr; |
| 83 | } |
| 84 | |
| 85 | class PseudoInst<dag oops, dag iops, string asm, list<dag> pattern> |
| 86 | : InstARM<0, AddrModeNone, SizeSpecial, IndexModeNone, Pseudo, ""> { |
| 87 | let OutOperandList = oops; |
| 88 | let InOperandList = iops; |
| 89 | let AsmString = asm; |
| 90 | let Pattern = pattern; |
| 91 | } |
| 92 | |
| 93 | // Almost all ARM instructions are predicable. |
| 94 | class I<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz, |
| 95 | IndexMode im, Format f, string opc, string asm, string cstr, |
| 96 | list<dag> pattern> |
| 97 | : InstARM<opcod, am, sz, im, f, cstr> { |
| 98 | let OutOperandList = oops; |
| 99 | let InOperandList = !con(iops, (ops pred:$p)); |
| 100 | let AsmString = !strconcat(opc, !strconcat("${p}", asm)); |
| 101 | let Pattern = pattern; |
| 102 | list<Predicate> Predicates = [IsARM]; |
| 103 | } |
| 104 | |
| 105 | // Same as I except it can optionally modify CPSR. Note it's modeled as |
| 106 | // an input operand since by default it's a zero register. It will |
| 107 | // become an implicit def once it's "flipped". |
| 108 | class sI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz, |
| 109 | IndexMode im, Format f, string opc, string asm, string cstr, |
| 110 | list<dag> pattern> |
| 111 | : InstARM<opcod, am, sz, im, f, cstr> { |
| 112 | let OutOperandList = oops; |
| 113 | let InOperandList = !con(iops, (ops pred:$p, cc_out:$s)); |
| 114 | let AsmString = !strconcat(opc, !strconcat("${p}${s}", asm)); |
| 115 | let Pattern = pattern; |
| 116 | list<Predicate> Predicates = [IsARM]; |
| 117 | } |
| 118 | |
Evan Cheng | c5409a8 | 2008-09-01 07:19:00 +0000 | [diff] [blame] | 119 | // Special cases |
| 120 | class XI<bits<4> opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz, |
| 121 | IndexMode im, Format f, string asm, string cstr, list<dag> pattern> |
| 122 | : InstARM<opcod, am, sz, im, f, cstr> { |
| 123 | let OutOperandList = oops; |
| 124 | let InOperandList = iops; |
| 125 | let AsmString = asm; |
| 126 | let Pattern = pattern; |
| 127 | list<Predicate> Predicates = [IsARM]; |
| 128 | } |
| 129 | |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 130 | class AI<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 131 | string asm, list<dag> pattern> |
| 132 | : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc, |
| 133 | asm,"",pattern>; |
| 134 | class AsI<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 135 | string asm, list<dag> pattern> |
| 136 | : sI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc, |
| 137 | asm,"",pattern>; |
Evan Cheng | c5409a8 | 2008-09-01 07:19:00 +0000 | [diff] [blame] | 138 | class AXI<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 139 | list<dag> pattern> |
| 140 | : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm, |
| 141 | "", pattern>; |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 142 | |
| 143 | // Ctrl flow instructions |
| 144 | class ABLpredI<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 145 | string asm, list<dag> pattern> |
| 146 | : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc, |
| 147 | asm,"",pattern> { |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 148 | let Inst{27-24} = opcod; |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 149 | } |
| 150 | class ABLI<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 151 | list<dag> pattern> |
| 152 | : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm, |
| 153 | "", pattern> { |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 154 | let Inst{27-24} = opcod; |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 155 | } |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 156 | // FIXME: BX |
Evan Cheng | c5409a8 | 2008-09-01 07:19:00 +0000 | [diff] [blame] | 157 | class AXIx2<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 158 | list<dag> pattern> |
| 159 | : XI<opcod, oops, iops, AddrModeNone, Size8Bytes, IndexModeNone, f, asm, |
| 160 | "", pattern>; |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 161 | class ABI<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 162 | list<dag> pattern> |
| 163 | : XI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, asm, |
| 164 | "", pattern> { |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 165 | let Inst{27-24} = opcod; |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 166 | } |
| 167 | class ABccI<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 168 | string asm, list<dag> pattern> |
| 169 | : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, f, opc, |
| 170 | asm,"",pattern> { |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 171 | let Inst{27-24} = opcod; |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | // BR_JT instructions |
| 175 | // == mov pc |
| 176 | class JTI<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern> |
| 177 | : XI<opcod, oops, iops, AddrModeNone, SizeSpecial, IndexModeNone, BranchMisc, |
| 178 | asm, "", pattern> { |
| 179 | let Inst{20} = 0; // S Bit |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 180 | let Inst{24-21} = opcod; |
| 181 | let Inst{27-26} = {0,0}; |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 182 | } |
Evan Cheng | 18e5d10 | 2008-09-17 07:16:21 +0000 | [diff] [blame] | 183 | // == add pc |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 184 | class JTI1<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern> |
| 185 | : XI<opcod, oops, iops, AddrMode1, SizeSpecial, IndexModeNone, BranchMisc, |
| 186 | asm, "", pattern> { |
Evan Cheng | 18e5d10 | 2008-09-17 07:16:21 +0000 | [diff] [blame] | 187 | let Inst{20} = 0; // S bit |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 188 | let Inst{24-21} = opcod; |
| 189 | let Inst{27-26} = {0,0}; |
Evan Cheng | 18e5d10 | 2008-09-17 07:16:21 +0000 | [diff] [blame] | 190 | } |
| 191 | // == ldr pc |
| 192 | class JTI2<bits<4> opcod, dag oops, dag iops, string asm, list<dag> pattern> |
| 193 | : XI<opcod, oops, iops, AddrMode2, SizeSpecial, IndexModeNone, BranchMisc, |
| 194 | asm, "", pattern> { |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 195 | let Inst{20} = 1; // L bit |
| 196 | let Inst{21} = 0; // W bit |
| 197 | let Inst{22} = 0; // B bit |
| 198 | let Inst{24} = 1; // P bit |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 199 | let Inst{27-26} = {0,1}; |
Evan Cheng | 10a9eb8 | 2008-09-01 08:25:56 +0000 | [diff] [blame] | 200 | } |
| 201 | |
Evan Cheng | 2e62b66 | 2008-09-01 01:51:14 +0000 | [diff] [blame] | 202 | |
| 203 | // addrmode1 instructions |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 204 | class AI1<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 205 | string asm, list<dag> pattern> |
| 206 | : I<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc, |
Evan Cheng | d075035 | 2008-08-29 07:40:52 +0000 | [diff] [blame] | 207 | asm, "", pattern> { |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 208 | let Inst{24-21} = opcod; |
| 209 | let Inst{27-26} = {0,0}; |
Evan Cheng | d075035 | 2008-08-29 07:40:52 +0000 | [diff] [blame] | 210 | } |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 211 | class AsI1<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 212 | string asm, list<dag> pattern> |
| 213 | : sI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, opc, |
Evan Cheng | d075035 | 2008-08-29 07:40:52 +0000 | [diff] [blame] | 214 | asm, "", pattern> { |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 215 | let Inst{24-21} = opcod; |
| 216 | let Inst{27-26} = {0,0}; |
Evan Cheng | d075035 | 2008-08-29 07:40:52 +0000 | [diff] [blame] | 217 | } |
Evan Cheng | c5409a8 | 2008-09-01 07:19:00 +0000 | [diff] [blame] | 218 | class AXI1<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 219 | list<dag> pattern> |
| 220 | : XI<opcod, oops, iops, AddrMode1, Size4Bytes, IndexModeNone, f, asm, |
| 221 | "", pattern> { |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 222 | let Inst{24-21} = opcod; |
| 223 | let Inst{27-26} = {0,0}; |
Evan Cheng | c5409a8 | 2008-09-01 07:19:00 +0000 | [diff] [blame] | 224 | } |
Evan Cheng | 2e62b66 | 2008-09-01 01:51:14 +0000 | [diff] [blame] | 225 | class AI1x2<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 226 | string asm, list<dag> pattern> |
| 227 | : I<opcod, oops, iops, AddrMode1, Size8Bytes, IndexModeNone, f, opc, |
| 228 | asm, "", pattern>; |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 229 | |
Evan Cheng | 2e62b66 | 2008-09-01 01:51:14 +0000 | [diff] [blame] | 230 | |
| 231 | // addrmode2 loads and stores |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 232 | class AI2<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 233 | string asm, list<dag> pattern> |
| 234 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc, |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 235 | asm, "", pattern> { |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 236 | let Inst{27-26} = {0,1}; |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 237 | } |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 238 | |
| 239 | // loads |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 240 | class AI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 241 | string asm, list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 242 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc, |
| 243 | asm, "", pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 244 | let Inst{20} = 1; // L bit |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 245 | let Inst{21} = 0; // W bit |
| 246 | let Inst{22} = 0; // B bit |
| 247 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 248 | let Inst{27-26} = {0,1}; |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 249 | } |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 250 | class AXI2ldw<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 251 | list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 252 | : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, |
| 253 | asm, "", pattern> { |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 254 | let Inst{20} = 1; // L bit |
| 255 | let Inst{21} = 0; // W bit |
| 256 | let Inst{22} = 0; // B bit |
| 257 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 258 | let Inst{27-26} = {0,1}; |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 259 | } |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 260 | class AI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 261 | string asm, list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 262 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc, |
| 263 | asm, "", pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 264 | let Inst{20} = 1; // L bit |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 265 | let Inst{21} = 0; // W bit |
| 266 | let Inst{22} = 1; // B bit |
| 267 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 268 | let Inst{27-26} = {0,1}; |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 269 | } |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 270 | class AXI2ldb<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 271 | list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 272 | : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, |
| 273 | asm, "", pattern> { |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 274 | let Inst{20} = 1; // L bit |
| 275 | let Inst{21} = 0; // W bit |
| 276 | let Inst{22} = 1; // B bit |
| 277 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 278 | let Inst{27-26} = {0,1}; |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 279 | } |
Evan Cheng | da02002 | 2008-08-31 19:02:21 +0000 | [diff] [blame] | 280 | |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 281 | // stores |
| 282 | class AI2stw<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 283 | string asm, list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 284 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc, |
| 285 | asm, "", pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 286 | let Inst{20} = 0; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 287 | let Inst{21} = 0; // W bit |
| 288 | let Inst{22} = 0; // B bit |
| 289 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 290 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 291 | } |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 292 | class AXI2stw<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 293 | list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 294 | : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, |
| 295 | asm, "", pattern> { |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 296 | let Inst{20} = 0; // L bit |
| 297 | let Inst{21} = 0; // W bit |
| 298 | let Inst{22} = 0; // B bit |
| 299 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 300 | let Inst{27-26} = {0,1}; |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 301 | } |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 302 | class AI2stb<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 303 | string asm, list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 304 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, opc, |
| 305 | asm, "", pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 306 | let Inst{20} = 0; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 307 | let Inst{21} = 0; // W bit |
| 308 | let Inst{22} = 1; // B bit |
| 309 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 310 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 311 | } |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 312 | class AXI2stb<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 313 | list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 314 | : XI<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModeNone, f, |
| 315 | asm, "", pattern> { |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 316 | let Inst{20} = 0; // L bit |
| 317 | let Inst{21} = 0; // W bit |
| 318 | let Inst{22} = 1; // B bit |
| 319 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 320 | let Inst{27-26} = {0,1}; |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 321 | } |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 322 | |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 323 | // Pre-indexed loads |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 324 | class AI2ldwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 325 | string asm, string cstr, list<dag> pattern> |
| 326 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc, |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 327 | asm, cstr, pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 328 | let Inst{20} = 1; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 329 | let Inst{21} = 1; // W bit |
| 330 | let Inst{22} = 0; // B bit |
| 331 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 332 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 333 | } |
| 334 | class AI2ldbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 335 | string asm, string cstr, list<dag> pattern> |
| 336 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc, |
| 337 | asm, cstr, pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 338 | let Inst{20} = 1; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 339 | let Inst{21} = 1; // W bit |
| 340 | let Inst{22} = 1; // B bit |
| 341 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 342 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 343 | } |
| 344 | |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 345 | // Pre-indexed stores |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 346 | class AI2stwpr<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 347 | string asm, string cstr, list<dag> pattern> |
| 348 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc, |
| 349 | asm, cstr, pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 350 | let Inst{20} = 0; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 351 | let Inst{21} = 1; // W bit |
| 352 | let Inst{22} = 0; // B bit |
| 353 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 354 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 355 | } |
| 356 | class AI2stbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 357 | string asm, string cstr, list<dag> pattern> |
| 358 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePre, f, opc, |
| 359 | asm, cstr, pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 360 | let Inst{20} = 0; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 361 | let Inst{21} = 1; // W bit |
| 362 | let Inst{22} = 1; // B bit |
| 363 | let Inst{24} = 1; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 364 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 365 | } |
| 366 | |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 367 | // Post-indexed loads |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 368 | class AI2ldwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 369 | string asm, string cstr, list<dag> pattern> |
| 370 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc, |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 371 | asm, cstr,pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 372 | let Inst{20} = 1; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 373 | let Inst{21} = 0; // W bit |
| 374 | let Inst{22} = 0; // B bit |
| 375 | let Inst{24} = 0; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 376 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 377 | } |
| 378 | class AI2ldbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 379 | string asm, string cstr, list<dag> pattern> |
| 380 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc, |
| 381 | asm, cstr,pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 382 | let Inst{20} = 1; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 383 | let Inst{21} = 0; // W bit |
| 384 | let Inst{22} = 1; // B bit |
| 385 | let Inst{24} = 0; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 386 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 387 | } |
| 388 | |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 389 | // Post-indexed stores |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 390 | class AI2stwpo<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 391 | string asm, string cstr, list<dag> pattern> |
| 392 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc, |
| 393 | asm, cstr,pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 394 | let Inst{20} = 0; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 395 | let Inst{21} = 0; // W bit |
| 396 | let Inst{22} = 0; // B bit |
| 397 | let Inst{24} = 0; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 398 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 399 | } |
| 400 | class AI2stbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 401 | string asm, string cstr, list<dag> pattern> |
| 402 | : I<opcod, oops, iops, AddrMode2, Size4Bytes, IndexModePost, f, opc, |
| 403 | asm, cstr,pattern> { |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 404 | let Inst{20} = 0; // L bit |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 405 | let Inst{21} = 0; // W bit |
| 406 | let Inst{22} = 1; // B bit |
| 407 | let Inst{24} = 0; // P bit |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 408 | let Inst{27-26} = {0,1}; |
Evan Cheng | 1a7c1cc | 2008-09-01 01:27:33 +0000 | [diff] [blame] | 409 | } |
| 410 | |
Evan Cheng | 2e62b66 | 2008-09-01 01:51:14 +0000 | [diff] [blame] | 411 | // addrmode3 instructions |
| 412 | class AI3<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 413 | string asm, list<dag> pattern> |
| 414 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc, |
| 415 | asm, "", pattern>; |
Evan Cheng | c5409a8 | 2008-09-01 07:19:00 +0000 | [diff] [blame] | 416 | class AXI3<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 417 | list<dag> pattern> |
| 418 | : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, asm, |
| 419 | "", pattern>; |
Evan Cheng | 2e62b66 | 2008-09-01 01:51:14 +0000 | [diff] [blame] | 420 | |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 421 | // loads |
| 422 | class AI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 423 | string asm, list<dag> pattern> |
| 424 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc, |
| 425 | asm, "", pattern> { |
| 426 | let Inst{4} = 1; |
| 427 | let Inst{5} = 1; // H bit |
| 428 | let Inst{6} = 0; // S bit |
| 429 | let Inst{7} = 1; |
| 430 | let Inst{20} = 1; // L bit |
| 431 | let Inst{21} = 0; // W bit |
| 432 | let Inst{24} = 1; // P bit |
| 433 | } |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 434 | class AXI3ldh<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 435 | list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 436 | : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, |
| 437 | asm, "", pattern> { |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 438 | let Inst{4} = 1; |
| 439 | let Inst{5} = 1; // H bit |
| 440 | let Inst{6} = 0; // S bit |
| 441 | let Inst{7} = 1; |
| 442 | let Inst{20} = 1; // L bit |
| 443 | let Inst{21} = 0; // W bit |
| 444 | let Inst{24} = 1; // P bit |
| 445 | } |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 446 | class AI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 447 | string asm, list<dag> pattern> |
| 448 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc, |
| 449 | asm, "", pattern> { |
| 450 | let Inst{4} = 1; |
| 451 | let Inst{5} = 1; // H bit |
| 452 | let Inst{6} = 1; // S bit |
| 453 | let Inst{7} = 1; |
| 454 | let Inst{20} = 1; // L bit |
| 455 | let Inst{21} = 0; // W bit |
| 456 | let Inst{24} = 1; // P bit |
| 457 | } |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 458 | class AXI3ldsh<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 459 | list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 460 | : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, |
| 461 | asm, "", pattern> { |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 462 | let Inst{4} = 1; |
| 463 | let Inst{5} = 1; // H bit |
| 464 | let Inst{6} = 1; // S bit |
| 465 | let Inst{7} = 1; |
| 466 | let Inst{20} = 1; // L bit |
| 467 | let Inst{21} = 0; // W bit |
| 468 | let Inst{24} = 1; // P bit |
| 469 | } |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 470 | class AI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 471 | string asm, list<dag> pattern> |
| 472 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc, |
| 473 | asm, "", pattern> { |
| 474 | let Inst{4} = 1; |
| 475 | let Inst{5} = 0; // H bit |
| 476 | let Inst{6} = 1; // S bit |
| 477 | let Inst{7} = 1; |
| 478 | let Inst{20} = 1; // L bit |
| 479 | let Inst{21} = 0; // W bit |
| 480 | let Inst{24} = 1; // P bit |
| 481 | } |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 482 | class AXI3ldsb<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 483 | list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 484 | : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, |
| 485 | asm, "", pattern> { |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 486 | let Inst{4} = 1; |
| 487 | let Inst{5} = 0; // H bit |
| 488 | let Inst{6} = 1; // S bit |
| 489 | let Inst{7} = 1; |
| 490 | let Inst{20} = 1; // L bit |
| 491 | let Inst{21} = 0; // W bit |
| 492 | let Inst{24} = 1; // P bit |
| 493 | } |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 494 | class AI3ldd<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 495 | string asm, list<dag> pattern> |
| 496 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc, |
| 497 | asm, "", pattern> { |
| 498 | let Inst{4} = 1; |
| 499 | let Inst{5} = 0; // H bit |
| 500 | let Inst{6} = 1; // S bit |
| 501 | let Inst{7} = 1; |
| 502 | let Inst{20} = 0; // L bit |
| 503 | let Inst{21} = 0; // W bit |
| 504 | let Inst{24} = 1; // P bit |
| 505 | } |
| 506 | |
| 507 | // stores |
| 508 | class AI3sth<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 509 | string asm, list<dag> pattern> |
| 510 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc, |
| 511 | asm, "", pattern> { |
| 512 | let Inst{4} = 1; |
| 513 | let Inst{5} = 1; // H bit |
| 514 | let Inst{6} = 0; // S bit |
| 515 | let Inst{7} = 1; |
| 516 | let Inst{20} = 0; // L bit |
| 517 | let Inst{21} = 0; // W bit |
| 518 | let Inst{24} = 1; // P bit |
| 519 | } |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 520 | class AXI3sth<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 521 | list<dag> pattern> |
Evan Cheng | c41fb315 | 2008-11-05 23:22:34 +0000 | [diff] [blame^] | 522 | : XI<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, |
| 523 | asm, "", pattern> { |
Evan Cheng | ae7b1d7 | 2008-09-01 07:34:13 +0000 | [diff] [blame] | 524 | let Inst{4} = 1; |
| 525 | let Inst{5} = 1; // H bit |
| 526 | let Inst{6} = 0; // S bit |
| 527 | let Inst{7} = 1; |
| 528 | let Inst{20} = 0; // L bit |
| 529 | let Inst{21} = 0; // W bit |
| 530 | let Inst{24} = 1; // P bit |
| 531 | } |
Evan Cheng | ac92c3f | 2008-09-01 07:00:14 +0000 | [diff] [blame] | 532 | class AI3std<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 533 | string asm, list<dag> pattern> |
| 534 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModeNone, f, opc, |
| 535 | asm, "", pattern> { |
| 536 | let Inst{4} = 1; |
| 537 | let Inst{5} = 1; // H bit |
| 538 | let Inst{6} = 1; // S bit |
| 539 | let Inst{7} = 1; |
| 540 | let Inst{20} = 0; // L bit |
| 541 | let Inst{21} = 0; // W bit |
| 542 | let Inst{24} = 1; // P bit |
| 543 | } |
| 544 | |
| 545 | // Pre-indexed loads |
| 546 | class AI3ldhpr<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 547 | string asm, string cstr, list<dag> pattern> |
| 548 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc, |
| 549 | asm, cstr, pattern> { |
| 550 | let Inst{4} = 1; |
| 551 | let Inst{5} = 1; // H bit |
| 552 | let Inst{6} = 0; // S bit |
| 553 | let Inst{7} = 1; |
| 554 | let Inst{20} = 1; // L bit |
| 555 | let Inst{21} = 1; // W bit |
| 556 | let Inst{24} = 1; // P bit |
| 557 | } |
| 558 | class AI3ldshpr<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 559 | string asm, string cstr, list<dag> pattern> |
| 560 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc, |
| 561 | asm, cstr, pattern> { |
| 562 | let Inst{4} = 1; |
| 563 | let Inst{5} = 1; // H bit |
| 564 | let Inst{6} = 1; // S bit |
| 565 | let Inst{7} = 1; |
| 566 | let Inst{20} = 1; // L bit |
| 567 | let Inst{21} = 1; // W bit |
| 568 | let Inst{24} = 1; // P bit |
| 569 | } |
| 570 | class AI3ldsbpr<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 571 | string asm, string cstr, list<dag> pattern> |
| 572 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc, |
| 573 | asm, cstr, pattern> { |
| 574 | let Inst{4} = 1; |
| 575 | let Inst{5} = 0; // H bit |
| 576 | let Inst{6} = 1; // S bit |
| 577 | let Inst{7} = 1; |
| 578 | let Inst{20} = 1; // L bit |
| 579 | let Inst{21} = 1; // W bit |
| 580 | let Inst{24} = 1; // P bit |
| 581 | } |
| 582 | |
| 583 | // Pre-indexed stores |
| 584 | class AI3sthpr<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 585 | string asm, string cstr, list<dag> pattern> |
| 586 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePre, f, opc, |
| 587 | asm, cstr, pattern> { |
| 588 | let Inst{4} = 1; |
| 589 | let Inst{5} = 1; // H bit |
| 590 | let Inst{6} = 0; // S bit |
| 591 | let Inst{7} = 1; |
| 592 | let Inst{20} = 0; // L bit |
| 593 | let Inst{21} = 1; // W bit |
| 594 | let Inst{24} = 1; // P bit |
| 595 | } |
| 596 | |
| 597 | // Post-indexed loads |
| 598 | class AI3ldhpo<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 599 | string asm, string cstr, list<dag> pattern> |
| 600 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc, |
| 601 | asm, cstr,pattern> { |
| 602 | let Inst{4} = 1; |
| 603 | let Inst{5} = 1; // H bit |
| 604 | let Inst{6} = 0; // S bit |
| 605 | let Inst{7} = 1; |
| 606 | let Inst{20} = 1; // L bit |
| 607 | let Inst{21} = 1; // W bit |
| 608 | let Inst{24} = 0; // P bit |
| 609 | } |
| 610 | class AI3ldshpo<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 611 | string asm, string cstr, list<dag> pattern> |
| 612 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc, |
| 613 | asm, cstr,pattern> { |
| 614 | let Inst{4} = 1; |
| 615 | let Inst{5} = 1; // H bit |
| 616 | let Inst{6} = 1; // S bit |
| 617 | let Inst{7} = 1; |
| 618 | let Inst{20} = 1; // L bit |
| 619 | let Inst{21} = 1; // W bit |
| 620 | let Inst{24} = 0; // P bit |
| 621 | } |
| 622 | class AI3ldsbpo<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 623 | string asm, string cstr, list<dag> pattern> |
| 624 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc, |
| 625 | asm, cstr,pattern> { |
| 626 | let Inst{4} = 1; |
| 627 | let Inst{5} = 0; // H bit |
| 628 | let Inst{6} = 1; // S bit |
| 629 | let Inst{7} = 1; |
| 630 | let Inst{20} = 1; // L bit |
| 631 | let Inst{21} = 1; // W bit |
| 632 | let Inst{24} = 0; // P bit |
| 633 | } |
| 634 | |
| 635 | // Post-indexed stores |
| 636 | class AI3sthpo<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 637 | string asm, string cstr, list<dag> pattern> |
| 638 | : I<opcod, oops, iops, AddrMode3, Size4Bytes, IndexModePost, f, opc, |
| 639 | asm, cstr,pattern> { |
| 640 | let Inst{4} = 1; |
| 641 | let Inst{5} = 1; // H bit |
| 642 | let Inst{6} = 0; // S bit |
| 643 | let Inst{7} = 1; |
| 644 | let Inst{20} = 0; // L bit |
| 645 | let Inst{21} = 1; // W bit |
| 646 | let Inst{24} = 0; // P bit |
| 647 | } |
| 648 | |
| 649 | |
Evan Cheng | 2e62b66 | 2008-09-01 01:51:14 +0000 | [diff] [blame] | 650 | // addrmode4 instructions |
| 651 | class AI4<bits<4> opcod, dag oops, dag iops, Format f, string opc, |
| 652 | string asm, list<dag> pattern> |
| 653 | : I<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, opc, |
Evan Cheng | d36b01c | 2008-09-01 07:48:18 +0000 | [diff] [blame] | 654 | asm, "", pattern> { |
Evan Cheng | 18e5d10 | 2008-09-17 07:16:21 +0000 | [diff] [blame] | 655 | let Inst{25-27} = {0,0,1}; |
Evan Cheng | d36b01c | 2008-09-01 07:48:18 +0000 | [diff] [blame] | 656 | } |
| 657 | class AXI4ld<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 658 | list<dag> pattern> |
| 659 | : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm, |
Evan Cheng | d36b01c | 2008-09-01 07:48:18 +0000 | [diff] [blame] | 660 | "", pattern> { |
| 661 | let Inst{20} = 1; // L bit |
| 662 | let Inst{22} = 0; // S bit |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 663 | let Inst{27-25} = 0b100; |
Evan Cheng | d36b01c | 2008-09-01 07:48:18 +0000 | [diff] [blame] | 664 | } |
| 665 | class AXI4ldpc<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 666 | list<dag> pattern> |
| 667 | : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm, |
| 668 | "", pattern> { |
| 669 | let Inst{20} = 1; // L bit |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 670 | let Inst{27-25} = 0b100; |
Evan Cheng | d36b01c | 2008-09-01 07:48:18 +0000 | [diff] [blame] | 671 | } |
| 672 | class AXI4st<bits<4> opcod, dag oops, dag iops, Format f, string asm, |
| 673 | list<dag> pattern> |
| 674 | : XI<opcod, oops, iops, AddrMode4, Size4Bytes, IndexModeNone, f, asm, |
| 675 | "", pattern> { |
| 676 | let Inst{20} = 0; // L bit |
| 677 | let Inst{22} = 0; // S bit |
Jim Grosbach | 88c246f | 2008-10-14 20:36:24 +0000 | [diff] [blame] | 678 | let Inst{27-25} = 0b100; |
Evan Cheng | d36b01c | 2008-09-01 07:48:18 +0000 | [diff] [blame] | 679 | } |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 680 | |
Jim Grosbach | 1feed04 | 2008-11-03 18:38:31 +0000 | [diff] [blame] | 681 | // Unsigned multiply, multiply-accumulate instructions. |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 682 | class AMul1I<bits<4> opcod, dag oops, dag iops, string opc, |
Jim Grosbach | 1feed04 | 2008-11-03 18:38:31 +0000 | [diff] [blame] | 683 | string asm, list<dag> pattern> |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 684 | : I<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm1, opc, |
| 685 | asm,"",pattern> { |
Jim Grosbach | 1feed04 | 2008-11-03 18:38:31 +0000 | [diff] [blame] | 686 | // FIXME: bits 7-4 should be a sub-mode (for SMLAxx, SMLAWy, ...) |
| 687 | let Inst{7-4} = 0b1001; |
| 688 | let Inst{27-24} = 0b0000; |
| 689 | let Inst{23-20} = opcod; |
| 690 | } |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 691 | class AsMul1I<bits<4> opcod, dag oops, dag iops, string opc, |
Jim Grosbach | 1feed04 | 2008-11-03 18:38:31 +0000 | [diff] [blame] | 692 | string asm, list<dag> pattern> |
Evan Cheng | 86a926a | 2008-11-05 18:35:52 +0000 | [diff] [blame] | 693 | : sI<opcod, oops, iops, AddrModeNone, Size4Bytes, IndexModeNone, MulFrm1, opc, |
| 694 | asm,"",pattern> { |
Jim Grosbach | 1feed04 | 2008-11-03 18:38:31 +0000 | [diff] [blame] | 695 | // FIXME: bits 7-4 should be a sub-mode (for SMLAxx, SMLAWy, ...) |
| 696 | let Inst{7-4} = 0b1001; |
| 697 | let Inst{27-24} = 0b0000; |
| 698 | let Inst{23-20} = opcod; |
| 699 | } |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 700 | |
Evan Cheng | 7b0249b | 2008-08-28 23:39:26 +0000 | [diff] [blame] | 701 | //===----------------------------------------------------------------------===// |
| 702 | |
| 703 | // ARMPat - Same as Pat<>, but requires that the compiler be in ARM mode. |
| 704 | class ARMPat<dag pattern, dag result> : Pat<pattern, result> { |
| 705 | list<Predicate> Predicates = [IsARM]; |
| 706 | } |
| 707 | class ARMV5TEPat<dag pattern, dag result> : Pat<pattern, result> { |
| 708 | list<Predicate> Predicates = [IsARM, HasV5TE]; |
| 709 | } |
| 710 | class ARMV6Pat<dag pattern, dag result> : Pat<pattern, result> { |
| 711 | list<Predicate> Predicates = [IsARM, HasV6]; |
| 712 | } |
Evan Cheng | 34a46e1 | 2008-08-29 06:41:12 +0000 | [diff] [blame] | 713 | |
| 714 | //===----------------------------------------------------------------------===// |
| 715 | // |
| 716 | // Thumb Instruction Format Definitions. |
| 717 | // |
| 718 | |
| 719 | |
| 720 | // TI - Thumb instruction. |
| 721 | |
| 722 | class ThumbI<dag outs, dag ins, AddrMode am, SizeFlagVal sz, |
| 723 | string asm, string cstr, list<dag> pattern> |
| 724 | // FIXME: Set all opcodes to 0 for now. |
| 725 | : InstARM<0, am, sz, IndexModeNone, ThumbFrm, cstr> { |
| 726 | let OutOperandList = outs; |
| 727 | let InOperandList = ins; |
| 728 | let AsmString = asm; |
| 729 | let Pattern = pattern; |
| 730 | list<Predicate> Predicates = [IsThumb]; |
| 731 | } |
| 732 | |
| 733 | class TI<dag outs, dag ins, string asm, list<dag> pattern> |
| 734 | : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "", pattern>; |
| 735 | class TI1<dag outs, dag ins, string asm, list<dag> pattern> |
| 736 | : ThumbI<outs, ins, AddrModeT1, Size2Bytes, asm, "", pattern>; |
| 737 | class TI2<dag outs, dag ins, string asm, list<dag> pattern> |
| 738 | : ThumbI<outs, ins, AddrModeT2, Size2Bytes, asm, "", pattern>; |
| 739 | class TI4<dag outs, dag ins, string asm, list<dag> pattern> |
| 740 | : ThumbI<outs, ins, AddrModeT4, Size2Bytes, asm, "", pattern>; |
| 741 | class TIs<dag outs, dag ins, string asm, list<dag> pattern> |
| 742 | : ThumbI<outs, ins, AddrModeTs, Size2Bytes, asm, "", pattern>; |
| 743 | |
| 744 | // Two-address instructions |
| 745 | class TIt<dag outs, dag ins, string asm, list<dag> pattern> |
| 746 | : ThumbI<outs, ins, AddrModeNone, Size2Bytes, asm, "$lhs = $dst", pattern>; |
| 747 | |
| 748 | // BL, BLX(1) are translated by assembler into two instructions |
| 749 | class TIx2<dag outs, dag ins, string asm, list<dag> pattern> |
| 750 | : ThumbI<outs, ins, AddrModeNone, Size4Bytes, asm, "", pattern>; |
| 751 | |
| 752 | // BR_JT instructions |
| 753 | class TJTI<dag outs, dag ins, string asm, list<dag> pattern> |
| 754 | : ThumbI<outs, ins, AddrModeNone, SizeSpecial, asm, "", pattern>; |
| 755 | |
| 756 | |
| 757 | //===----------------------------------------------------------------------===// |
| 758 | |
| 759 | |
| 760 | // ThumbPat - Same as Pat<>, but requires that the compiler be in Thumb mode. |
| 761 | class ThumbPat<dag pattern, dag result> : Pat<pattern, result> { |
| 762 | list<Predicate> Predicates = [IsThumb]; |
| 763 | } |
| 764 | |
| 765 | class ThumbV5Pat<dag pattern, dag result> : Pat<pattern, result> { |
| 766 | list<Predicate> Predicates = [IsThumb, HasV5T]; |
| 767 | } |