Misha Brukman | ffe9968 | 2005-02-05 02:24:26 +0000 | [diff] [blame] | 1 | //===- AlphaInstrFormats.td - Alpha Instruction Formats ----*- tablegen -*-===// |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | //3.3: |
| 14 | //Memory |
| 15 | //Branch |
| 16 | //Operate |
| 17 | //Floating-point |
| 18 | //PALcode |
| 19 | |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 20 | def u8imm : Operand<i64>; |
| 21 | def s14imm : Operand<i64>; |
| 22 | def s16imm : Operand<i64>; |
| 23 | def s21imm : Operand<i64>; |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 24 | def s64imm : Operand<i64>; |
| 25 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 26 | //===----------------------------------------------------------------------===// |
| 27 | // Instruction format superclass |
| 28 | //===----------------------------------------------------------------------===// |
Andrew Lenharth | 97a7fcf | 2005-11-09 19:17:08 +0000 | [diff] [blame] | 29 | // Alpha instruction baseline |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 30 | class InstAlpha<bits<6> op, string asmstr, InstrItinClass itin> : Instruction { |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 31 | field bits<32> Inst; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 32 | let Namespace = "Alpha"; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 33 | let AsmString = asmstr; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 34 | let Inst{31-26} = op; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 35 | let Itinerary = itin; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Andrew Lenharth | 97a7fcf | 2005-11-09 19:17:08 +0000 | [diff] [blame] | 38 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 39 | //3.3.1 |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 40 | class MForm<bits<6> opcode, bit store, bit load, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 41 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 636e1ae | 2005-12-24 03:41:56 +0000 | [diff] [blame] | 42 | let Pattern = pattern; |
Andrew Lenharth | b9aaea3 | 2005-12-24 07:34:33 +0000 | [diff] [blame] | 43 | let isStore = store; |
| 44 | let isLoad = load; |
Andrew Lenharth | 153f808 | 2006-01-26 03:22:07 +0000 | [diff] [blame] | 45 | let Defs = [R28]; //We may use this for frame index calculations, so reserve it here |
Andrew Lenharth | 636e1ae | 2005-12-24 03:41:56 +0000 | [diff] [blame] | 46 | |
| 47 | bits<5> Ra; |
| 48 | bits<16> disp; |
| 49 | bits<5> Rb; |
| 50 | |
| 51 | let Inst{25-21} = Ra; |
| 52 | let Inst{20-16} = Rb; |
| 53 | let Inst{15-0} = disp; |
| 54 | } |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 55 | class MfcForm<bits<6> opcode, bits<16> fc, string asmstr, InstrItinClass itin> |
| 56 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 01aa563 | 2005-11-11 16:47:30 +0000 | [diff] [blame] | 57 | bits<5> Ra; |
Andrew Lenharth | 01aa563 | 2005-11-11 16:47:30 +0000 | [diff] [blame] | 58 | |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 59 | let OperandList = (ops GPRC:$RA); |
Andrew Lenharth | 01aa563 | 2005-11-11 16:47:30 +0000 | [diff] [blame] | 60 | let Inst{25-21} = Ra; |
Andrew Lenharth | 34380b7 | 2006-01-16 21:22:38 +0000 | [diff] [blame] | 61 | let Inst{20-16} = 0; |
Andrew Lenharth | 01aa563 | 2005-11-11 16:47:30 +0000 | [diff] [blame] | 62 | let Inst{15-0} = fc; |
| 63 | } |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 64 | |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 65 | class MbrForm<bits<6> opcode, bits<2> TB, dag OL, string asmstr, InstrItinClass itin> |
| 66 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 67 | bits<5> Ra; |
| 68 | bits<5> Rb; |
| 69 | bits<14> disp; |
| 70 | |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 71 | let OperandList = OL; |
| 72 | |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 73 | let Inst{25-21} = Ra; |
| 74 | let Inst{20-16} = Rb; |
| 75 | let Inst{15-14} = TB; |
| 76 | let Inst{13-0} = disp; |
| 77 | } |
| 78 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 79 | //3.3.2 |
Andrew Lenharth | f520093 | 2005-12-25 17:36:48 +0000 | [diff] [blame] | 80 | def target : Operand<OtherVT> {} |
Andrew Lenharth | 29b7ef0 | 2005-12-06 20:40:34 +0000 | [diff] [blame] | 81 | let isBranch = 1, isTerminator = 1 in |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 82 | class BFormD<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 83 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | f520093 | 2005-12-25 17:36:48 +0000 | [diff] [blame] | 84 | let Pattern = pattern; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 85 | let OperandList = (ops target:$DISP); |
Andrew Lenharth | f520093 | 2005-12-25 17:36:48 +0000 | [diff] [blame] | 86 | bits<5> Ra; |
Andrew Lenharth | 5a99041 | 2005-10-22 22:06:58 +0000 | [diff] [blame] | 87 | bits<21> disp; |
| 88 | |
| 89 | let Inst{25-21} = Ra; |
| 90 | let Inst{20-0} = disp; |
| 91 | } |
Andrew Lenharth | 6bec63a | 2006-01-01 22:16:14 +0000 | [diff] [blame] | 92 | let isBranch = 1, isTerminator = 1 in |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 93 | class BForm<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 94 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 6bec63a | 2006-01-01 22:16:14 +0000 | [diff] [blame] | 95 | let Pattern = pattern; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 96 | let OperandList = (ops GPRC:$RA, target:$DISP); |
Andrew Lenharth | 6bec63a | 2006-01-01 22:16:14 +0000 | [diff] [blame] | 97 | |
| 98 | bits<5> Ra; |
| 99 | bits<21> disp; |
| 100 | |
| 101 | let Inst{25-21} = Ra; |
| 102 | let Inst{20-0} = disp; |
| 103 | } |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 104 | |
| 105 | let isBranch = 1, isTerminator = 1 in |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 106 | class FBForm<bits<6> opcode, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 107 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 6bec63a | 2006-01-01 22:16:14 +0000 | [diff] [blame] | 108 | let Pattern = pattern; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 109 | let OperandList = (ops F8RC:$RA, target:$DISP); |
Andrew Lenharth | 6bec63a | 2006-01-01 22:16:14 +0000 | [diff] [blame] | 110 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 111 | bits<5> Ra; |
| 112 | bits<21> disp; |
| 113 | |
| 114 | let Inst{25-21} = Ra; |
| 115 | let Inst{20-0} = disp; |
| 116 | } |
| 117 | |
| 118 | //3.3.3 |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 119 | class OForm<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 120 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 121 | let Pattern = pattern; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 122 | let OperandList = (ops GPRC:$RC, GPRC:$RA, GPRC:$RB); |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 123 | |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 124 | bits<5> Rc; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 125 | bits<5> Ra; |
| 126 | bits<5> Rb; |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 127 | bits<7> Function = fun; |
| 128 | |
| 129 | let Inst{25-21} = Ra; |
| 130 | let Inst{20-16} = Rb; |
| 131 | let Inst{15-13} = 0; |
| 132 | let Inst{12} = 0; |
| 133 | let Inst{11-5} = Function; |
| 134 | let Inst{4-0} = Rc; |
| 135 | } |
| 136 | |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 137 | class OForm2<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 138 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | d4c0ed7 | 2005-10-20 19:39:24 +0000 | [diff] [blame] | 139 | let Pattern = pattern; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 140 | let OperandList = (ops GPRC:$RC, GPRC:$RB); |
Andrew Lenharth | d4c0ed7 | 2005-10-20 19:39:24 +0000 | [diff] [blame] | 141 | |
| 142 | bits<5> Rc; |
| 143 | bits<5> Rb; |
| 144 | bits<7> Function = fun; |
| 145 | |
Andrew Lenharth | 5a99041 | 2005-10-22 22:06:58 +0000 | [diff] [blame] | 146 | let Inst{25-21} = 31; |
Andrew Lenharth | d4c0ed7 | 2005-10-20 19:39:24 +0000 | [diff] [blame] | 147 | let Inst{20-16} = Rb; |
| 148 | let Inst{15-13} = 0; |
| 149 | let Inst{12} = 0; |
| 150 | let Inst{11-5} = Function; |
| 151 | let Inst{4-0} = Rc; |
| 152 | } |
| 153 | |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 154 | class OForm4<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 155 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 3c7c4d7 | 2005-12-05 23:19:44 +0000 | [diff] [blame] | 156 | let Pattern = pattern; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 157 | let OperandList = (ops GPRC:$RDEST, GPRC:$RFALSE, GPRC:$RTRUE, GPRC:$RCOND); |
Andrew Lenharth | 3c7c4d7 | 2005-12-05 23:19:44 +0000 | [diff] [blame] | 158 | |
| 159 | bits<5> Rc; |
| 160 | bits<5> Rb; |
| 161 | bits<5> Ra; |
| 162 | bits<7> Function = fun; |
| 163 | |
| 164 | let isTwoAddress = 1; |
| 165 | let Inst{25-21} = Ra; |
| 166 | let Inst{20-16} = Rb; |
| 167 | let Inst{15-13} = 0; |
| 168 | let Inst{12} = 0; |
| 169 | let Inst{11-5} = Function; |
| 170 | let Inst{4-0} = Rc; |
| 171 | } |
| 172 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 173 | |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 174 | class OFormL<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 175 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 176 | let Pattern = pattern; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 177 | let OperandList = (ops GPRC:$RC, GPRC:$RA, u8imm:$L); |
Andrew Lenharth | 7b69867 | 2005-10-20 00:28:31 +0000 | [diff] [blame] | 178 | |
Andrew Lenharth | 02daecc | 2005-07-22 20:50:29 +0000 | [diff] [blame] | 179 | bits<5> Rc; |
| 180 | bits<5> Ra; |
| 181 | bits<8> LIT; |
| 182 | bits<7> Function = fun; |
| 183 | |
| 184 | let Inst{25-21} = Ra; |
| 185 | let Inst{20-13} = LIT; |
| 186 | let Inst{12} = 1; |
| 187 | let Inst{11-5} = Function; |
| 188 | let Inst{4-0} = Rc; |
| 189 | } |
| 190 | |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 191 | class OForm4L<bits<6> opcode, bits<7> fun, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 192 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 4b1c726 | 2006-02-01 19:37:33 +0000 | [diff] [blame] | 193 | let Pattern = pattern; |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 194 | let OperandList = (ops GPRC:$RDEST, GPRC:$RFALSE, s64imm:$RTRUE, GPRC:$RCOND); |
| 195 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 196 | bits<5> Rc; |
Andrew Lenharth | a6a23b5 | 2005-10-20 23:58:36 +0000 | [diff] [blame] | 197 | bits<8> LIT; |
| 198 | bits<5> Ra; |
| 199 | bits<7> Function = fun; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 200 | |
Andrew Lenharth | a6a23b5 | 2005-10-20 23:58:36 +0000 | [diff] [blame] | 201 | let isTwoAddress = 1; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 202 | let Inst{25-21} = Ra; |
| 203 | let Inst{20-13} = LIT; |
| 204 | let Inst{12} = 1; |
| 205 | let Inst{11-5} = Function; |
| 206 | let Inst{4-0} = Rc; |
| 207 | } |
| 208 | |
| 209 | //3.3.4 |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 210 | class FPForm<bits<6> opcode, bits<11> fun, string asmstr, list<dag> pattern, InstrItinClass itin> |
| 211 | : InstAlpha<opcode, asmstr, itin> { |
Andrew Lenharth | 97a7fcf | 2005-11-09 19:17:08 +0000 | [diff] [blame] | 212 | let Pattern = pattern; |
| 213 | |
Andrew Lenharth | 1ec48e8 | 2005-07-28 18:14:47 +0000 | [diff] [blame] | 214 | bits<5> Fc; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 215 | bits<5> Fa; |
| 216 | bits<5> Fb; |
Andrew Lenharth | 5ae5f81 | 2005-01-26 21:54:09 +0000 | [diff] [blame] | 217 | bits<11> Function = fun; |
Andrew Lenharth | 1ec48e8 | 2005-07-28 18:14:47 +0000 | [diff] [blame] | 218 | |
| 219 | let Inst{25-21} = Fa; |
| 220 | let Inst{20-16} = Fb; |
| 221 | let Inst{15-5} = Function; |
| 222 | let Inst{4-0} = Fc; |
| 223 | } |
| 224 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 225 | //3.3.5 |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 226 | class PALForm<bits<6> opcode, dag OL, string asmstr, InstrItinClass itin> |
| 227 | : InstAlpha<opcode, asmstr, itin> { |
| 228 | let OperandList = OL; |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 229 | bits<26> Function; |
| 230 | |
| 231 | let Inst{25-0} = Function; |
| 232 | } |
| 233 | |
| 234 | |
| 235 | // Pseudo instructions. |
Andrew Lenharth | 16b96d2 | 2006-03-09 17:16:45 +0000 | [diff] [blame] | 236 | class PseudoInstAlpha<dag OL, string nm, list<dag> pattern, InstrItinClass itin> |
| 237 | : InstAlpha<0, nm, itin> { |
| 238 | let OperandList = OL; |
Andrew Lenharth | 0294e33 | 2005-11-22 04:20:06 +0000 | [diff] [blame] | 239 | let Pattern = pattern; |
| 240 | |
Andrew Lenharth | a1b5ca2 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 241 | } |