now that tblgen is smarter, this pattern is not needed. Also, tblgen
[oota-llvm.git] / lib / Target / PowerPC / PPCInstrInfo.td
1 //===- PowerPCInstrInfo.td - The PowerPC Instruction Set -----*- tablegen -*-=//
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 // This file describes the subset of the 32-bit PowerPC instruction set, as used
11 // by the PowerPC instruction selector.
12 //
13 //===----------------------------------------------------------------------===//
14
15 include "PowerPCInstrFormats.td"
16
17 //===----------------------------------------------------------------------===//
18 // Selection DAG Type Constraint definitions.
19 //
20 // Note that the semantics of these constraints are hard coded into tblgen.  To
21 // modify or add constraints, you have to hack tblgen.
22 //
23
24 class SDTypeConstraint<int opnum> {
25   int OperandNum = opnum;
26 }
27
28 // SDTCisVT - The specified operand has exactly this VT.
29 class SDTCisVT <int OpNum, ValueType vt> : SDTypeConstraint<OpNum> {
30   ValueType VT = vt;
31 }
32
33 // SDTCisInt - The specified operand is has integer type.
34 class SDTCisInt<int OpNum> : SDTypeConstraint<OpNum>;
35
36 // SDTCisFP - The specified operand is has floating point type.
37 class SDTCisFP <int OpNum> : SDTypeConstraint<OpNum>;
38
39 // SDTCisSameAs - The two specified operands have identical types.
40 class SDTCisSameAs<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> {
41   int OtherOperandNum = OtherOp;
42 }
43
44 // SDTCisVTSmallerThanOp - The specified operand is a VT SDNode, and its type is
45 // smaller than the 'Other' operand.
46 class SDTCisVTSmallerThanOp<int OpNum, int OtherOp> : SDTypeConstraint<OpNum> {
47   int OtherOperandNum = OtherOp;
48 }
49
50 //===----------------------------------------------------------------------===//
51 // Selection DAG Type Profile definitions.
52 //
53 // These use the constraints defined above to describe the type requirements of
54 // the various nodes.  These are not hard coded into tblgen, allowing targets to
55 // add their own if needed.
56 //
57
58 // SDTypeProfile - This profile describes the type requirements of a Selection
59 // DAG node.
60 class SDTypeProfile<int numresults, int numoperands,
61                     list<SDTypeConstraint> constraints> {
62   int NumResults = numresults;
63   int NumOperands = numoperands;
64   list<SDTypeConstraint> Constraints = constraints;
65 }
66
67 // Builtin profiles.
68 def SDTImm    : SDTypeProfile<1, 0, [SDTCisInt<0>]>;      // for 'imm'.
69 def SDTVT     : SDTypeProfile<1, 0, [SDTCisVT<0, OtherVT>]>; // for 'vt'
70 def SDTIntBinOp : SDTypeProfile<1, 2, [   // add, and, or, xor, udiv, etc.
71   SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>
72 ]>;
73 def SDTFPBinOp : SDTypeProfile<1, 2, [      // fadd, fmul, etc.
74   SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisFP<0>
75 ]>;
76 def SDTIntUnaryOp : SDTypeProfile<1, 1, [   // ctlz
77   SDTCisSameAs<0, 1>, SDTCisInt<0>
78 ]>;
79 def SDTExtInreg : SDTypeProfile<1, 2, [   // sext_inreg
80   SDTCisSameAs<0, 1>, SDTCisInt<0>, SDTCisVT<2, OtherVT>,
81   SDTCisVTSmallerThanOp<2, 1>
82 ]>;
83
84 //===----------------------------------------------------------------------===//
85 // Selection DAG Node Properties.
86 //
87 // Note: These are hard coded into tblgen.
88 //
89 class SDNodeProperty;
90 def SDNPCommutative : SDNodeProperty;   // X op Y == Y op X
91 def SDNPAssociative : SDNodeProperty;   // (X op Y) op Z == X op (Y op Z)
92
93 //===----------------------------------------------------------------------===//
94 // Selection DAG Node definitions.
95 //
96 class SDNode<string opcode, SDTypeProfile typeprof,
97              list<SDNodeProperty> props = [], string sdclass = "SDNode"> {
98   string Opcode  = opcode;
99   string SDClass = sdclass;
100   list<SDNodeProperty> Properties = props;
101   SDTypeProfile TypeProfile = typeprof;
102 }
103
104 def set;
105 def node;
106
107 def imm        : SDNode<"ISD::Constant"  , SDTImm     , [], "ConstantSDNode">;
108 def vt         : SDNode<"ISD::VALUETYPE" , SDTVT      , [], "VTSDNode">;
109 def add        : SDNode<"ISD::ADD"       , SDTIntBinOp   ,
110                         [SDNPCommutative, SDNPAssociative]>;
111 def sub        : SDNode<"ISD::SUB"       , SDTIntBinOp>;
112 def mul        : SDNode<"ISD::MUL"       , SDTIntBinOp,
113                         [SDNPCommutative, SDNPAssociative]>;
114 def mulhs      : SDNode<"ISD::MULHS"     , SDTIntBinOp, [SDNPCommutative]>;
115 def mulhu      : SDNode<"ISD::MULHU"     , SDTIntBinOp, [SDNPCommutative]>;
116 def sdiv       : SDNode<"ISD::SDIV"      , SDTIntBinOp>;
117 def udiv       : SDNode<"ISD::UDIV"      , SDTIntBinOp>;
118 def srem       : SDNode<"ISD::SREM"      , SDTIntBinOp>;
119 def urem       : SDNode<"ISD::UREM"      , SDTIntBinOp>;
120 def and        : SDNode<"ISD::AND"       , SDTIntBinOp,
121                         [SDNPCommutative, SDNPAssociative]>;
122 def or         : SDNode<"ISD::OR"        , SDTIntBinOp,
123                         [SDNPCommutative, SDNPAssociative]>;
124 def xor        : SDNode<"ISD::XOR"       , SDTIntBinOp,
125                         [SDNPCommutative, SDNPAssociative]>;
126 def fadd       : SDNode<"ISD::FADD"       , SDTFPBinOp, [SDNPCommutative]>;
127 def fsub       : SDNode<"ISD::FSUB"       , SDTFPBinOp>;
128 def fmul       : SDNode<"ISD::FMUL"       , SDTFPBinOp, [SDNPCommutative]>;
129 def fdiv       : SDNode<"ISD::FDIV"       , SDTFPBinOp>;
130 def frem       : SDNode<"ISD::FREM"       , SDTFPBinOp>;
131
132 def sext_inreg : SDNode<"ISD::SIGN_EXTEND_INREG", SDTExtInreg>;
133 def ctlz       : SDNode<"ISD::CTLZ"      , SDTIntUnaryOp>;
134
135 //===----------------------------------------------------------------------===//
136 // Selection DAG Node Transformation Functions.
137 //
138 // This mechanism allows targets to manipulate nodes in the output DAG once a
139 // match has been formed.  This is typically used to manipulate immediate
140 // values.
141 //
142 class SDNodeXForm<SDNode opc, code xformFunction> {
143   SDNode Opcode = opc;
144   code XFormFunction = xformFunction;
145 }
146
147 def NOOP_SDNodeXForm : SDNodeXForm<imm, [{}]>;
148
149
150 //===----------------------------------------------------------------------===//
151 // Selection DAG Pattern Fragments.
152 //
153 // Pattern fragments are reusable chunks of dags that match specific things.
154 // They can take arguments and have C++ predicates that control whether they
155 // match.  They are intended to make the patterns for common instructions more
156 // compact and readable.
157 //
158
159 /// PatFrag - Represents a pattern fragment.  This can match something on the
160 /// DAG, frame a single node to multiply nested other fragments.
161 ///
162 class PatFrag<dag ops, dag frag, code pred = [{}],
163               SDNodeXForm xform = NOOP_SDNodeXForm> {
164   dag Operands = ops;
165   dag Fragment = frag;
166   code Predicate = pred;
167   SDNodeXForm OperandTransform = xform;
168 }
169
170 // PatLeaf's are pattern fragments that have no operands.  This is just a helper
171 // to define immediates and other common things concisely.
172 class PatLeaf<dag frag, code pred = [{}], SDNodeXForm xform = NOOP_SDNodeXForm>
173  : PatFrag<(ops), frag, pred, xform>;
174
175 // Leaf fragments.
176
177 def immAllOnes : PatLeaf<(imm), [{ return N->isAllOnesValue(); }]>;
178 def immZero    : PatLeaf<(imm), [{ return N->isNullValue();    }]>;
179
180 def vtInt      : PatLeaf<(vt),  [{ return MVT::isInteger(N->getVT()); }]>;
181 def vtFP       : PatLeaf<(vt),  [{ return MVT::isFloatingPoint(N->getVT()); }]>;
182
183 // Other helper fragments.
184
185 def not  : PatFrag<(ops node:$in), (xor node:$in, immAllOnes)>;
186 def ineg : PatFrag<(ops node:$in), (sub immZero, node:$in)>;
187
188 //===----------------------------------------------------------------------===//
189 // Selection DAG Pattern Support.
190 //
191 // Patterns are what are actually matched against the target-flavored
192 // instruction selection DAG.  Instructions defined by the target implicitly
193 // define patterns in most cases, but patterns can also be explicitly added when
194 // an operation is defined by a sequence of instructions (e.g. loading a large
195 // immediate value on RISC targets that do not support immediates as large as
196 // their GPRs).
197 //
198
199 class Pattern<dag patternToMatch, list<dag> resultInstrs> {
200   dag       PatternToMatch = patternToMatch;
201   list<dag> ResultInstrs   = resultInstrs;
202 }
203
204 // Pat - A simple (but common) form of a pattern, which produces a simple result
205 // not needing a full list.
206 class Pat<dag pattern, dag result> : Pattern<pattern, [result]>;
207
208 //===----------------------------------------------------------------------===//
209 // PowerPC specific transformation functions and pattern fragments.
210 //
211 def LO16 : SDNodeXForm<imm, [{
212   // Transformation function: get the low 16 bits.
213   return getI32Imm((unsigned short)N->getValue());
214 }]>;
215
216 def HI16 : SDNodeXForm<imm, [{
217   // Transformation function: shift the immediate value down into the low bits.
218   return getI32Imm((unsigned)N->getValue() >> 16);
219 }]>;
220
221 def HA16 : SDNodeXForm<imm, [{
222   // Transformation function: shift the immediate value down into the low bits.
223   signed int Val = N->getValue();
224   return getI32Imm((Val - (signed short)Val) >> 16);
225 }]>;
226
227
228 def immSExt16  : PatLeaf<(imm), [{
229   // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended
230   // field.  Used by instructions like 'addi'.
231   return (int)N->getValue() == (short)N->getValue();
232 }]>;
233 def immZExt16  : PatLeaf<(imm), [{
234   // immZExt16 predicate - True if the immediate fits in a 16-bit zero extended
235   // field.  Used by instructions like 'ori'.
236   return (unsigned)N->getValue() == (unsigned short)N->getValue();
237 }], LO16>;
238
239 def imm16Shifted : PatLeaf<(imm), [{
240   // imm16Shifted predicate - True if only bits in the top 16-bits of the
241   // immediate are set.  Used by instructions like 'addis'.
242   return ((unsigned)N->getValue() & 0xFFFF0000U) == (unsigned)N->getValue();
243 }], HI16>;
244
245 /*
246 // Example of a legalize expander: Only for PPC64.
247 def : Expander<(set i64:$dst, (fp_to_sint f64:$src)),
248                [(set f64:$tmp , (FCTIDZ f64:$src)),
249                 (set i32:$tmpFI, (CreateNewFrameIndex 8, 8)),
250                 (store f64:$tmp, i32:$tmpFI),
251                 (set i64:$dst, (load i32:$tmpFI))],
252                 Subtarget_PPC64>;
253 */
254
255 //===----------------------------------------------------------------------===//
256 // PowerPC Flag Definitions.
257
258 class isPPC64 { bit PPC64 = 1; }
259 class isVMX   { bit VMX = 1; }
260 class isDOT   {
261   list<Register> Defs = [CR0];
262   bit RC  = 1;
263 }
264
265
266
267 //===----------------------------------------------------------------------===//
268 // PowerPC Operand Definitions.
269
270 def u5imm   : Operand<i32> {
271   let PrintMethod = "printU5ImmOperand";
272 }
273 def u6imm   : Operand<i32> {
274   let PrintMethod = "printU6ImmOperand";
275 }
276 def s16imm  : Operand<i32> {
277   let PrintMethod = "printS16ImmOperand";
278 }
279 def u16imm  : Operand<i32> {
280   let PrintMethod = "printU16ImmOperand";
281 }
282 def target : Operand<i32> {
283   let PrintMethod = "printBranchOperand";
284 }
285 def piclabel: Operand<i32> {
286   let PrintMethod = "printPICLabel";
287 }
288 def symbolHi: Operand<i32> {
289   let PrintMethod = "printSymbolHi";
290 }
291 def symbolLo: Operand<i32> {
292   let PrintMethod = "printSymbolLo";
293 }
294 def crbitm: Operand<i8> {
295   let PrintMethod = "printcrbitm";
296 }
297
298
299
300 //===----------------------------------------------------------------------===//
301 // PowerPC Instruction Definitions.
302
303 // Pseudo-instructions:
304 def PHI : Pseudo<(ops variable_ops), "; PHI">;
305
306 let isLoad = 1 in {
307 def ADJCALLSTACKDOWN : Pseudo<(ops u16imm:$amt), "; ADJCALLSTACKDOWN">;
308 def ADJCALLSTACKUP : Pseudo<(ops u16imm:$amt), "; ADJCALLSTACKUP">;
309 }
310 def IMPLICIT_DEF_GPR : Pseudo<(ops GPRC:$rD), "; $rD = IMPLICIT_DEF_GPRC">;
311 def IMPLICIT_DEF_FP  : Pseudo<(ops FPRC:$rD), "; %rD = IMPLICIT_DEF_FP">;
312
313 // SELECT_CC_* - Used to implement the SELECT_CC DAG operation.  Expanded by the
314 // scheduler into a branch sequence.
315 let usesCustomDAGSchedInserter = 1 in {  // Expanded by the scheduler.
316   def SELECT_CC_Int : Pseudo<(ops GPRC:$dst, CRRC:$cond, GPRC:$T, GPRC:$F,
317                               i32imm:$BROPC), "; SELECT_CC PSEUDO!">;
318   def SELECT_CC_FP  : Pseudo<(ops FPRC:$dst, CRRC:$cond, FPRC:$T, FPRC:$F,
319                               i32imm:$BROPC), "; SELECT_CC PSEUDO!">;
320 }
321
322
323 let isTerminator = 1 in {
324   let isReturn = 1 in
325     def BLR : XLForm_2_ext<19, 16, 20, 0, 0, (ops), "blr">;
326   def BCTR : XLForm_2_ext<19, 528, 20, 0, 0, (ops), "bctr">;
327 }
328
329 let Defs = [LR] in
330   def MovePCtoLR : Pseudo<(ops piclabel:$label), "bl $label">;
331
332 let isBranch = 1, isTerminator = 1 in {
333   def COND_BRANCH : Pseudo<(ops CRRC:$crS, u16imm:$opc,
334                                 target:$true, target:$false),
335                            "; COND_BRANCH">;
336   def B   : IForm<18, 0, 0, (ops target:$func), "b $func">;
337 //def BA  : IForm<18, 1, 0, (ops target:$func), "ba $func">;
338   def BL  : IForm<18, 0, 1, (ops target:$func), "bl $func">;
339 //def BLA : IForm<18, 1, 1, (ops target:$func), "bla $func">;
340
341   // FIXME: 4*CR# needs to be added to the BI field!
342   // This will only work for CR0 as it stands now
343   def BLT : BForm<16, 0, 0, 12, 0, (ops CRRC:$crS, target:$block),
344                   "blt $crS, $block">;
345   def BLE : BForm<16, 0, 0, 4,  1, (ops CRRC:$crS, target:$block),
346                   "ble $crS, $block">;
347   def BEQ : BForm<16, 0, 0, 12, 2, (ops CRRC:$crS, target:$block),
348                   "beq $crS, $block">;
349   def BGE : BForm<16, 0, 0, 4,  0, (ops CRRC:$crS, target:$block),
350                   "bge $crS, $block">;
351   def BGT : BForm<16, 0, 0, 12, 1, (ops CRRC:$crS, target:$block),
352                   "bgt $crS, $block">;
353   def BNE : BForm<16, 0, 0, 4,  2, (ops CRRC:$crS, target:$block),
354                   "bne $crS, $block">;
355 }
356
357 let isCall = 1, 
358   // All calls clobber the non-callee saved registers...
359   Defs = [R0,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,
360           F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,
361           LR,CTR,
362           CR0,CR1,CR5,CR6,CR7] in {
363   // Convenient aliases for call instructions
364   def CALLpcrel : IForm<18, 0, 1, (ops target:$func, variable_ops), "bl $func">;
365   def CALLindirect : XLForm_2_ext<19, 528, 20, 0, 1,
366                                   (ops variable_ops), "bctrl">;
367 }
368
369 // D-Form instructions.  Most instructions that perform an operation on a
370 // register and an immediate are of this type.
371 //
372 let isLoad = 1 in {
373 def LBZ : DForm_1<34, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA),
374                   "lbz $rD, $disp($rA)">;
375 def LHA : DForm_1<42, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA),
376                   "lha $rD, $disp($rA)">;
377 def LHZ : DForm_1<40, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA),
378                   "lhz $rD, $disp($rA)">;
379 def LMW : DForm_1<46, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA),
380                   "lmw $rD, $disp($rA)">;
381 def LWZ : DForm_1<32, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA),
382                   "lwz $rD, $disp($rA)">;
383 def LWZU : DForm_1<35, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA),
384                    "lwzu $rD, $disp($rA)">;
385 }
386 def ADDI   : DForm_2<14, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
387                      "addi $rD, $rA, $imm",
388                      [(set GPRC:$rD, (add GPRC:$rA, immSExt16:$imm))]>;
389 def ADDIC  : DForm_2<12, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
390                      "addic $rD, $rA, $imm",
391                      []>;
392 def ADDICo : DForm_2<13, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
393                      "addic. $rD, $rA, $imm",
394                      []>;
395 def ADDIS  : DForm_2<15, (ops GPRC:$rD, GPRC:$rA, symbolHi:$imm),
396                      "addis $rD, $rA, $imm",
397                      [(set GPRC:$rD, (add GPRC:$rA, imm16Shifted:$imm))]>;
398 def LA     : DForm_2<14, (ops GPRC:$rD, GPRC:$rA, symbolLo:$sym),
399                      "la $rD, $sym($rA)",
400                      []>;
401 def MULLI  : DForm_2< 7, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
402                      "mulli $rD, $rA, $imm",
403                      [(set GPRC:$rD, (mul GPRC:$rA, immSExt16:$imm))]>;
404 def SUBFIC : DForm_2< 8, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm),
405                      "subfic $rD, $rA, $imm",
406                      [(set GPRC:$rD, (sub immSExt16:$imm, GPRC:$rA))]>;
407 def LI  : DForm_2_r0<14, (ops GPRC:$rD, s16imm:$imm),
408                      "li $rD, $imm",
409                      [(set GPRC:$rD, immSExt16:$imm)]>;
410 def LIS : DForm_2_r0<15, (ops GPRC:$rD, symbolHi:$imm),
411                      "lis $rD, $imm",
412                      [(set GPRC:$rD, imm16Shifted:$imm)]>;
413 let isStore = 1 in {
414 def STMW : DForm_3<47, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA),
415                    "stmw $rS, $disp($rA)">;
416 def STB  : DForm_3<38, (ops GPRC:$rS, symbolLo:$disp, GPRC:$rA),
417                    "stb $rS, $disp($rA)">;
418 def STH  : DForm_3<44, (ops GPRC:$rS, symbolLo:$disp, GPRC:$rA),
419                    "sth $rS, $disp($rA)">;
420 def STW  : DForm_3<36, (ops GPRC:$rS, symbolLo:$disp, GPRC:$rA),
421                    "stw $rS, $disp($rA)">;
422 def STWU : DForm_3<37, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA),
423                    "stwu $rS, $disp($rA)">;
424 }
425 def ANDIo : DForm_4<28, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
426                     "andi. $dst, $src1, $src2",
427                     []>, isDOT;
428 def ANDISo : DForm_4<29, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
429                     "andis. $dst, $src1, $src2",
430                     []>, isDOT;
431 def ORI   : DForm_4<24, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
432                     "ori $dst, $src1, $src2",
433                     [(set GPRC:$dst, (or GPRC:$src1, immZExt16:$src2))]>;
434 def ORIS  : DForm_4<25, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
435                     "oris $dst, $src1, $src2",
436                     [(set GPRC:$dst, (or GPRC:$src1, imm16Shifted:$src2))]>;
437 def XORI  : DForm_4<26, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
438                     "xori $dst, $src1, $src2",
439                     [(set GPRC:$dst, (xor GPRC:$src1, immZExt16:$src2))]>;
440 def XORIS : DForm_4<27, (ops GPRC:$dst, GPRC:$src1, u16imm:$src2),
441                     "xoris $dst, $src1, $src2",
442                     [(set GPRC:$dst, (xor GPRC:$src1, imm16Shifted:$src2))]>;
443 def NOP   : DForm_4_zero<24, (ops), "nop">;
444 def CMPI  : DForm_5<11, (ops CRRC:$crD, i1imm:$L, GPRC:$rA, s16imm:$imm),
445                     "cmpi $crD, $L, $rA, $imm">;
446 def CMPWI : DForm_5_ext<11, (ops CRRC:$crD, GPRC:$rA, s16imm:$imm),
447                         "cmpwi $crD, $rA, $imm">;
448 def CMPDI : DForm_5_ext<11, (ops CRRC:$crD, GPRC:$rA, s16imm:$imm),
449                         "cmpdi $crD, $rA, $imm">, isPPC64;
450 def CMPLI  : DForm_6<10, (ops CRRC:$dst, i1imm:$size, GPRC:$src1, u16imm:$src2),
451                      "cmpli $dst, $size, $src1, $src2">;
452 def CMPLWI : DForm_6_ext<10, (ops CRRC:$dst, GPRC:$src1, u16imm:$src2),
453                          "cmplwi $dst, $src1, $src2">;
454 def CMPLDI : DForm_6_ext<10, (ops CRRC:$dst, GPRC:$src1, u16imm:$src2),
455                          "cmpldi $dst, $src1, $src2">, isPPC64;
456 let isLoad = 1 in {
457 def LFS : DForm_8<48, (ops FPRC:$rD, symbolLo:$disp, GPRC:$rA),
458                   "lfs $rD, $disp($rA)">;
459 def LFD : DForm_8<50, (ops FPRC:$rD, symbolLo:$disp, GPRC:$rA),
460                   "lfd $rD, $disp($rA)">;
461 }
462 let isStore = 1 in {
463 def STFS : DForm_9<52, (ops FPRC:$rS, symbolLo:$disp, GPRC:$rA),
464                    "stfs $rS, $disp($rA)">;
465 def STFD : DForm_9<54, (ops FPRC:$rS, symbolLo:$disp, GPRC:$rA),
466                    "stfd $rS, $disp($rA)">;
467 }
468
469 // DS-Form instructions.  Load/Store instructions available in PPC-64
470 //
471 let isLoad = 1 in {
472 def LWA  : DSForm_1<58, 2, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
473                     "lwa $rT, $DS($rA)">, isPPC64;
474 def LD   : DSForm_2<58, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
475                     "ld $rT, $DS($rA)">, isPPC64;
476 }
477 let isStore = 1 in {
478 def STD  : DSForm_2<62, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
479                     "std $rT, $DS($rA)">, isPPC64;
480 def STDU : DSForm_2<62, 1, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA),
481                     "stdu $rT, $DS($rA)">, isPPC64;
482 }
483
484 // X-Form instructions.  Most instructions that perform an operation on a
485 // register and another register are of this type.
486 //
487 let isLoad = 1 in {
488 def LBZX : XForm_1<31,  87, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
489                    "lbzx $dst, $base, $index">;
490 def LHAX : XForm_1<31, 343, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
491                    "lhax $dst, $base, $index">;
492 def LHZX : XForm_1<31, 279, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
493                    "lhzx $dst, $base, $index">;
494 def LWAX : XForm_1<31, 341, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
495                    "lwax $dst, $base, $index">, isPPC64;
496 def LWZX : XForm_1<31,  23, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
497                    "lwzx $dst, $base, $index">;
498 def LDX  : XForm_1<31,  21, (ops GPRC:$dst, GPRC:$base, GPRC:$index),
499                    "ldx $dst, $base, $index">, isPPC64;
500 }
501 def NAND : XForm_6<31, 476, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
502                    "nand $rA, $rS, $rB",
503                    [(set GPRC:$rA, (not (and GPRC:$rS, GPRC:$rB)))]>;
504 def AND  : XForm_6<31,  28, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
505                    "and $rA, $rS, $rB",
506                    [(set GPRC:$rA, (and GPRC:$rS, GPRC:$rB))]>;
507 def ANDo : XForm_6<31,  28, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
508                    "and. $rA, $rS, $rB",
509                    []>, isDOT;
510 def ANDC : XForm_6<31,  60, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
511                    "andc $rA, $rS, $rB",
512                    [(set GPRC:$rA, (and GPRC:$rS, (not GPRC:$rB)))]>;
513 def OR   : XForm_6<31, 444, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
514                    "or $rA, $rS, $rB",
515                    [(set GPRC:$rA, (or GPRC:$rS, GPRC:$rB))]>;
516 def NOR  : XForm_6<31, 124, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
517                    "nor $rA, $rS, $rB",
518                    [(set GPRC:$rA, (not (or GPRC:$rS, GPRC:$rB)))]>;
519 def ORo  : XForm_6<31, 444, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
520                    "or. $rA, $rS, $rB",
521                    []>, isDOT;
522 def ORC  : XForm_6<31, 412, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
523                    "orc $rA, $rS, $rB",
524                    [(set GPRC:$rA, (or GPRC:$rS, (not GPRC:$rB)))]>;
525 def EQV  : XForm_6<31, 284, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
526                    "eqv $rA, $rS, $rB",
527                    [(set GPRC:$rA, (not (xor GPRC:$rS, GPRC:$rB)))]>;
528 def XOR  : XForm_6<31, 316, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
529                    "xor $rA, $rS, $rB",
530                    [(set GPRC:$rA, (xor GPRC:$rS, GPRC:$rB))]>;                   
531 def SLD  : XForm_6<31,  27, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
532                    "sld $rA, $rS, $rB",
533                    []>, isPPC64;
534 def SLW  : XForm_6<31,  24, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
535                    "slw $rA, $rS, $rB",
536                    []>;
537 def SRD  : XForm_6<31, 539, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
538                    "srd $rA, $rS, $rB",
539                    []>, isPPC64;
540 def SRW  : XForm_6<31, 536, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
541                    "srw $rA, $rS, $rB",
542                    []>;
543 def SRAD : XForm_6<31, 794, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
544                    "srad $rA, $rS, $rB",
545                    []>, isPPC64;
546 def SRAW : XForm_6<31, 792, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
547                    "sraw $rA, $rS, $rB",
548                    []>;
549 let isStore = 1 in {
550 def STBX  : XForm_8<31, 215, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
551                    "stbx $rS, $rA, $rB">;
552 def STHX  : XForm_8<31, 407, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
553                    "sthx $rS, $rA, $rB">;
554 def STWX  : XForm_8<31, 151, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
555                    "stwx $rS, $rA, $rB">;
556 def STWUX : XForm_8<31, 183, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
557                    "stwux $rS, $rA, $rB">;
558 def STDX  : XForm_8<31, 149, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
559                    "stdx $rS, $rA, $rB">, isPPC64;
560 def STDUX : XForm_8<31, 181, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB),
561                    "stdux $rS, $rA, $rB">, isPPC64;
562 }
563 def SRAWI : XForm_10<31, 824, (ops GPRC:$rA, GPRC:$rS, u5imm:$SH), 
564                      "srawi $rA, $rS, $SH">;
565 def CNTLZW : XForm_11<31,  26, (ops GPRC:$rA, GPRC:$rS),
566                       "cntlzw $rA, $rS",
567                       [(set GPRC:$rA, (ctlz GPRC:$rS))]>;
568 def EXTSB  : XForm_11<31, 954, (ops GPRC:$rA, GPRC:$rS),
569                       "extsb $rA, $rS",
570                       [(set GPRC:$rA, (sext_inreg GPRC:$rS, i8))]>;
571 def EXTSH  : XForm_11<31, 922, (ops GPRC:$rA, GPRC:$rS),
572                       "extsh $rA, $rS",
573                       [(set GPRC:$rA, (sext_inreg GPRC:$rS, i16))]>;
574 def EXTSW  : XForm_11<31, 986, (ops GPRC:$rA, GPRC:$rS),
575                       "extsw $rA, $rS",
576                       []>, isPPC64;
577 def CMP    : XForm_16<31, 0, (ops CRRC:$crD, i1imm:$long, GPRC:$rA, GPRC:$rB),
578                       "cmp $crD, $long, $rA, $rB">;
579 def CMPL   : XForm_16<31, 32, (ops CRRC:$crD, i1imm:$long, GPRC:$rA, GPRC:$rB),
580                       "cmpl $crD, $long, $rA, $rB">;
581 def CMPW   : XForm_16_ext<31, 0, (ops CRRC:$crD, GPRC:$rA, GPRC:$rB),
582                           "cmpw $crD, $rA, $rB">;
583 def CMPD   : XForm_16_ext<31, 0, (ops CRRC:$crD, GPRC:$rA, GPRC:$rB),
584                           "cmpd $crD, $rA, $rB">, isPPC64;
585 def CMPLW  : XForm_16_ext<31, 32, (ops CRRC:$crD, GPRC:$rA, GPRC:$rB),
586                           "cmplw $crD, $rA, $rB">;
587 def CMPLD  : XForm_16_ext<31, 32, (ops CRRC:$crD, GPRC:$rA, GPRC:$rB),
588                           "cmpld $crD, $rA, $rB">, isPPC64;
589 def FCMPO  : XForm_17<63, 32, (ops CRRC:$crD, FPRC:$fA, FPRC:$fB),
590                       "fcmpo $crD, $fA, $fB">;
591 def FCMPU  : XForm_17<63, 0, (ops CRRC:$crD, FPRC:$fA, FPRC:$fB),
592                       "fcmpu $crD, $fA, $fB">;
593 let isLoad = 1 in {
594 def LFSX   : XForm_25<31, 535, (ops FPRC:$dst, GPRC:$base, GPRC:$index),
595                       "lfsx $dst, $base, $index">;
596 def LFDX   : XForm_25<31, 599, (ops FPRC:$dst, GPRC:$base, GPRC:$index),
597                       "lfdx $dst, $base, $index">;
598 }
599 def FCFID  : XForm_26<63, 846, (ops FPRC:$frD, FPRC:$frB),
600                       "fcfid $frD, $frB">, isPPC64;
601 def FCTIDZ : XForm_26<63, 815, (ops FPRC:$frD, FPRC:$frB),
602                       "fctidz $frD, $frB">, isPPC64;
603 def FCTIWZ : XForm_26<63, 15, (ops FPRC:$frD, FPRC:$frB),
604                       "fctiwz $frD, $frB">;
605 def FABS   : XForm_26<63, 264, (ops FPRC:$frD, FPRC:$frB),
606                       "fabs $frD, $frB">;
607 def FMR    : XForm_26<63, 72, (ops FPRC:$frD, FPRC:$frB),
608                       "fmr $frD, $frB">;
609 def FNABS  : XForm_26<63, 136, (ops FPRC:$frD, FPRC:$frB),
610                       "fnabs $frD, $frB">;
611 def FNEG   : XForm_26<63, 40, (ops FPRC:$frD, FPRC:$frB),
612                       "fneg $frD, $frB">;
613 def FRSP   : XForm_26<63, 12, (ops FPRC:$frD, FPRC:$frB),
614                       "frsp $frD, $frB">;
615 def FSQRT  : XForm_26<63, 22, (ops FPRC:$frD, FPRC:$frB),
616                       "fsqrt $frD, $frB">;
617 def FSQRTS : XForm_26<59, 22, (ops FPRC:$frD, FPRC:$frB),
618                       "fsqrts $frD, $frB">;
619                       
620 let isStore = 1 in {
621 def STFSX : XForm_28<31, 663, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB),
622                      "stfsx $frS, $rA, $rB">;
623 def STFDX : XForm_28<31, 727, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB),
624                      "stfdx $frS, $rA, $rB">;
625 }
626
627 // XL-Form instructions.  condition register logical ops.
628 //
629 def MCRF   : XLForm_3<19, 0, (ops CRRC:$BF, CRRC:$BFA),
630                       "mcrf $BF, $BFA">;
631
632 // XFX-Form instructions.  Instructions that deal with SPRs
633 //
634 // Note that although LR should be listed as `8' and CTR as `9' in the SPR
635 // field, the manual lists the groups of bits as [5-9] = 0, [0-4] = 8 or 9
636 // which means the SPR value needs to be multiplied by a factor of 32.
637 def MFCTR : XFXForm_1_ext<31, 339, 288, (ops GPRC:$rT), "mfctr $rT">;
638 def MFLR  : XFXForm_1_ext<31, 339, 256, (ops GPRC:$rT), "mflr $rT">;
639 def MFCR  : XFXForm_3<31, 19, (ops GPRC:$rT), "mfcr $rT">;
640 def MTCRF : XFXForm_5<31, 144, (ops crbitm:$FXM, GPRC:$rS),
641                       "mtcrf $FXM, $rS">;
642 def MFOCRF : XFXForm_5a<31, 19, (ops GPRC:$rT, crbitm:$FXM),
643                         "mfcr $rT, $FXM">;
644 def MTCTR : XFXForm_7_ext<31, 467, 288, (ops GPRC:$rS), "mtctr $rS">;
645 def MTLR  : XFXForm_7_ext<31, 467, 256, (ops GPRC:$rS), "mtlr $rS">;
646
647 // XS-Form instructions.  Just 'sradi'
648 //
649 def SRADI  : XSForm_1<31, 413, (ops GPRC:$rA, GPRC:$rS, u6imm:$SH),
650                       "sradi $rA, $rS, $SH">, isPPC64;
651
652 // XO-Form instructions.  Arithmetic instructions that can set overflow bit
653 //
654 def ADD   : XOForm_1<31, 266, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
655                      "add $rT, $rA, $rB",
656                      [(set GPRC:$rT, (add GPRC:$rA, GPRC:$rB))]>;
657 def ADDC  : XOForm_1<31, 10, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
658                      "addc $rT, $rA, $rB",
659                      []>;
660 def ADDE  : XOForm_1<31, 138, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
661                      "adde $rT, $rA, $rB",
662                      []>;
663 def DIVD  : XOForm_1<31, 489, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
664                      "divd $rT, $rA, $rB",
665                      []>, isPPC64;
666 def DIVDU : XOForm_1<31, 457, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
667                      "divdu $rT, $rA, $rB",
668                      []>, isPPC64;
669 def DIVW  : XOForm_1<31, 491, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
670                      "divw $rT, $rA, $rB",
671                      [(set GPRC:$rT, (sdiv GPRC:$rA, GPRC:$rB))]>;
672 def DIVWU : XOForm_1<31, 459, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
673                      "divwu $rT, $rA, $rB",
674                      [(set GPRC:$rT, (udiv GPRC:$rA, GPRC:$rB))]>;
675 def MULHW : XOForm_1<31, 75, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
676                      "mulhw $rT, $rA, $rB",
677                      [(set GPRC:$rT, (mulhs GPRC:$rA, GPRC:$rB))]>;
678 def MULHWU : XOForm_1<31, 11, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
679                      "mulhwu $rT, $rA, $rB",
680                      [(set GPRC:$rT, (mulhu GPRC:$rA, GPRC:$rB))]>;
681 def MULLD : XOForm_1<31, 233, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
682                      "mulld $rT, $rA, $rB",
683                      []>, isPPC64;
684 def MULLW : XOForm_1<31, 235, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
685                      "mullw $rT, $rA, $rB",
686                      [(set GPRC:$rT, (mul GPRC:$rA, GPRC:$rB))]>;
687 def SUBF  : XOForm_1<31, 40, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
688                      "subf $rT, $rA, $rB",
689                      [(set GPRC:$rT, (sub GPRC:$rB, GPRC:$rA))]>;
690 def SUBFC : XOForm_1<31, 8, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
691                      "subfc $rT, $rA, $rB",
692                      []>;
693 def SUBFE : XOForm_1<31, 136, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB),
694                      "subfe $rT, $rA, $rB",
695                      []>;
696 def ADDME  : XOForm_3<31, 234, 0, (ops GPRC:$rT, GPRC:$rA),
697                       "addme $rT, $rA",
698                       []>;
699 def ADDZE  : XOForm_3<31, 202, 0, (ops GPRC:$rT, GPRC:$rA),
700                       "addze $rT, $rA",
701                       []>;
702 def NEG    : XOForm_3<31, 104, 0, (ops GPRC:$rT, GPRC:$rA),
703                       "neg $rT, $rA",
704                       [(set GPRC:$rT, (ineg GPRC:$rA))]>;
705 def SUBFZE : XOForm_3<31, 200, 0, (ops GPRC:$rT, GPRC:$rA),
706                       "subfze $rT, $rA",
707                       []>;
708
709 // A-Form instructions.  Most of the instructions executed in the FPU are of
710 // this type.
711 //
712 def FMADD : AForm_1<63, 29, 
713                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
714                     "fmadd $FRT, $FRA, $FRC, $FRB">;
715 def FMADDS : AForm_1<59, 29,
716                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
717                     "fmadds $FRT, $FRA, $FRC, $FRB">;
718 def FMSUB : AForm_1<63, 28,
719                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
720                     "fmsub $FRT, $FRA, $FRC, $FRB">;
721 def FMSUBS : AForm_1<59, 28,
722                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
723                     "fmsubs $FRT, $FRA, $FRC, $FRB">;
724 def FNMADD : AForm_1<63, 31,
725                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
726                     "fnmadd $FRT, $FRA, $FRC, $FRB">;
727 def FNMADDS : AForm_1<59, 31,
728                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
729                     "fnmadds $FRT, $FRA, $FRC, $FRB">;
730 def FNMSUB : AForm_1<63, 30,
731                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
732                     "fnmsub $FRT, $FRA, $FRC, $FRB">;
733 def FNMSUBS : AForm_1<59, 30,
734                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
735                     "fnmsubs $FRT, $FRA, $FRC, $FRB">;
736 def FSEL  : AForm_1<63, 23,
737                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB),
738                     "fsel $FRT, $FRA, $FRC, $FRB">;
739 def FADD  : AForm_2<63, 21,
740                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
741                     "fadd $FRT, $FRA, $FRB">;
742 def FADDS : AForm_2<59, 21,
743                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
744                     "fadds $FRT, $FRA, $FRB">;
745 def FDIV  : AForm_2<63, 18,
746                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
747                     "fdiv $FRT, $FRA, $FRB">;
748 def FDIVS : AForm_2<59, 18,
749                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
750                     "fdivs $FRT, $FRA, $FRB">;
751 def FMUL  : AForm_3<63, 25,
752                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
753                     "fmul $FRT, $FRA, $FRB">;
754 def FMULS : AForm_3<59, 25,
755                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
756                     "fmuls $FRT, $FRA, $FRB">;
757 def FSUB  : AForm_2<63, 20,
758                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
759                     "fsub $FRT, $FRA, $FRB">;
760 def FSUBS : AForm_2<59, 20,
761                     (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB),
762                     "fsubs $FRT, $FRA, $FRB">;
763
764 // M-Form instructions.  rotate and mask instructions.
765 //
766 let isTwoAddress = 1, isCommutable = 1 in {
767 // RLWIMI can be commuted if the rotate amount is zero.
768 def RLWIMI : MForm_2<20,
769                      (ops GPRC:$rA, GPRC:$rSi, GPRC:$rS, u5imm:$SH, u5imm:$MB, 
770                       u5imm:$ME), "rlwimi $rA, $rS, $SH, $MB, $ME">;
771 }
772 def RLWINM : MForm_2<21,
773                      (ops GPRC:$rA, GPRC:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME),
774                      "rlwinm $rA, $rS, $SH, $MB, $ME">;
775 def RLWINMo : MForm_2<21,
776                      (ops GPRC:$rA, GPRC:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME),
777                      "rlwinm. $rA, $rS, $SH, $MB, $ME">, isDOT;
778 def RLWNM  : MForm_2<23,
779                      (ops GPRC:$rA, GPRC:$rS, GPRC:$rB, u5imm:$MB, u5imm:$ME),
780                      "rlwnm $rA, $rS, $rB, $MB, $ME">;
781
782 // MD-Form instructions.  64 bit rotate instructions.
783 //
784 def RLDICL : MDForm_1<30, 0,
785                       (ops GPRC:$rA, GPRC:$rS, u6imm:$SH, u6imm:$MB),
786                       "rldicl $rA, $rS, $SH, $MB">, isPPC64;
787 def RLDICR : MDForm_1<30, 1,
788                       (ops GPRC:$rA, GPRC:$rS, u6imm:$SH, u6imm:$ME),
789                       "rldicr $rA, $rS, $SH, $ME">, isPPC64;
790
791 //===----------------------------------------------------------------------===//
792 // PowerPC Instruction Patterns
793 //
794
795 // Arbitrary immediate support.  Implement in terms of LIS/ORI.
796 def : Pat<(i32 imm:$imm),
797           (ORI (LIS (HI16 imm:$imm)), (LO16 imm:$imm))>;
798
799
800 // Implement the 'not' operation with the NOR instruction.
801 def NOT : Pat<(not GPRC:$in),
802               (NOR GPRC:$in, GPRC:$in)>;
803
804 // EQV patterns
805 // FIXME: This should be autogenerated from the above due to xor association.
806 def EQV1 : Pat<(xor (not GPRC:$in1), GPRC:$in2),
807                (EQV GPRC:$in1, GPRC:$in2)>;
808
809 // ADD an arbitrary immediate.
810 def : Pat<(add GPRC:$in, imm:$imm),
811           (ADDIS (ADDI GPRC:$in, (LO16 imm:$imm)), (HA16 imm:$imm))>;
812 // OR an arbitrary immediate.
813 def : Pat<(or GPRC:$in, imm:$imm),
814           (ORIS (ORI GPRC:$in, (LO16 imm:$imm)), (HI16 imm:$imm))>;
815 // XOR an arbitrary immediate.
816 def : Pat<(xor GPRC:$in, imm:$imm),
817           (XORIS (XORI GPRC:$in, (LO16 imm:$imm)), (HI16 imm:$imm))>;
818
819
820
821 // Same as above, but using a temporary. FIXME: implement temporaries :)
822 /*
823 def : Pattern<(xor GPRC:$in, imm:$imm),
824               [(set GPRC:$tmp, (XORI GPRC:$in, (LO16 imm:$imm))),
825                (XORIS GPRC:$tmp, (HI16 imm:$imm))]>;
826 */
827
828
829 //===----------------------------------------------------------------------===//
830 // PowerPCInstrInfo Definition
831 //
832 def PowerPCInstrInfo : InstrInfo {
833   let PHIInst  = PHI;
834
835   let TSFlagsFields = [ "VMX", "PPC64" ];
836   let TSFlagsShifts = [ 0, 1 ];
837
838   let isLittleEndianEncoding = 1;
839 }
840