1 //===- PowerPCInstrInfo.td - The PowerPC Instruction Set -----*- tablegen -*-=//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This file describes the subset of the 32-bit PowerPC instruction set, as used
11 // by the PowerPC instruction selector.
13 //===----------------------------------------------------------------------===//
15 include "PowerPCInstrFormats.td"
26 class isPPC64 { bit PPC64 = 1; }
27 class isVMX { bit VMX = 1; }
29 list<Register> Defs = [CR0];
33 let isTerminator = 1 in {
35 def BLR : XLForm_2_ext<19, 16, 20, 0, 0, (ops), "blr">;
36 def BCTR : XLForm_2_ext<19, 528, 20, 0, 0, (ops), "bctr">;
39 def u5imm : Operand<i8> {
40 let PrintMethod = "printU5ImmOperand";
42 def u6imm : Operand<i8> {
43 let PrintMethod = "printU6ImmOperand";
45 def s16imm : Operand<i16> {
46 let PrintMethod = "printS16ImmOperand";
48 def u16imm : Operand<i16> {
49 let PrintMethod = "printU16ImmOperand";
51 def target : Operand<i32> {
52 let PrintMethod = "printBranchOperand";
54 def piclabel: Operand<i32> {
55 let PrintMethod = "printPICLabel";
57 def symbolHi: Operand<i32> {
58 let PrintMethod = "printSymbolHi";
60 def symbolLo: Operand<i32> {
61 let PrintMethod = "printSymbolLo";
63 def crbitm: Operand<i8> {
64 let PrintMethod = "printcrbitm";
67 // Pseudo-instructions:
68 def PHI : Pseudo<(ops variable_ops), "; PHI">;
70 def ADJCALLSTACKDOWN : Pseudo<(ops u16imm), "; ADJCALLSTACKDOWN">;
71 def ADJCALLSTACKUP : Pseudo<(ops u16imm), "; ADJCALLSTACKUP">;
73 def IMPLICIT_DEF_GPR : Pseudo<(ops GPRC:$rD), "; $rD = IMPLICIT_DEF_GPRC">;
74 def IMPLICIT_DEF_FP : Pseudo<(ops FPRC:$rD), "; %rD = IMPLICIT_DEF_FP">;
76 // SELECT_CC_* - Used to implement the SELECT_CC DAG operation. Expanded by the
77 // scheduler into a branch sequence.
78 let usesCustomDAGSchedInserter = 1 in { // Expanded by the scheduler.
79 def SELECT_CC_Int : Pseudo<(ops GPRC:$dst, CRRC:$cond, GPRC:$T, GPRC:$F,
80 i32imm:$BROPC), "; SELECT_CC PSEUDO!">;
81 def SELECT_CC_FP : Pseudo<(ops FPRC:$dst, CRRC:$cond, FPRC:$T, FPRC:$F,
82 i32imm:$BROPC), "; SELECT_CC PSEUDO!">;
87 def MovePCtoLR : Pseudo<(ops piclabel:$label), "bl $label">;
89 let isBranch = 1, isTerminator = 1 in {
90 def COND_BRANCH : Pseudo<(ops CRRC:$crS, u16imm, target:$true, target:$false),
92 def B : IForm<18, 0, 0, (ops target:$func), "b $func">;
93 //def BA : IForm<18, 1, 0, (ops target:$func), "ba $func">;
94 def BL : IForm<18, 0, 1, (ops target:$func), "bl $func">;
95 //def BLA : IForm<18, 1, 1, (ops target:$func), "bla $func">;
97 // FIXME: 4*CR# needs to be added to the BI field!
98 // This will only work for CR0 as it stands now
99 def BLT : BForm<16, 0, 0, 12, 0, (ops CRRC:$crS, target:$block),
101 def BLE : BForm<16, 0, 0, 4, 1, (ops CRRC:$crS, target:$block),
103 def BEQ : BForm<16, 0, 0, 12, 2, (ops CRRC:$crS, target:$block),
105 def BGE : BForm<16, 0, 0, 4, 0, (ops CRRC:$crS, target:$block),
107 def BGT : BForm<16, 0, 0, 12, 1, (ops CRRC:$crS, target:$block),
109 def BNE : BForm<16, 0, 0, 4, 2, (ops CRRC:$crS, target:$block),
114 // All calls clobber the non-callee saved registers...
115 Defs = [R0,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,
116 F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,
118 CR0,CR1,CR5,CR6,CR7] in {
119 // Convenient aliases for call instructions
120 def CALLpcrel : IForm<18, 0, 1, (ops target:$func, variable_ops), "bl $func">;
121 def CALLindirect : XLForm_2_ext<19, 528, 20, 0, 1,
122 (ops variable_ops), "bctrl">;
125 // D-Form instructions. Most instructions that perform an operation on a
126 // register and an immediate are of this type.
129 def LBZ : DForm_1<34, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA),
130 "lbz $rD, $disp($rA)">;
131 def LHA : DForm_1<42, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA),
132 "lha $rD, $disp($rA)">;
133 def LHZ : DForm_1<40, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA),
134 "lhz $rD, $disp($rA)">;
135 def LMW : DForm_1<46, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA),
136 "lmw $rD, $disp($rA)">;
137 def LWZ : DForm_1<32, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA),
138 "lwz $rD, $disp($rA)">;
139 def LWZU : DForm_1<35, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA),
140 "lwzu $rD, $disp($rA)">;
142 def ADDI : DForm_2<14, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
143 "addi $rD, $rA, $imm">;
144 def ADDIC : DForm_2<12, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
145 "addic $rD, $rA, $imm">;
146 def ADDICo : DForm_2<13, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
147 "addic. $rD, $rA, $imm">;
148 def ADDIS : DForm_2<15, (ops GPRC:$rD, GPRC:$rA, symbolHi:$imm),
149 "addis $rD, $rA, $imm">;
150 def LA : DForm_2<14, (ops GPRC:$rD, GPRC:$rA, symbolLo:$sym),
151 "la $rD, $sym($rA)">;
152 def MULLI : DForm_2< 7, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
153 "mulli $rD, $rA, $imm">;
154 def SUBFIC : DForm_2< 8, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
155 "subfic $rD, $rA, $imm">;
156 def LI : DForm_2_r0<14, (ops GPRC:$rD, s16imm:$imm),
158 def LIS : DForm_2_r0<15, (ops GPRC:$rD, symbolHi:$imm),
161 def STMW : DForm_3<47, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA),
162 "stmw $rS, $disp($rA)">;
163 def STB : DForm_3<38, (ops GPRC:$rS, symbolLo:$disp, GPRC:$rA),
164 "stb $rS, $disp($rA)">;
165 def STH : DForm_3<44, (ops GPRC:$rS, symbolLo:$disp, GPRC:$rA),
166 "sth $rS, $disp($rA)">;
167 def STW : DForm_3<36, (ops GPRC:$rS, symbolLo:$disp, GPRC:$rA),
168 "stw $rS, $disp($rA)">;
169 def STWU : DForm_3<37, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA),
170 "stwu $rS, $disp($rA)">;
172 def ANDIo : DForm_4<28, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
173 "andi. $dst, $src1, $src2">, isDOT;
174 def ANDISo : DForm_4<29, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
175 "andis. $dst, $src1, $src2">, isDOT;
176 def ORI : DForm_4<24, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
177 "ori $dst, $src1, $src2">;
178 def ORIS : DForm_4<25, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
179 "oris $dst, $src1, $src2">;
180 def XORI : DForm_4<26, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
181 "xori $dst, $src1, $src2">;
182 def XORIS : DForm_4<27, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
183 "xoris $dst, $src1, $src2">;
184 def NOP : DForm_4_zero<24, (ops), "nop">;
185 def CMPI : DForm_5<11, (ops CRRC:$crD, i1imm:$L, GPRC:$rA, s16imm:$imm),
186 "cmpi $crD, $L, $rA, $imm">;
187 def CMPWI : DForm_5_ext<11, (ops CRRC:$crD, GPRC:$rA, s16imm:$imm),
188 "cmpwi $crD, $rA, $imm">;
189 def CMPDI : DForm_5_ext<11, (ops CRRC:$crD, GPRC:$rA, s16imm:$imm),
190 "cmpdi $crD, $rA, $imm">, isPPC64;
191 def CMPLI : DForm_6<10, (ops CRRC:$dst, i1imm:$size, GPRC:$src1, u16imm:$src2),
192 "cmpli $dst, $size, $src1, $src2">;
193 def CMPLWI : DForm_6_ext<10, (ops CRRC:$dst, GPRC:$src1, u16imm:$src2),
194 "cmplwi $dst, $src1, $src2">;
195 def CMPLDI : DForm_6_ext<10, (ops CRRC:$dst, GPRC:$src1, u16imm:$src2),
196 "cmpldi $dst, $src1, $src2">, isPPC64;
198 def LFS : DForm_8<48, (ops FPRC:$rD, symbolLo:$disp, GPRC:$rA),
199 "lfs $rD, $disp($rA)">;
200 def LFD : DForm_8<50, (ops FPRC:$rD, symbolLo:$disp, GPRC:$rA),
201 "lfd $rD, $disp($rA)">;
204 def STFS : DForm_9<52, (ops FPRC:$rS, symbolLo:$disp, GPRC:$rA),
205 "stfs $rS, $disp($rA)">;
206 def STFD : DForm_9<54, (ops FPRC:$rS, symbolLo:$disp, GPRC:$rA),
207 "stfd $rS, $disp($rA)">;
210 // DS-Form instructions. Load/Store instructions available in PPC-64
213 def LWA : DSForm_1<58, 2, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
214 "lwa $rT, $DS($rA)">, isPPC64;
215 def LD : DSForm_2<58, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
216 "ld $rT, $DS($rA)">, isPPC64;
219 def STD : DSForm_2<62, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
220 "std $rT, $DS($rA)">, isPPC64;
221 def STDU : DSForm_2<62, 1, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
222 "stdu $rT, $DS($rA)">, isPPC64;
225 // X-Form instructions. Most instructions that perform an operation on a
226 // register and another register are of this type.
229 def LBZX : XForm_1<31, 87, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
230 "lbzx $dst, $base, $index">;
231 def LHAX : XForm_1<31, 343, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
232 "lhax $dst, $base, $index">;
233 def LHZX : XForm_1<31, 279, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
234 "lhzx $dst, $base, $index">;
235 def LWAX : XForm_1<31, 341, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
236 "lwax $dst, $base, $index">, isPPC64;
237 def LWZX : XForm_1<31, 23, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
238 "lwzx $dst, $base, $index">;
239 def LDX : XForm_1<31, 21, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
240 "ldx $dst, $base, $index">, isPPC64;
242 def AND : XForm_6<31, 28, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
243 "and $rA, $rS, $rB">;
244 def ANDo : XForm_6<31, 28, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
245 "and. $rA, $rS, $rB">, isDOT;
246 def ANDC : XForm_6<31, 60, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
247 "andc $rA, $rS, $rB">;
248 def EQV : XForm_6<31, 284, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
249 "eqv $rA, $rS, $rB">;
250 def NAND : XForm_6<31, 476, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
251 "nand $rA, $rS, $rB">;
252 def NOR : XForm_6<31, 124, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
253 "nor $rA, $rS, $rB">;
254 def OR : XForm_6<31, 444, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
256 def ORo : XForm_6<31, 444, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
257 "or. $rA, $rS, $rB">, isDOT;
258 def ORC : XForm_6<31, 412, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
259 "orc $rA, $rS, $rB">;
260 def SLD : XForm_6<31, 27, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
261 "sld $rA, $rS, $rB">, isPPC64;
262 def SLW : XForm_6<31, 24, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
263 "slw $rA, $rS, $rB">;
264 def SRD : XForm_6<31, 539, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
265 "srd $rA, $rS, $rB">, isPPC64;
266 def SRW : XForm_6<31, 536, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
267 "srw $rA, $rS, $rB">;
268 def SRAD : XForm_6<31, 794, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
269 "srad $rA, $rS, $rB">, isPPC64;
270 def SRAW : XForm_6<31, 792, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
271 "sraw $rA, $rS, $rB">;
272 def XOR : XForm_6<31, 316, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
273 "xor $rA, $rS, $rB">;
275 def STBX : XForm_8<31, 215, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
276 "stbx $rS, $rA, $rB">;
277 def STHX : XForm_8<31, 407, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
278 "sthx $rS, $rA, $rB">;
279 def STWX : XForm_8<31, 151, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
280 "stwx $rS, $rA, $rB">;
281 def STWUX : XForm_8<31, 183, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
282 "stwux $rS, $rA, $rB">;
283 def STDX : XForm_8<31, 149, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
284 "stdx $rS, $rA, $rB">, isPPC64;
285 def STDUX : XForm_8<31, 181, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
286 "stdux $rS, $rA, $rB">, isPPC64;
288 def SRAWI : XForm_10<31, 824, (ops GPRC:$rA, GPRC:$rS, u5imm:$SH),
289 "srawi $rA, $rS, $SH">;
290 def CNTLZW : XForm_11<31, 26, (ops GPRC:$rA, GPRC:$rS),
292 def EXTSB : XForm_11<31, 954, (ops GPRC:$rA, GPRC:$rS),
294 def EXTSH : XForm_11<31, 922, (ops GPRC:$rA, GPRC:$rS),
296 def EXTSW : XForm_11<31, 986, (ops GPRC:$rA, GPRC:$rS),
297 "extsw $rA, $rS">, isPPC64;
298 def CMP : XForm_16<31, 0, (ops CRRC:$crD, i1imm:$long, GPRC:$rA, GPRC:$rB),
299 "cmp $crD, $long, $rA, $rB">;
300 def CMPL : XForm_16<31, 32, (ops CRRC:$crD, i1imm:$long, GPRC:$rA, GPRC:$rB),
301 "cmpl $crD, $long, $rA, $rB">;
302 def CMPW : XForm_16_ext<31, 0, (ops CRRC:$crD, GPRC:$rA, GPRC:$rB),
303 "cmpw $crD, $rA, $rB">;
304 def CMPD : XForm_16_ext<31, 0, (ops CRRC:$crD, GPRC:$rA, GPRC:$rB),
305 "cmpd $crD, $rA, $rB">, isPPC64;
306 def CMPLW : XForm_16_ext<31, 32, (ops CRRC:$crD, GPRC:$rA, GPRC:$rB),
307 "cmplw $crD, $rA, $rB">;
308 def CMPLD : XForm_16_ext<31, 32, (ops CRRC:$crD, GPRC:$rA, GPRC:$rB),
309 "cmpld $crD, $rA, $rB">, isPPC64;
310 def FCMPO : XForm_17<63, 32, (ops CRRC:$crD, FPRC:$fA, FPRC:$fB),
311 "fcmpo $crD, $fA, $fB">;
312 def FCMPU : XForm_17<63, 0, (ops CRRC:$crD, FPRC:$fA, FPRC:$fB),
313 "fcmpu $crD, $fA, $fB">;
315 def LFSX : XForm_25<31, 535, (ops FPRC:$dst, GPRC:$base, GPRC:$index),
316 "lfsx $dst, $base, $index">;
317 def LFDX : XForm_25<31, 599, (ops FPRC:$dst, GPRC:$base, GPRC:$index),
318 "lfdx $dst, $base, $index">;
320 def FCFID : XForm_26<63, 846, (ops FPRC:$frD, FPRC:$frB),
321 "fcfid $frD, $frB">, isPPC64;
322 def FCTIDZ : XForm_26<63, 815, (ops FPRC:$frD, FPRC:$frB),
323 "fctidz $frD, $frB">, isPPC64;
324 def FCTIWZ : XForm_26<63, 15, (ops FPRC:$frD, FPRC:$frB),
325 "fctiwz $frD, $frB">;
326 def FABS : XForm_26<63, 264, (ops FPRC:$frD, FPRC:$frB),
328 def FMR : XForm_26<63, 72, (ops FPRC:$frD, FPRC:$frB),
330 def FNABS : XForm_26<63, 136, (ops FPRC:$frD, FPRC:$frB),
332 def FNEG : XForm_26<63, 40, (ops FPRC:$frD, FPRC:$frB),
334 def FRSP : XForm_26<63, 12, (ops FPRC:$frD, FPRC:$frB),
336 def FSQRT : XForm_26<63, 22, (ops FPRC:$frD, FPRC:$frB),
338 def FSQRTS : XForm_26<59, 22, (ops FPRC:$frD, FPRC:$frB),
339 "fsqrts $frD, $frB">;
342 def STFSX : XForm_28<31, 663, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB),
343 "stfsx $frS, $rA, $rB">;
344 def STFDX : XForm_28<31, 727, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB),
345 "stfdx $frS, $rA, $rB">;
348 // XL-Form instructions. condition register logical ops.
350 def MCRF : XLForm_3<19, 0, (ops CRRC:$BF, CRRC:$BFA),
353 // XFX-Form instructions. Instructions that deal with SPRs
355 // Note that although LR should be listed as `8' and CTR as `9' in the SPR
356 // field, the manual lists the groups of bits as [5-9] = 0, [0-4] = 8 or 9
357 // which means the SPR value needs to be multiplied by a factor of 32.
358 def MFCTR : XFXForm_1_ext<31, 339, 288, (ops GPRC:$rT), "mfctr $rT">;
359 def MFLR : XFXForm_1_ext<31, 339, 256, (ops GPRC:$rT), "mflr $rT">;
360 def MFCR : XFXForm_3<31, 19, (ops GPRC:$rT), "mfcr $rT">;
361 def MTCRF : XFXForm_5<31, 144, (ops crbitm:$FXM, GPRC:$rS),
363 def MFOCRF : XFXForm_5a<31, 19, (ops GPRC:$rT, crbitm:$FXM),
365 def MTCTR : XFXForm_7_ext<31, 467, 288, (ops GPRC:$rS), "mtctr $rS">;
366 def MTLR : XFXForm_7_ext<31, 467, 256, (ops GPRC:$rS), "mtlr $rS">;
368 // XS-Form instructions. Just 'sradi'
370 def SRADI : XSForm_1<31, 413, (ops GPRC:$rA, GPRC:$rS, u6imm:$SH),
371 "sradi $rA, $rS, $SH">, isPPC64;
373 // XO-Form instructions. Arithmetic instructions that can set overflow bit
375 def ADD : XOForm_1<31, 266, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
377 [(set GPRC:$rT, (add GPRC:$rA, GPRC:$rB))]>;
378 def ADDC : XOForm_1<31, 10, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
379 "addc $rT, $rA, $rB",
381 def ADDE : XOForm_1<31, 138, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
382 "adde $rT, $rA, $rB",
384 def DIVD : XOForm_1<31, 489, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
385 "divd $rT, $rA, $rB",
387 def DIVDU : XOForm_1<31, 457, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
388 "divdu $rT, $rA, $rB",
390 def DIVW : XOForm_1<31, 491, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
391 "divw $rT, $rA, $rB",
392 [(set GPRC:$rT, (sdiv GPRC:$rA, GPRC:$rB))]>;
393 def DIVWU : XOForm_1<31, 459, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
394 "divwu $rT, $rA, $rB",
395 [(set GPRC:$rT, (udiv GPRC:$rA, GPRC:$rB))]>;
396 def MULHW : XOForm_1<31, 75, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
397 "mulhw $rT, $rA, $rB",
398 [(set GPRC:$rT, (mulhs GPRC:$rA, GPRC:$rB))]>;
399 def MULHWU : XOForm_1<31, 11, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
400 "mulhwu $rT, $rA, $rB",
401 [(set GPRC:$rT, (mulhu GPRC:$rA, GPRC:$rB))]>;
402 def MULLD : XOForm_1<31, 233, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
403 "mulld $rT, $rA, $rB",
405 def MULLW : XOForm_1<31, 235, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
406 "mullw $rT, $rA, $rB",
407 [(set GPRC:$rT, (mul GPRC:$rA, GPRC:$rB))]>;
408 def SUBF : XOForm_1<31, 40, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
409 "subf $rT, $rA, $rB",
410 [(set GPRC:$rT, (sub GPRC:$rB, GPRC:$rA))]>;
411 def SUBFC : XOForm_1<31, 8, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
412 "subfc $rT, $rA, $rB",
414 def SUBFE : XOForm_1<31, 136, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
415 "subfe $rT, $rA, $rB",
417 def ADDME : XOForm_3<31, 234, 0, (ops GPRC:$rT, GPRC:$rA),
419 def ADDZE : XOForm_3<31, 202, 0, (ops GPRC:$rT, GPRC:$rA),
421 def NEG : XOForm_3<31, 104, 0, (ops GPRC:$rT, GPRC:$rA),
423 def SUBFZE : XOForm_3<31, 200, 0, (ops GPRC:$rT, GPRC:$rA),
426 // A-Form instructions. Most of the instructions executed in the FPU are of
429 def FMADD : AForm_1<63, 29,
430 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
431 "fmadd $FRT, $FRA, $FRC, $FRB">;
432 def FMADDS : AForm_1<59, 29,
433 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
434 "fmadds $FRT, $FRA, $FRC, $FRB">;
435 def FMSUB : AForm_1<63, 28,
436 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
437 "fmsub $FRT, $FRA, $FRC, $FRB">;
438 def FMSUBS : AForm_1<59, 28,
439 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
440 "fmsubs $FRT, $FRA, $FRC, $FRB">;
441 def FNMADD : AForm_1<63, 31,
442 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
443 "fnmadd $FRT, $FRA, $FRC, $FRB">;
444 def FNMADDS : AForm_1<59, 31,
445 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
446 "fnmadds $FRT, $FRA, $FRC, $FRB">;
447 def FNMSUB : AForm_1<63, 30,
448 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
449 "fnmsub $FRT, $FRA, $FRC, $FRB">;
450 def FNMSUBS : AForm_1<59, 30,
451 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
452 "fnmsubs $FRT, $FRA, $FRC, $FRB">;
453 def FSEL : AForm_1<63, 23,
454 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
455 "fsel $FRT, $FRA, $FRC, $FRB">;
456 def FADD : AForm_2<63, 21,
457 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
458 "fadd $FRT, $FRA, $FRB">;
459 def FADDS : AForm_2<59, 21,
460 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
461 "fadds $FRT, $FRA, $FRB">;
462 def FDIV : AForm_2<63, 18,
463 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
464 "fdiv $FRT, $FRA, $FRB">;
465 def FDIVS : AForm_2<59, 18,
466 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
467 "fdivs $FRT, $FRA, $FRB">;
468 def FMUL : AForm_3<63, 25,
469 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
470 "fmul $FRT, $FRA, $FRB">;
471 def FMULS : AForm_3<59, 25,
472 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
473 "fmuls $FRT, $FRA, $FRB">;
474 def FSUB : AForm_2<63, 20,
475 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
476 "fsub $FRT, $FRA, $FRB">;
477 def FSUBS : AForm_2<59, 20,
478 (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
479 "fsubs $FRT, $FRA, $FRB">;
481 // M-Form instructions. rotate and mask instructions.
483 let isTwoAddress = 1 in {
484 def RLWIMI : MForm_2<20,
485 (ops GPRC:$rA, GPRC:$rSi, GPRC:$rS, u5imm:$SH, u5imm:$MB,
486 u5imm:$ME), "rlwimi $rA, $rS, $SH, $MB, $ME">;
488 def RLWINM : MForm_2<21,
489 (ops GPRC:$rA, GPRC:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME),
490 "rlwinm $rA, $rS, $SH, $MB, $ME">;
491 def RLWINMo : MForm_2<21,
492 (ops GPRC:$rA, GPRC:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME),
493 "rlwinm. $rA, $rS, $SH, $MB, $ME">, isDOT;
494 def RLWNM : MForm_2<23,
495 (ops GPRC:$rA, GPRC:$rS, GPRC:$rB, u5imm:$MB, u5imm:$ME),
496 "rlwnm $rA, $rS, $rB, $MB, $ME">;
498 // MD-Form instructions. 64 bit rotate instructions.
500 def RLDICL : MDForm_1<30, 0,
501 (ops GPRC:$rA, GPRC:$rS, u6imm:$SH, u6imm:$MB),
502 "rldicl $rA, $rS, $SH, $MB">, isPPC64;
503 def RLDICR : MDForm_1<30, 1,
504 (ops GPRC:$rA, GPRC:$rS, u6imm:$SH, u6imm:$ME),
505 "rldicr $rA, $rS, $SH, $ME">, isPPC64;
507 def PowerPCInstrInfo : InstrInfo {
510 let TSFlagsFields = [ "VMX", "PPC64" ];
511 let TSFlagsShifts = [ 0, 1 ];
513 let isLittleEndianEncoding = 1;