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