1 //===- MSP430InstrInfo.td - MSP430 Instruction defs -----------*- tblgen-*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the MSP430 instructions in TableGen format.
12 //===----------------------------------------------------------------------===//
14 include "MSP430InstrFormats.td"
16 //===----------------------------------------------------------------------===//
18 //===----------------------------------------------------------------------===//
19 class SDTCisI8<int OpNum> : SDTCisVT<OpNum, i8>;
20 class SDTCisI16<int OpNum> : SDTCisVT<OpNum, i16>;
22 //===----------------------------------------------------------------------===//
24 //===----------------------------------------------------------------------===//
25 def SDT_MSP430Call : SDTypeProfile<0, -1, [SDTCisVT<0, iPTR>]>;
26 def SDT_MSP430CallSeqStart : SDCallSeqStart<[SDTCisVT<0, i16>]>;
27 def SDT_MSP430CallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i16>, SDTCisVT<1, i16>]>;
28 def SDT_MSP430Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>;
29 def SDT_MSP430Cmp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>;
30 def SDT_MSP430BrCC : SDTypeProfile<0, 2, [SDTCisVT<0, OtherVT>,
32 def SDT_MSP430SelectCC : SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>,
34 def SDT_MSP430Shift : SDTypeProfile<1, 2, [SDTCisSameAs<0, 1>, SDTCisI8<2>]>;
36 //===----------------------------------------------------------------------===//
37 // MSP430 Specific Node Definitions.
38 //===----------------------------------------------------------------------===//
39 def MSP430retflag : SDNode<"MSP430ISD::RET_FLAG", SDTNone,
40 [SDNPHasChain, SDNPOptInFlag]>;
41 def MSP430retiflag : SDNode<"MSP430ISD::RETI_FLAG", SDTNone,
42 [SDNPHasChain, SDNPOptInFlag]>;
44 def MSP430rra : SDNode<"MSP430ISD::RRA", SDTIntUnaryOp, []>;
45 def MSP430rla : SDNode<"MSP430ISD::RLA", SDTIntUnaryOp, []>;
46 def MSP430rrc : SDNode<"MSP430ISD::RRC", SDTIntUnaryOp, []>;
48 def MSP430call : SDNode<"MSP430ISD::CALL", SDT_MSP430Call,
49 [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag]>;
50 def MSP430callseq_start :
51 SDNode<"ISD::CALLSEQ_START", SDT_MSP430CallSeqStart,
52 [SDNPHasChain, SDNPOutFlag]>;
53 def MSP430callseq_end :
54 SDNode<"ISD::CALLSEQ_END", SDT_MSP430CallSeqEnd,
55 [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>;
56 def MSP430Wrapper : SDNode<"MSP430ISD::Wrapper", SDT_MSP430Wrapper>;
57 def MSP430cmp : SDNode<"MSP430ISD::CMP", SDT_MSP430Cmp, [SDNPOutFlag]>;
58 def MSP430brcc : SDNode<"MSP430ISD::BR_CC", SDT_MSP430BrCC, [SDNPHasChain, SDNPInFlag]>;
59 def MSP430selectcc: SDNode<"MSP430ISD::SELECT_CC", SDT_MSP430SelectCC, [SDNPInFlag]>;
60 def MSP430shl : SDNode<"MSP430ISD::SHL", SDT_MSP430Shift, []>;
61 def MSP430sra : SDNode<"MSP430ISD::SRA", SDT_MSP430Shift, []>;
62 def MSP430srl : SDNode<"MSP430ISD::SRL", SDT_MSP430Shift, []>;
64 //===----------------------------------------------------------------------===//
65 // MSP430 Operand Definitions.
66 //===----------------------------------------------------------------------===//
69 def memsrc : Operand<i16> {
70 let PrintMethod = "printSrcMemOperand";
71 let MIOperandInfo = (ops GR16, i16imm);
74 def memdst : Operand<i16> {
75 let PrintMethod = "printSrcMemOperand";
76 let MIOperandInfo = (ops GR16, i16imm);
79 // Branch targets have OtherVT type.
80 def brtarget : Operand<OtherVT> {
81 let PrintMethod = "printPCRelImmOperand";
84 // Operand for printing out a condition code.
85 def cc : Operand<i8> {
86 let PrintMethod = "printCCOperand";
89 //===----------------------------------------------------------------------===//
90 // MSP430 Complex Pattern Definitions.
91 //===----------------------------------------------------------------------===//
93 def addr : ComplexPattern<iPTR, 2, "SelectAddr", [], []>;
95 //===----------------------------------------------------------------------===//
97 def zextloadi16i8 : PatFrag<(ops node:$ptr), (i16 (zextloadi8 node:$ptr))>;
98 def extloadi16i8 : PatFrag<(ops node:$ptr), (i16 ( extloadi8 node:$ptr))>;
99 def and_su : PatFrag<(ops node:$lhs, node:$rhs), (and node:$lhs, node:$rhs), [{
100 return N->hasOneUse();
102 //===----------------------------------------------------------------------===//
103 // Instruction list..
105 // ADJCALLSTACKDOWN/UP implicitly use/def SP because they may be expanded into
106 // a stack adjustment and the codegen must know that they may modify the stack
107 // pointer before prolog-epilog rewriting occurs.
108 // Pessimistically assume ADJCALLSTACKDOWN / ADJCALLSTACKUP will become
109 // sub / add which can clobber SRW.
110 let Defs = [SPW, SRW], Uses = [SPW] in {
111 def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i16imm:$amt),
113 [(MSP430callseq_start timm:$amt)]>;
114 def ADJCALLSTACKUP : Pseudo<(outs), (ins i16imm:$amt1, i16imm:$amt2),
116 [(MSP430callseq_end timm:$amt1, timm:$amt2)]>;
119 let usesCustomInserter = 1 in {
120 def Select8 : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2, i8imm:$cc),
123 (MSP430selectcc GR8:$src1, GR8:$src2, imm:$cc))]>;
124 def Select16 : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2, i8imm:$cc),
127 (MSP430selectcc GR16:$src1, GR16:$src2, imm:$cc))]>;
128 let Defs = [SRW] in {
129 def Shl8 : Pseudo<(outs GR8:$dst), (ins GR8:$src, GR8:$cnt),
131 [(set GR8:$dst, (MSP430shl GR8:$src, GR8:$cnt))]>;
132 def Shl16 : Pseudo<(outs GR16:$dst), (ins GR16:$src, GR8:$cnt),
134 [(set GR16:$dst, (MSP430shl GR16:$src, GR8:$cnt))]>;
135 def Sra8 : Pseudo<(outs GR8:$dst), (ins GR8:$src, GR8:$cnt),
137 [(set GR8:$dst, (MSP430sra GR8:$src, GR8:$cnt))]>;
138 def Sra16 : Pseudo<(outs GR16:$dst), (ins GR16:$src, GR8:$cnt),
140 [(set GR16:$dst, (MSP430sra GR16:$src, GR8:$cnt))]>;
141 def Srl8 : Pseudo<(outs GR8:$dst), (ins GR8:$src, GR8:$cnt),
143 [(set GR8:$dst, (MSP430srl GR8:$src, GR8:$cnt))]>;
144 def Srl16 : Pseudo<(outs GR16:$dst), (ins GR16:$src, GR8:$cnt),
146 [(set GR16:$dst, (MSP430srl GR16:$src, GR8:$cnt))]>;
151 let neverHasSideEffects = 1 in
152 def NOP : Pseudo<(outs), (ins), "nop", []>;
154 //===----------------------------------------------------------------------===//
155 // Control Flow Instructions...
158 // FIXME: Provide proper encoding!
159 let isReturn = 1, isTerminator = 1, isBarrier = 1 in {
160 def RET : Pseudo<(outs), (ins), "ret", [(MSP430retflag)]>;
161 def RETI : Pseudo<(outs), (ins), "reti", [(MSP430retiflag)]>;
164 let isBranch = 1, isTerminator = 1 in {
168 def JMP : Pseudo<(outs), (ins brtarget:$dst),
172 // Conditional branches
174 def JCC : Pseudo<(outs), (ins brtarget:$dst, cc:$cc),
176 [(MSP430brcc bb:$dst, imm:$cc)]>;
177 } // isBranch, isTerminator
179 //===----------------------------------------------------------------------===//
180 // Call Instructions...
183 // All calls clobber the non-callee saved registers. SPW is marked as
184 // a use to prevent stack-pointer assignments that appear immediately
185 // before calls from potentially appearing dead. Uses for argument
186 // registers are added manually.
187 let Defs = [R12W, R13W, R14W, R15W, SRW],
189 def CALLi : Pseudo<(outs), (ins i16imm:$dst, variable_ops),
190 "call\t$dst", [(MSP430call imm:$dst)]>;
191 def CALLr : Pseudo<(outs), (ins GR16:$dst, variable_ops),
192 "call\t$dst", [(MSP430call GR16:$dst)]>;
193 def CALLm : Pseudo<(outs), (ins memsrc:$dst, variable_ops),
194 "call\t${dst:mem}", [(MSP430call (load addr:$dst))]>;
198 //===----------------------------------------------------------------------===//
199 // Miscellaneous Instructions...
201 let Defs = [SPW], Uses = [SPW], neverHasSideEffects=1 in {
203 def POP16r : Pseudo<(outs GR16:$reg), (ins), "pop.w\t$reg", []>;
206 def PUSH16r : Pseudo<(outs), (ins GR16:$reg), "push.w\t$reg",[]>;
209 //===----------------------------------------------------------------------===//
212 // FIXME: Provide proper encoding!
213 let neverHasSideEffects = 1 in {
214 def MOV8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src),
215 "mov.b\t{$src, $dst}",
217 def MOV16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src),
218 "mov.w\t{$src, $dst}",
222 // FIXME: Provide proper encoding!
223 let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
224 def MOV8ri : Pseudo<(outs GR8:$dst), (ins i8imm:$src),
225 "mov.b\t{$src, $dst}",
226 [(set GR8:$dst, imm:$src)]>;
227 def MOV16ri : Pseudo<(outs GR16:$dst), (ins i16imm:$src),
228 "mov.w\t{$src, $dst}",
229 [(set GR16:$dst, imm:$src)]>;
232 let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in {
233 def MOV8rm : Pseudo<(outs GR8:$dst), (ins memsrc:$src),
234 "mov.b\t{$src, $dst}",
235 [(set GR8:$dst, (load addr:$src))]>;
236 def MOV16rm : Pseudo<(outs GR16:$dst), (ins memsrc:$src),
237 "mov.w\t{$src, $dst}",
238 [(set GR16:$dst, (load addr:$src))]>;
241 def MOVZX16rr8 : Pseudo<(outs GR16:$dst), (ins GR8:$src),
242 "mov.b\t{$src, $dst}",
243 [(set GR16:$dst, (zext GR8:$src))]>;
244 def MOVZX16rm8 : Pseudo<(outs GR16:$dst), (ins memsrc:$src),
245 "mov.b\t{$src, $dst}",
246 [(set GR16:$dst, (zextloadi16i8 addr:$src))]>;
248 let mayLoad = 1, hasExtraDefRegAllocReq = 1, Constraints = "$base = $base_wb" in {
249 def MOV8rm_POST : Pseudo<(outs GR8:$dst, GR16:$base_wb), (ins GR16:$base),
250 "mov.b\t{@$base+, $dst}", []>;
251 def MOV16rm_POST : Pseudo<(outs GR16:$dst, GR16:$base_wb), (ins GR16:$base),
252 "mov.w\t{@$base+, $dst}", []>;
255 // Any instruction that defines a 8-bit result leaves the high half of the
256 // register. Truncate can be lowered to EXTRACT_SUBREG, and CopyFromReg may
257 // be copying from a truncate, but any other 8-bit operation will zero-extend
259 def def8 : PatLeaf<(i8 GR8:$src), [{
260 return N->getOpcode() != ISD::TRUNCATE &&
261 N->getOpcode() != TargetInstrInfo::EXTRACT_SUBREG &&
262 N->getOpcode() != ISD::CopyFromReg;
265 // In the case of a 8-bit def that is known to implicitly zero-extend,
266 // we can use a SUBREG_TO_REG.
267 def : Pat<(i16 (zext def8:$src)),
268 (SUBREG_TO_REG (i16 0), GR8:$src, subreg_8bit)>;
271 def MOV8mi : Pseudo<(outs), (ins memdst:$dst, i8imm:$src),
272 "mov.b\t{$src, $dst}",
273 [(store (i8 imm:$src), addr:$dst)]>;
274 def MOV16mi : Pseudo<(outs), (ins memdst:$dst, i16imm:$src),
275 "mov.w\t{$src, $dst}",
276 [(store (i16 imm:$src), addr:$dst)]>;
278 def MOV8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
279 "mov.b\t{$src, $dst}",
280 [(store GR8:$src, addr:$dst)]>;
281 def MOV16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
282 "mov.w\t{$src, $dst}",
283 [(store GR16:$src, addr:$dst)]>;
285 def MOV8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
286 "mov.b\t{$src, $dst}",
287 [(store (i8 (load addr:$src)), addr:$dst)]>;
288 def MOV16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
289 "mov.w\t{$src, $dst}",
290 [(store (i16 (load addr:$src)), addr:$dst)]>;
292 //===----------------------------------------------------------------------===//
293 // Arithmetic Instructions
295 let isTwoAddress = 1 in {
297 let Defs = [SRW] in {
299 let isCommutable = 1 in { // X = ADD Y, Z == X = ADD Z, Y
300 // FIXME: Provide proper encoding!
301 def ADD8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
302 "add.b\t{$src2, $dst}",
303 [(set GR8:$dst, (add GR8:$src1, GR8:$src2)),
305 def ADD16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
306 "add.w\t{$src2, $dst}",
307 [(set GR16:$dst, (add GR16:$src1, GR16:$src2)),
311 def ADD8rm : Pseudo<(outs GR8:$dst), (ins GR8:$src1, memsrc:$src2),
312 "add.b\t{$src2, $dst}",
313 [(set GR8:$dst, (add GR8:$src1, (load addr:$src2))),
315 def ADD16rm : Pseudo<(outs GR16:$dst), (ins GR16:$src1, memsrc:$src2),
316 "add.w\t{$src2, $dst}",
317 [(set GR16:$dst, (add GR16:$src1, (load addr:$src2))),
320 let mayLoad = 1, hasExtraDefRegAllocReq = 1,
321 Constraints = "$base = $base_wb, $src1 = $dst" in {
322 def ADD8rm_POST : Pseudo<(outs GR8:$dst, GR16:$base_wb), (ins GR8:$src1, GR16:$base),
323 "add.b\t{@$base+, $dst}", []>;
324 def ADD16rm_POST : Pseudo<(outs GR16:$dst, GR16:$base_wb), (ins GR16:$src1, GR16:$base),
325 "add.w\t{@$base+, $dst}", []>;
329 def ADD8ri : Pseudo<(outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
330 "add.b\t{$src2, $dst}",
331 [(set GR8:$dst, (add GR8:$src1, imm:$src2)),
333 def ADD16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
334 "add.w\t{$src2, $dst}",
335 [(set GR16:$dst, (add GR16:$src1, imm:$src2)),
338 let isTwoAddress = 0 in {
339 def ADD8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
340 "add.b\t{$src, $dst}",
341 [(store (add (load addr:$dst), GR8:$src), addr:$dst),
343 def ADD16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
344 "add.w\t{$src, $dst}",
345 [(store (add (load addr:$dst), GR16:$src), addr:$dst),
348 def ADD8mi : Pseudo<(outs), (ins memdst:$dst, i8imm:$src),
349 "add.b\t{$src, $dst}",
350 [(store (add (load addr:$dst), (i8 imm:$src)), addr:$dst),
352 def ADD16mi : Pseudo<(outs), (ins memdst:$dst, i16imm:$src),
353 "add.w\t{$src, $dst}",
354 [(store (add (load addr:$dst), (i16 imm:$src)), addr:$dst),
357 def ADD8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
358 "add.b\t{$src, $dst}",
359 [(store (add (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
361 def ADD16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
362 "add.w\t{$src, $dst}",
363 [(store (add (load addr:$dst), (i16 (load addr:$src))), addr:$dst),
367 let Uses = [SRW] in {
369 let isCommutable = 1 in { // X = ADDC Y, Z == X = ADDC Z, Y
370 def ADC8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
371 "addc.b\t{$src2, $dst}",
372 [(set GR8:$dst, (adde GR8:$src1, GR8:$src2)),
374 def ADC16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
375 "addc.w\t{$src2, $dst}",
376 [(set GR16:$dst, (adde GR16:$src1, GR16:$src2)),
380 def ADC8ri : Pseudo<(outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
381 "addc.b\t{$src2, $dst}",
382 [(set GR8:$dst, (adde GR8:$src1, imm:$src2)),
384 def ADC16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
385 "addc.w\t{$src2, $dst}",
386 [(set GR16:$dst, (adde GR16:$src1, imm:$src2)),
389 def ADC8rm : Pseudo<(outs GR8:$dst), (ins GR8:$src1, memsrc:$src2),
390 "addc.b\t{$src2, $dst}",
391 [(set GR8:$dst, (adde GR8:$src1, (load addr:$src2))),
393 def ADC16rm : Pseudo<(outs GR16:$dst), (ins GR16:$src1, memsrc:$src2),
394 "addc.w\t{$src2, $dst}",
395 [(set GR16:$dst, (adde GR16:$src1, (load addr:$src2))),
398 let isTwoAddress = 0 in {
399 def ADC8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
400 "addc.b\t{$src, $dst}",
401 [(store (adde (load addr:$dst), GR8:$src), addr:$dst),
403 def ADC16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
404 "addc.w\t{$src, $dst}",
405 [(store (adde (load addr:$dst), GR16:$src), addr:$dst),
408 def ADC8mi : Pseudo<(outs), (ins memdst:$dst, i8imm:$src),
409 "addc.b\t{$src, $dst}",
410 [(store (adde (load addr:$dst), (i8 imm:$src)), addr:$dst),
412 def ADC16mi : Pseudo<(outs), (ins memdst:$dst, i16imm:$src),
413 "addc.w\t{$src, $dst}",
414 [(store (adde (load addr:$dst), (i16 imm:$src)), addr:$dst),
417 def ADC8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
418 "addc.b\t{$src, $dst}",
419 [(store (adde (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
421 def ADC16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
422 "addc.w\t{$src, $dst}",
423 [(store (adde (load addr:$dst), (i16 (load addr:$src))), addr:$dst),
429 let isCommutable = 1 in { // X = AND Y, Z == X = AND Z, Y
430 def AND8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
431 "and.b\t{$src2, $dst}",
432 [(set GR8:$dst, (and GR8:$src1, GR8:$src2)),
434 def AND16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
435 "and.w\t{$src2, $dst}",
436 [(set GR16:$dst, (and GR16:$src1, GR16:$src2)),
440 def AND8ri : Pseudo<(outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
441 "and.b\t{$src2, $dst}",
442 [(set GR8:$dst, (and GR8:$src1, imm:$src2)),
444 def AND16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
445 "and.w\t{$src2, $dst}",
446 [(set GR16:$dst, (and GR16:$src1, imm:$src2)),
449 def AND8rm : Pseudo<(outs GR8:$dst), (ins GR8:$src1, memsrc:$src2),
450 "and.b\t{$src2, $dst}",
451 [(set GR8:$dst, (and GR8:$src1, (load addr:$src2))),
453 def AND16rm : Pseudo<(outs GR16:$dst), (ins GR16:$src1, memsrc:$src2),
454 "and.w\t{$src2, $dst}",
455 [(set GR16:$dst, (and GR16:$src1, (load addr:$src2))),
458 let mayLoad = 1, hasExtraDefRegAllocReq = 1,
459 Constraints = "$base = $base_wb, $src1 = $dst" in {
460 def AND8rm_POST : Pseudo<(outs GR8:$dst, GR16:$base_wb), (ins GR8:$src1, GR16:$base),
461 "and.b\t{@$base+, $dst}", []>;
462 def AND16rm_POST : Pseudo<(outs GR16:$dst, GR16:$base_wb), (ins GR16:$src1, GR16:$base),
463 "and.w\t{@$base+, $dst}", []>;
466 let isTwoAddress = 0 in {
467 def AND8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
468 "and.b\t{$src, $dst}",
469 [(store (and (load addr:$dst), GR8:$src), addr:$dst),
471 def AND16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
472 "and.w\t{$src, $dst}",
473 [(store (and (load addr:$dst), GR16:$src), addr:$dst),
476 def AND8mi : Pseudo<(outs), (ins memdst:$dst, i8imm:$src),
477 "and.b\t{$src, $dst}",
478 [(store (and (load addr:$dst), (i8 imm:$src)), addr:$dst),
480 def AND16mi : Pseudo<(outs), (ins memdst:$dst, i16imm:$src),
481 "and.w\t{$src, $dst}",
482 [(store (and (load addr:$dst), (i16 imm:$src)), addr:$dst),
485 def AND8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
486 "and.b\t{$src, $dst}",
487 [(store (and (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
489 def AND16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
490 "and.w\t{$src, $dst}",
491 [(store (and (load addr:$dst), (i16 (load addr:$src))), addr:$dst),
495 let isCommutable = 1 in { // X = OR Y, Z == X = OR Z, Y
496 def OR8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
497 "bis.b\t{$src2, $dst}",
498 [(set GR8:$dst, (or GR8:$src1, GR8:$src2))]>;
499 def OR16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
500 "bis.w\t{$src2, $dst}",
501 [(set GR16:$dst, (or GR16:$src1, GR16:$src2))]>;
504 def OR8ri : Pseudo<(outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
505 "bis.b\t{$src2, $dst}",
506 [(set GR8:$dst, (or GR8:$src1, imm:$src2))]>;
507 def OR16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
508 "bis.w\t{$src2, $dst}",
509 [(set GR16:$dst, (or GR16:$src1, imm:$src2))]>;
511 def OR8rm : Pseudo<(outs GR8:$dst), (ins GR8:$src1, memsrc:$src2),
512 "bis.b\t{$src2, $dst}",
513 [(set GR8:$dst, (or GR8:$src1, (load addr:$src2)))]>;
514 def OR16rm : Pseudo<(outs GR16:$dst), (ins GR16:$src1, memsrc:$src2),
515 "bis.w\t{$src2, $dst}",
516 [(set GR16:$dst, (or GR16:$src1, (load addr:$src2)))]>;
518 let mayLoad = 1, hasExtraDefRegAllocReq = 1,
519 Constraints = "$base = $base_wb, $src1 = $dst" in {
520 def OR8rm_POST : Pseudo<(outs GR8:$dst, GR16:$base_wb), (ins GR8:$src1, GR16:$base),
521 "bis.b\t{@$base+, $dst}", []>;
522 def OR16rm_POST : Pseudo<(outs GR16:$dst, GR16:$base_wb), (ins GR16:$src1, GR16:$base),
523 "bis.w\t{@$base+, $dst}", []>;
526 let isTwoAddress = 0 in {
527 def OR8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
528 "bis.b\t{$src, $dst}",
529 [(store (or (load addr:$dst), GR8:$src), addr:$dst)]>;
530 def OR16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
531 "bis.w\t{$src, $dst}",
532 [(store (or (load addr:$dst), GR16:$src), addr:$dst)]>;
534 def OR8mi : Pseudo<(outs), (ins memdst:$dst, i8imm:$src),
535 "bis.b\t{$src, $dst}",
536 [(store (or (load addr:$dst), (i8 imm:$src)), addr:$dst)]>;
537 def OR16mi : Pseudo<(outs), (ins memdst:$dst, i16imm:$src),
538 "bis.w\t{$src, $dst}",
539 [(store (or (load addr:$dst), (i16 imm:$src)), addr:$dst)]>;
541 def OR8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
542 "bis.b\t{$src, $dst}",
543 [(store (or (i8 (load addr:$dst)),
544 (i8 (load addr:$src))), addr:$dst)]>;
545 def OR16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
546 "bis.w\t{$src, $dst}",
547 [(store (or (i16 (load addr:$dst)),
548 (i16 (load addr:$src))), addr:$dst)]>;
551 // bic does not modify condition codes
552 def BIC8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
553 "bic.b\t{$src2, $dst}",
554 [(set GR8:$dst, (and GR8:$src1, (not GR8:$src2)))]>;
555 def BIC16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
556 "bic.w\t{$src2, $dst}",
557 [(set GR16:$dst, (and GR16:$src1, (not GR16:$src2)))]>;
559 def BIC8rm : Pseudo<(outs GR8:$dst), (ins GR8:$src1, memsrc:$src2),
560 "bic.b\t{$src2, $dst}",
561 [(set GR8:$dst, (and GR8:$src1, (not (i8 (load addr:$src2)))))]>;
562 def BIC16rm : Pseudo<(outs GR16:$dst), (ins GR16:$src1, memsrc:$src2),
563 "bic.w\t{$src2, $dst}",
564 [(set GR16:$dst, (and GR16:$src1, (not (i16 (load addr:$src2)))))]>;
566 let isTwoAddress = 0 in {
567 def BIC8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
568 "bic.b\t{$src, $dst}",
569 [(store (and (load addr:$dst), (not GR8:$src)), addr:$dst)]>;
570 def BIC16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
571 "bic.w\t{$src, $dst}",
572 [(store (and (load addr:$dst), (not GR16:$src)), addr:$dst)]>;
574 def BIC8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
575 "bic.b\t{$src, $dst}",
576 [(store (and (load addr:$dst), (not (i8 (load addr:$src)))), addr:$dst)]>;
577 def BIC16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
578 "bic.w\t{$src, $dst}",
579 [(store (and (load addr:$dst), (not (i16 (load addr:$src)))), addr:$dst)]>;
582 let isCommutable = 1 in { // X = XOR Y, Z == X = XOR Z, Y
583 def XOR8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
584 "xor.b\t{$src2, $dst}",
585 [(set GR8:$dst, (xor GR8:$src1, GR8:$src2)),
587 def XOR16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
588 "xor.w\t{$src2, $dst}",
589 [(set GR16:$dst, (xor GR16:$src1, GR16:$src2)),
593 def XOR8ri : Pseudo<(outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
594 "xor.b\t{$src2, $dst}",
595 [(set GR8:$dst, (xor GR8:$src1, imm:$src2)),
597 def XOR16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
598 "xor.w\t{$src2, $dst}",
599 [(set GR16:$dst, (xor GR16:$src1, imm:$src2)),
602 def XOR8rm : Pseudo<(outs GR8:$dst), (ins GR8:$src1, memsrc:$src2),
603 "xor.b\t{$src2, $dst}",
604 [(set GR8:$dst, (xor GR8:$src1, (load addr:$src2))),
606 def XOR16rm : Pseudo<(outs GR16:$dst), (ins GR16:$src1, memsrc:$src2),
607 "xor.w\t{$src2, $dst}",
608 [(set GR16:$dst, (xor GR16:$src1, (load addr:$src2))),
611 let mayLoad = 1, hasExtraDefRegAllocReq = 1,
612 Constraints = "$base = $base_wb, $src1 = $dst" in {
613 def XOR8rm_POST : Pseudo<(outs GR8:$dst, GR16:$base_wb), (ins GR8:$src1, GR16:$base),
614 "xor.b\t{@$base+, $dst}", []>;
615 def XOR16rm_POST : Pseudo<(outs GR16:$dst, GR16:$base_wb), (ins GR16:$src1, GR16:$base),
616 "xor.w\t{@$base+, $dst}", []>;
619 let isTwoAddress = 0 in {
620 def XOR8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
621 "xor.b\t{$src, $dst}",
622 [(store (xor (load addr:$dst), GR8:$src), addr:$dst),
624 def XOR16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
625 "xor.w\t{$src, $dst}",
626 [(store (xor (load addr:$dst), GR16:$src), addr:$dst),
629 def XOR8mi : Pseudo<(outs), (ins memdst:$dst, i8imm:$src),
630 "xor.b\t{$src, $dst}",
631 [(store (xor (load addr:$dst), (i8 imm:$src)), addr:$dst),
633 def XOR16mi : Pseudo<(outs), (ins memdst:$dst, i16imm:$src),
634 "xor.w\t{$src, $dst}",
635 [(store (xor (load addr:$dst), (i16 imm:$src)), addr:$dst),
638 def XOR8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
639 "xor.b\t{$src, $dst}",
640 [(store (xor (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
642 def XOR16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
643 "xor.w\t{$src, $dst}",
644 [(store (xor (load addr:$dst), (i16 (load addr:$src))), addr:$dst),
649 def SUB8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
650 "sub.b\t{$src2, $dst}",
651 [(set GR8:$dst, (sub GR8:$src1, GR8:$src2)),
653 def SUB16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
654 "sub.w\t{$src2, $dst}",
655 [(set GR16:$dst, (sub GR16:$src1, GR16:$src2)),
658 def SUB8ri : Pseudo<(outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
659 "sub.b\t{$src2, $dst}",
660 [(set GR8:$dst, (sub GR8:$src1, imm:$src2)),
662 def SUB16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
663 "sub.w\t{$src2, $dst}",
664 [(set GR16:$dst, (sub GR16:$src1, imm:$src2)),
667 def SUB8rm : Pseudo<(outs GR8:$dst), (ins GR8:$src1, memsrc:$src2),
668 "sub.b\t{$src2, $dst}",
669 [(set GR8:$dst, (sub GR8:$src1, (load addr:$src2))),
671 def SUB16rm : Pseudo<(outs GR16:$dst), (ins GR16:$src1, memsrc:$src2),
672 "sub.w\t{$src2, $dst}",
673 [(set GR16:$dst, (sub GR16:$src1, (load addr:$src2))),
676 let mayLoad = 1, hasExtraDefRegAllocReq = 1,
677 Constraints = "$base = $base_wb, $src1 = $dst" in {
678 def SUB8rm_POST : Pseudo<(outs GR8:$dst, GR16:$base_wb), (ins GR8:$src1, GR16:$base),
679 "sub.b\t{@$base+, $dst}", []>;
680 def SUB16rm_POST : Pseudo<(outs GR16:$dst, GR16:$base_wb), (ins GR16:$src1, GR16:$base),
681 "sub.w\t{@$base+, $dst}", []>;
684 let isTwoAddress = 0 in {
685 def SUB8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
686 "sub.b\t{$src, $dst}",
687 [(store (sub (load addr:$dst), GR8:$src), addr:$dst),
689 def SUB16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
690 "sub.w\t{$src, $dst}",
691 [(store (sub (load addr:$dst), GR16:$src), addr:$dst),
694 def SUB8mi : Pseudo<(outs), (ins memdst:$dst, i8imm:$src),
695 "sub.b\t{$src, $dst}",
696 [(store (sub (load addr:$dst), (i8 imm:$src)), addr:$dst),
698 def SUB16mi : Pseudo<(outs), (ins memdst:$dst, i16imm:$src),
699 "sub.w\t{$src, $dst}",
700 [(store (sub (load addr:$dst), (i16 imm:$src)), addr:$dst),
703 def SUB8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
704 "sub.b\t{$src, $dst}",
705 [(store (sub (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
707 def SUB16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
708 "sub.w\t{$src, $dst}",
709 [(store (sub (load addr:$dst), (i16 (load addr:$src))), addr:$dst),
713 let Uses = [SRW] in {
714 def SBC8rr : Pseudo<(outs GR8:$dst), (ins GR8:$src1, GR8:$src2),
715 "subc.b\t{$src2, $dst}",
716 [(set GR8:$dst, (sube GR8:$src1, GR8:$src2)),
718 def SBC16rr : Pseudo<(outs GR16:$dst), (ins GR16:$src1, GR16:$src2),
719 "subc.w\t{$src2, $dst}",
720 [(set GR16:$dst, (sube GR16:$src1, GR16:$src2)),
723 def SBC8ri : Pseudo<(outs GR8:$dst), (ins GR8:$src1, i8imm:$src2),
724 "subc.b\t{$src2, $dst}",
725 [(set GR8:$dst, (sube GR8:$src1, imm:$src2)),
727 def SBC16ri : Pseudo<(outs GR16:$dst), (ins GR16:$src1, i16imm:$src2),
728 "subc.w\t{$src2, $dst}",
729 [(set GR16:$dst, (sube GR16:$src1, imm:$src2)),
732 def SBC8rm : Pseudo<(outs GR8:$dst), (ins GR8:$src1, memsrc:$src2),
733 "subc.b\t{$src2, $dst}",
734 [(set GR8:$dst, (sube GR8:$src1, (load addr:$src2))),
736 def SBC16rm : Pseudo<(outs GR16:$dst), (ins GR16:$src1, memsrc:$src2),
737 "subc.w\t{$src2, $dst}",
738 [(set GR16:$dst, (sube GR16:$src1, (load addr:$src2))),
741 let isTwoAddress = 0 in {
742 def SBC8mr : Pseudo<(outs), (ins memdst:$dst, GR8:$src),
743 "subc.b\t{$src, $dst}",
744 [(store (sube (load addr:$dst), GR8:$src), addr:$dst),
746 def SBC16mr : Pseudo<(outs), (ins memdst:$dst, GR16:$src),
747 "subc.w\t{$src, $dst}",
748 [(store (sube (load addr:$dst), GR16:$src), addr:$dst),
751 def SBC8mi : Pseudo<(outs), (ins memdst:$dst, i8imm:$src),
752 "subc.b\t{$src, $dst}",
753 [(store (sube (load addr:$dst), (i8 imm:$src)), addr:$dst),
755 def SBC16mi : Pseudo<(outs), (ins memdst:$dst, i16imm:$src),
756 "subc.w\t{$src, $dst}",
757 [(store (sube (load addr:$dst), (i16 imm:$src)), addr:$dst),
760 def SBC8mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
761 "subc.b\t{$src, $dst}",
762 [(store (sube (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
764 def SBC16mm : Pseudo<(outs), (ins memdst:$dst, memsrc:$src),
765 "subc.w\t{$src, $dst}",
766 [(store (sube (load addr:$dst), (i16 (load addr:$src))), addr:$dst),
772 // FIXME: Provide proper encoding!
773 def SAR8r1 : Pseudo<(outs GR8:$dst), (ins GR8:$src),
775 [(set GR8:$dst, (MSP430rra GR8:$src)),
777 def SAR16r1 : Pseudo<(outs GR16:$dst), (ins GR16:$src),
779 [(set GR16:$dst, (MSP430rra GR16:$src)),
782 def SHL8r1 : Pseudo<(outs GR8:$dst), (ins GR8:$src),
784 [(set GR8:$dst, (MSP430rla GR8:$src)),
786 def SHL16r1 : Pseudo<(outs GR16:$dst), (ins GR16:$src),
788 [(set GR16:$dst, (MSP430rla GR16:$src)),
791 def SAR8r1c : Pseudo<(outs GR8:$dst), (ins GR8:$src),
794 [(set GR8:$dst, (MSP430rrc GR8:$src)),
796 def SAR16r1c : Pseudo<(outs GR16:$dst), (ins GR16:$src),
799 [(set GR16:$dst, (MSP430rrc GR16:$src)),
802 def SEXT16r : Pseudo<(outs GR16:$dst), (ins GR16:$src),
804 [(set GR16:$dst, (sext_inreg GR16:$src, i8)),
809 def ZEXT16r : Pseudo<(outs GR16:$dst), (ins GR16:$src),
810 "mov.b\t{$src, $dst}",
811 [(set GR16:$dst, (zext (trunc GR16:$src)))]>;
813 def SWPB16r : Pseudo<(outs GR16:$dst), (ins GR16:$src),
815 [(set GR16:$dst, (bswap GR16:$src))]>;
817 } // isTwoAddress = 1
819 // Integer comparisons
820 let Defs = [SRW] in {
821 def CMP8rr : Pseudo<(outs), (ins GR8:$src1, GR8:$src2),
822 "cmp.b\t{$src2, $src1}",
823 [(MSP430cmp GR8:$src1, GR8:$src2), (implicit SRW)]>;
824 def CMP16rr : Pseudo<(outs), (ins GR16:$src1, GR16:$src2),
825 "cmp.w\t{$src2, $src1}",
826 [(MSP430cmp GR16:$src1, GR16:$src2), (implicit SRW)]>;
828 def CMP8ri : Pseudo<(outs), (ins GR8:$src1, i8imm:$src2),
829 "cmp.b\t{$src2, $src1}",
830 [(MSP430cmp GR8:$src1, imm:$src2), (implicit SRW)]>;
831 def CMP16ri : Pseudo<(outs), (ins GR16:$src1, i16imm:$src2),
832 "cmp.w\t{$src2, $src1}",
833 [(MSP430cmp GR16:$src1, imm:$src2), (implicit SRW)]>;
835 def CMP8mi : Pseudo<(outs), (ins memsrc:$src1, i8imm:$src2),
836 "cmp.b\t{$src2, $src1}",
837 [(MSP430cmp (load addr:$src1),
838 (i8 imm:$src2)), (implicit SRW)]>;
839 def CMP16mi : Pseudo<(outs), (ins memsrc:$src1, i16imm:$src2),
840 "cmp.w\t{$src2, $src1}",
841 [(MSP430cmp (load addr:$src1),
842 (i16 imm:$src2)), (implicit SRW)]>;
844 def CMP8rm : Pseudo<(outs), (ins GR8:$src1, memsrc:$src2),
845 "cmp.b\t{$src2, $src1}",
846 [(MSP430cmp GR8:$src1, (load addr:$src2)), (implicit SRW)]>;
847 def CMP16rm : Pseudo<(outs), (ins GR16:$src1, memsrc:$src2),
848 "cmp.w\t{$src2, $src1}",
849 [(MSP430cmp GR16:$src1, (load addr:$src2)), (implicit SRW)]>;
851 def CMP8mr : Pseudo<(outs), (ins memsrc:$src1, GR8:$src2),
852 "cmp.b\t{$src2, $src1}",
853 [(MSP430cmp (load addr:$src1), GR8:$src2), (implicit SRW)]>;
854 def CMP16mr : Pseudo<(outs), (ins memsrc:$src1, GR16:$src2),
855 "cmp.w\t{$src2, $src1}",
856 [(MSP430cmp (load addr:$src1), GR16:$src2), (implicit SRW)]>;
859 // BIT TESTS, just sets condition codes
860 // Note that the C condition is set differently than when using CMP.
861 let isCommutable = 1 in {
862 def BIT8rr : Pseudo<(outs), (ins GR8:$src1, GR8:$src2),
863 "bit.b\t{$src2, $src1}",
864 [(MSP430cmp 0, (and_su GR8:$src1, GR8:$src2)),
866 def BIT16rr : Pseudo<(outs), (ins GR16:$src1, GR16:$src2),
867 "bit.w\t{$src2, $src1}",
868 [(MSP430cmp 0, (and_su GR16:$src1, GR16:$src2)),
871 def BIT8ri : Pseudo<(outs), (ins GR8:$src1, i8imm:$src2),
872 "bit.b\t{$src2, $src1}",
873 [(MSP430cmp 0, (and_su GR8:$src1, imm:$src2)),
875 def BIT16ri : Pseudo<(outs), (ins GR16:$src1, i16imm:$src2),
876 "bit.w\t{$src2, $src1}",
877 [(MSP430cmp 0, (and_su GR16:$src1, imm:$src2)),
880 def BIT8rm : Pseudo<(outs), (ins GR8:$src1, memdst:$src2),
881 "bit.b\t{$src2, $src1}",
882 [(MSP430cmp 0, (and_su GR8:$src1, (load addr:$src2))),
884 def BIT16rm : Pseudo<(outs), (ins GR16:$src1, memdst:$src2),
885 "bit.w\t{$src2, $src1}",
886 [(MSP430cmp 0, (and_su GR16:$src1, (load addr:$src2))),
889 def BIT8mr : Pseudo<(outs), (ins memsrc:$src1, GR8:$src2),
890 "bit.b\t{$src2, $src1}",
891 [(MSP430cmp 0, (and_su (load addr:$src1), GR8:$src2)),
893 def BIT16mr : Pseudo<(outs), (ins memsrc:$src1, GR16:$src2),
894 "bit.w\t{$src2, $src1}",
895 [(MSP430cmp 0, (and_su (load addr:$src1), GR16:$src2)),
898 def BIT8mi : Pseudo<(outs), (ins memsrc:$src1, i8imm:$src2),
899 "bit.b\t{$src2, $src1}",
900 [(MSP430cmp 0, (and_su (load addr:$src1), (i8 imm:$src2))),
902 def BIT16mi : Pseudo<(outs), (ins memsrc:$src1, i16imm:$src2),
903 "bit.w\t{$src2, $src1}",
904 [(MSP430cmp 0, (and_su (load addr:$src1), (i16 imm:$src2))),
907 def BIT8mm : Pseudo<(outs), (ins memsrc:$src1, memsrc:$src2),
908 "bit.b\t{$src2, $src1}",
909 [(MSP430cmp 0, (and_su (i8 (load addr:$src1)),
912 def BIT16mm : Pseudo<(outs), (ins memsrc:$src1, memsrc:$src2),
913 "bit.w\t{$src2, $src1}",
914 [(MSP430cmp 0, (and_su (i16 (load addr:$src1)),
919 //===----------------------------------------------------------------------===//
920 // Non-Instruction Patterns
923 def : Pat<(extloadi16i8 addr:$src), (MOVZX16rm8 addr:$src)>;
926 def : Pat<(anyext addr:$src), (MOVZX16rr8 GR8:$src)>;
929 def : Pat<(i8 (trunc GR16:$src)),
930 (EXTRACT_SUBREG GR16:$src, subreg_8bit)>;
932 // GlobalAddress, ExternalSymbol
933 def : Pat<(i16 (MSP430Wrapper tglobaladdr:$dst)), (MOV16ri tglobaladdr:$dst)>;
934 def : Pat<(i16 (MSP430Wrapper texternalsym:$dst)), (MOV16ri texternalsym:$dst)>;
936 def : Pat<(add GR16:$src1, (MSP430Wrapper tglobaladdr :$src2)),
937 (ADD16ri GR16:$src1, tglobaladdr:$src2)>;
938 def : Pat<(add GR16:$src1, (MSP430Wrapper texternalsym:$src2)),
939 (ADD16ri GR16:$src1, texternalsym:$src2)>;
941 def : Pat<(store (i16 (MSP430Wrapper tglobaladdr:$src)), addr:$dst),
942 (MOV16mi addr:$dst, tglobaladdr:$src)>;
943 def : Pat<(store (i16 (MSP430Wrapper texternalsym:$src)), addr:$dst),
944 (MOV16mi addr:$dst, texternalsym:$src)>;
947 def : Pat<(MSP430call (i16 tglobaladdr:$dst)),
948 (CALLi tglobaladdr:$dst)>;
949 def : Pat<(MSP430call (i16 texternalsym:$dst)),
950 (CALLi texternalsym:$dst)>;
952 // add and sub always produce carry
953 def : Pat<(addc GR16:$src1, GR16:$src2),
954 (ADD16rr GR16:$src1, GR16:$src2)>;
955 def : Pat<(addc GR16:$src1, (load addr:$src2)),
956 (ADD16rm GR16:$src1, addr:$src2)>;
957 def : Pat<(addc GR16:$src1, imm:$src2),
958 (ADD16ri GR16:$src1, imm:$src2)>;
959 def : Pat<(store (addc (load addr:$dst), GR16:$src), addr:$dst),
960 (ADD16mr addr:$dst, GR16:$src)>;
961 def : Pat<(store (addc (load addr:$dst), (i16 (load addr:$src))), addr:$dst),
962 (ADD16mm addr:$dst, addr:$src)>;
964 def : Pat<(addc GR8:$src1, GR8:$src2),
965 (ADD8rr GR8:$src1, GR8:$src2)>;
966 def : Pat<(addc GR8:$src1, (load addr:$src2)),
967 (ADD8rm GR8:$src1, addr:$src2)>;
968 def : Pat<(addc GR8:$src1, imm:$src2),
969 (ADD8ri GR8:$src1, imm:$src2)>;
970 def : Pat<(store (addc (load addr:$dst), GR8:$src), addr:$dst),
971 (ADD8mr addr:$dst, GR8:$src)>;
972 def : Pat<(store (addc (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
973 (ADD8mm addr:$dst, addr:$src)>;
975 def : Pat<(subc GR16:$src1, GR16:$src2),
976 (SUB16rr GR16:$src1, GR16:$src2)>;
977 def : Pat<(subc GR16:$src1, (load addr:$src2)),
978 (SUB16rm GR16:$src1, addr:$src2)>;
979 def : Pat<(subc GR16:$src1, imm:$src2),
980 (SUB16ri GR16:$src1, imm:$src2)>;
981 def : Pat<(store (subc (load addr:$dst), GR16:$src), addr:$dst),
982 (SUB16mr addr:$dst, GR16:$src)>;
983 def : Pat<(store (subc (load addr:$dst), (i16 (load addr:$src))), addr:$dst),
984 (SUB16mm addr:$dst, addr:$src)>;
986 def : Pat<(subc GR8:$src1, GR8:$src2),
987 (SUB8rr GR8:$src1, GR8:$src2)>;
988 def : Pat<(subc GR8:$src1, (load addr:$src2)),
989 (SUB8rm GR8:$src1, addr:$src2)>;
990 def : Pat<(subc GR8:$src1, imm:$src2),
991 (SUB8ri GR8:$src1, imm:$src2)>;
992 def : Pat<(store (subc (load addr:$dst), GR8:$src), addr:$dst),
993 (SUB8mr addr:$dst, GR8:$src)>;
994 def : Pat<(store (subc (load addr:$dst), (i8 (load addr:$src))), addr:$dst),
995 (SUB8mm addr:$dst, addr:$src)>;
998 def : Pat<(and GR16:$src, 255), (ZEXT16r GR16:$src)>;
999 def : Pat<(MSP430cmp 0, (trunc (and_su GR16:$src1, GR16:$src2))),
1000 (BIT8rr (EXTRACT_SUBREG GR16:$src1, subreg_8bit),
1001 (EXTRACT_SUBREG GR16:$src2, subreg_8bit))>;