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