Chris Lattner | 23e70eb | 2010-08-17 16:20:04 +0000 | [diff] [blame] | 1 | //===- MipsInstrInfo.td - Mips Register defs ---------------*- tablegen -*-===// |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | //===----------------------------------------------------------------------===// |
| 11 | // Instruction format superclass |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | include "MipsInstrFormats.td" |
| 15 | |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | // Mips profiles and nodes |
| 18 | //===----------------------------------------------------------------------===// |
| 19 | |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 20 | def SDT_MipsRet : SDTypeProfile<0, 1, [SDTCisInt<0>]>; |
| 21 | def SDT_MipsJmpLink : SDTypeProfile<0, 1, [SDTCisVT<0, iPTR>]>; |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 22 | def SDT_MipsSelectCC : SDTypeProfile<1, 3, [SDTCisSameAs<0, 2>, |
Bruno Cardoso Lopes | 6d399bd | 2008-07-29 19:05:28 +0000 | [diff] [blame] | 23 | SDTCisSameAs<2, 3>, SDTCisInt<1>]>; |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 24 | def SDT_MipsCMov : SDTypeProfile<1, 4, [SDTCisSameAs<0, 1>, |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 25 | SDTCisSameAs<1, 2>, SDTCisSameAs<3, 4>, |
| 26 | SDTCisInt<4>]>; |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 27 | def SDT_MipsCallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>; |
| 28 | def SDT_MipsCallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i32>, SDTCisVT<1, i32>]>; |
| 29 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 30 | // Call |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 31 | def MipsJmpLink : SDNode<"MipsISD::JmpLink",SDT_MipsJmpLink, |
Chris Lattner | 60e9eac | 2010-03-19 05:33:51 +0000 | [diff] [blame] | 32 | [SDNPHasChain, SDNPOutFlag, SDNPOptInFlag, |
| 33 | SDNPVariadic]>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 34 | |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 35 | // Hi and Lo nodes are used to handle global addresses. Used on |
| 36 | // MipsISelLowering to lower stuff like GlobalAddress, ExternalSymbol |
Bruno Cardoso Lopes | c7db561 | 2007-11-05 03:02:32 +0000 | [diff] [blame] | 37 | // static model. (nothing to do with Mips Registers Hi and Lo) |
Bruno Cardoso Lopes | 91fd532 | 2008-07-21 18:52:34 +0000 | [diff] [blame] | 38 | def MipsHi : SDNode<"MipsISD::Hi", SDTIntUnaryOp>; |
| 39 | def MipsLo : SDNode<"MipsISD::Lo", SDTIntUnaryOp>; |
| 40 | def MipsGPRel : SDNode<"MipsISD::GPRel", SDTIntUnaryOp>; |
Bruno Cardoso Lopes | e78080c | 2007-10-09 02:55:31 +0000 | [diff] [blame] | 41 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 42 | // Return |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 43 | def MipsRet : SDNode<"MipsISD::Ret", SDT_MipsRet, [SDNPHasChain, |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 44 | SDNPOptInFlag]>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 45 | |
| 46 | // These are target-independent nodes, but have target-specific formats. |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 47 | def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_MipsCallSeqStart, |
| 48 | [SDNPHasChain, SDNPOutFlag]>; |
| 49 | def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_MipsCallSeqEnd, |
| 50 | [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; |
Bill Wendling | 0f8d9c0 | 2007-11-13 00:44:25 +0000 | [diff] [blame] | 51 | |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 52 | // Select Condition Code |
| 53 | def MipsSelectCC : SDNode<"MipsISD::SelectCC", SDT_MipsSelectCC>; |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 54 | |
Bruno Cardoso Lopes | e78080c | 2007-10-09 02:55:31 +0000 | [diff] [blame] | 55 | //===----------------------------------------------------------------------===// |
| 56 | // Mips Instruction Predicate Definitions. |
| 57 | //===----------------------------------------------------------------------===// |
Bruno Cardoso Lopes | 65ad452 | 2008-08-08 06:16:31 +0000 | [diff] [blame] | 58 | def HasSEInReg : Predicate<"Subtarget.hasSEInReg()">; |
| 59 | def HasBitCount : Predicate<"Subtarget.hasBitCount()">; |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 60 | def HasSwap : Predicate<"Subtarget.hasSwap()">; |
| 61 | def HasCondMov : Predicate<"Subtarget.hasCondMov()">; |
Bruno Cardoso Lopes | 7d5652d | 2010-11-12 00:38:32 +0000 | [diff] [blame] | 62 | def IsMips32 : Predicate<"Subtarget.isMips32()">; |
Bruno Cardoso Lopes | e78080c | 2007-10-09 02:55:31 +0000 | [diff] [blame] | 63 | |
| 64 | //===----------------------------------------------------------------------===// |
| 65 | // Mips Operand, Complex Patterns and Transformations Definitions. |
| 66 | //===----------------------------------------------------------------------===// |
| 67 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 68 | // Instruction operand types |
| 69 | def brtarget : Operand<OtherVT>; |
| 70 | def calltarget : Operand<i32>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 71 | def simm16 : Operand<i32>; |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 72 | def shamt : Operand<i32>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 73 | |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 74 | // Unsigned Operand |
| 75 | def uimm16 : Operand<i32> { |
| 76 | let PrintMethod = "printUnsignedImm"; |
| 77 | } |
| 78 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 79 | // Address operand |
| 80 | def mem : Operand<i32> { |
| 81 | let PrintMethod = "printMemOperand"; |
| 82 | let MIOperandInfo = (ops simm16, CPURegs); |
| 83 | } |
| 84 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 85 | // Transformation Function - get the lower 16 bits. |
| 86 | def LO16 : SDNodeXForm<imm, [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 87 | return getI32Imm((unsigned)N->getZExtValue() & 0xFFFF); |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 88 | }]>; |
| 89 | |
| 90 | // Transformation Function - get the higher 16 bits. |
| 91 | def HI16 : SDNodeXForm<imm, [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 92 | return getI32Imm((unsigned)N->getZExtValue() >> 16); |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 93 | }]>; |
| 94 | |
| 95 | // Node immediate fits as 16-bit sign extended on target immediate. |
| 96 | // e.g. addi, andi |
Jakob Stoklund Olesen | 7552a3d | 2010-08-18 23:56:46 +0000 | [diff] [blame] | 97 | def immSExt16 : PatLeaf<(imm), [{ return isInt<16>(N->getSExtValue()); }]>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 98 | |
| 99 | // Node immediate fits as 16-bit zero extended on target immediate. |
| 100 | // The LO16 param means that only the lower 16 bits of the node |
| 101 | // immediate are caught. |
| 102 | // e.g. addiu, sltiu |
| 103 | def immZExt16 : PatLeaf<(imm), [{ |
Owen Anderson | 825b72b | 2009-08-11 20:47:22 +0000 | [diff] [blame] | 104 | if (N->getValueType(0) == MVT::i32) |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 105 | return (uint32_t)N->getZExtValue() == (unsigned short)N->getZExtValue(); |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 106 | else |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 107 | return (uint64_t)N->getZExtValue() == (unsigned short)N->getZExtValue(); |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 108 | }], LO16>; |
| 109 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 110 | // shamt field must fit in 5 bits. |
| 111 | def immZExt5 : PatLeaf<(imm), [{ |
Dan Gohman | f5aeb1a | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 112 | return N->getZExtValue() == ((N->getZExtValue()) & 0x1f) ; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 113 | }]>; |
| 114 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 115 | // Mips Address Mode! SDNode frameindex could possibily be a match |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 116 | // since load and store instructions from stack used it. |
Chris Lattner | eb079a3 | 2010-02-14 21:53:19 +0000 | [diff] [blame] | 117 | def addr : ComplexPattern<iPTR, 2, "SelectAddr", [frameindex], []>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 118 | |
| 119 | //===----------------------------------------------------------------------===// |
| 120 | // Instructions specific format |
| 121 | //===----------------------------------------------------------------------===// |
| 122 | |
| 123 | // Arithmetic 3 register operands |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 124 | let isCommutable = 1 in |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 125 | class ArithR<bits<6> op, bits<6> func, string instr_asm, SDNode OpNode, |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 126 | InstrItinClass itin>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 127 | FR<op, func, (outs CPURegs:$dst), (ins CPURegs:$b, CPURegs:$c), |
| 128 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 129 | [(set CPURegs:$dst, (OpNode CPURegs:$b, CPURegs:$c))], itin>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 130 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 131 | let isCommutable = 1 in |
| 132 | class ArithOverflowR<bits<6> op, bits<6> func, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 133 | FR<op, func, (outs CPURegs:$dst), (ins CPURegs:$b, CPURegs:$c), |
| 134 | !strconcat(instr_asm, "\t$dst, $b, $c"), [], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 135 | |
| 136 | // Arithmetic 2 register operands |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 137 | class ArithI<bits<6> op, string instr_asm, SDNode OpNode, |
| 138 | Operand Od, PatLeaf imm_type> : |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 139 | FI<op, (outs CPURegs:$dst), (ins CPURegs:$b, Od:$c), |
| 140 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 141 | [(set CPURegs:$dst, (OpNode CPURegs:$b, imm_type:$c))], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 142 | |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 143 | class ArithOverflowI<bits<6> op, string instr_asm, SDNode OpNode, |
| 144 | Operand Od, PatLeaf imm_type> : |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 145 | FI<op, (outs CPURegs:$dst), (ins CPURegs:$b, Od:$c), |
| 146 | !strconcat(instr_asm, "\t$dst, $b, $c"), [], IIAlu>; |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 147 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 148 | // Arithmetic Multiply ADD/SUB |
| 149 | let rd=0 in |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 150 | class MArithR<bits<6> func, string instr_asm> : |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 151 | FR<0x1c, func, (outs CPURegs:$rs), (ins CPURegs:$rt), |
| 152 | !strconcat(instr_asm, "\t$rs, $rt"), [], IIImul>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 153 | |
| 154 | // Logical |
| 155 | class LogicR<bits<6> func, string instr_asm, SDNode OpNode>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 156 | FR<0x00, func, (outs CPURegs:$dst), (ins CPURegs:$b, CPURegs:$c), |
| 157 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 158 | [(set CPURegs:$dst, (OpNode CPURegs:$b, CPURegs:$c))], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 159 | |
| 160 | class LogicI<bits<6> op, string instr_asm, SDNode OpNode>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 161 | FI<op, (outs CPURegs:$dst), (ins CPURegs:$b, uimm16:$c), |
| 162 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 163 | [(set CPURegs:$dst, (OpNode CPURegs:$b, immZExt16:$c))], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 164 | |
| 165 | class LogicNOR<bits<6> op, bits<6> func, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 166 | FR<op, func, (outs CPURegs:$dst), (ins CPURegs:$b, CPURegs:$c), |
| 167 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 168 | [(set CPURegs:$dst, (not (or CPURegs:$b, CPURegs:$c)))], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 169 | |
| 170 | // Shifts |
| 171 | let rt = 0 in |
| 172 | class LogicR_shift_imm<bits<6> func, string instr_asm, SDNode OpNode>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 173 | FR<0x00, func, (outs CPURegs:$dst), (ins CPURegs:$b, shamt:$c), |
| 174 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 175 | [(set CPURegs:$dst, (OpNode CPURegs:$b, immZExt5:$c))], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 176 | |
| 177 | class LogicR_shift_reg<bits<6> func, string instr_asm, SDNode OpNode>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 178 | FR<0x00, func, (outs CPURegs:$dst), (ins CPURegs:$b, CPURegs:$c), |
| 179 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 180 | [(set CPURegs:$dst, (OpNode CPURegs:$b, CPURegs:$c))], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 181 | |
| 182 | // Load Upper Imediate |
| 183 | class LoadUpper<bits<6> op, string instr_asm>: |
| 184 | FI< op, |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 185 | (outs CPURegs:$dst), |
| 186 | (ins uimm16:$imm), |
Bruno Cardoso Lopes | 43d526d | 2008-07-14 14:42:54 +0000 | [diff] [blame] | 187 | !strconcat(instr_asm, "\t$dst, $imm"), |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 188 | [], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 189 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 190 | // Memory Load/Store |
Dan Gohman | 15511cf | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 191 | let canFoldAsLoad = 1, hasDelaySlot = 1 in |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 192 | class LoadM<bits<6> op, string instr_asm, PatFrag OpNode>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 193 | FI<op, (outs CPURegs:$dst), (ins mem:$addr), |
| 194 | !strconcat(instr_asm, "\t$dst, $addr"), |
| 195 | [(set CPURegs:$dst, (OpNode addr:$addr))], IILoad>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 196 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 197 | class StoreM<bits<6> op, string instr_asm, PatFrag OpNode>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 198 | FI<op, (outs), (ins CPURegs:$dst, mem:$addr), |
| 199 | !strconcat(instr_asm, "\t$dst, $addr"), |
| 200 | [(OpNode CPURegs:$dst, addr:$addr)], IIStore>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 201 | |
| 202 | // Conditional Branch |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 203 | let isBranch = 1, isTerminator=1, hasDelaySlot = 1 in { |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 204 | class CBranch<bits<6> op, string instr_asm, PatFrag cond_op>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 205 | FI<op, (outs), (ins CPURegs:$a, CPURegs:$b, brtarget:$offset), |
| 206 | !strconcat(instr_asm, "\t$a, $b, $offset"), |
| 207 | [(brcond (cond_op CPURegs:$a, CPURegs:$b), bb:$offset)], |
| 208 | IIBranch>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 209 | |
| 210 | class CBranchZero<bits<6> op, string instr_asm, PatFrag cond_op>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 211 | FI<op, (outs), (ins CPURegs:$src, brtarget:$offset), |
| 212 | !strconcat(instr_asm, "\t$src, $offset"), |
| 213 | [(brcond (cond_op CPURegs:$src, 0), bb:$offset)], |
| 214 | IIBranch>; |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 215 | } |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 216 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 217 | // SetCC |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 218 | class SetCC_R<bits<6> op, bits<6> func, string instr_asm, |
| 219 | PatFrag cond_op>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 220 | FR<op, func, (outs CPURegs:$dst), (ins CPURegs:$b, CPURegs:$c), |
| 221 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 222 | [(set CPURegs:$dst, (cond_op CPURegs:$b, CPURegs:$c))], |
| 223 | IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 224 | |
| 225 | class SetCC_I<bits<6> op, string instr_asm, PatFrag cond_op, |
| 226 | Operand Od, PatLeaf imm_type>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 227 | FI<op, (outs CPURegs:$dst), (ins CPURegs:$b, Od:$c), |
| 228 | !strconcat(instr_asm, "\t$dst, $b, $c"), |
| 229 | [(set CPURegs:$dst, (cond_op CPURegs:$b, imm_type:$c))], |
| 230 | IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 231 | |
| 232 | // Unconditional branch |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 233 | let isBranch=1, isTerminator=1, isBarrier=1, hasDelaySlot = 1 in |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 234 | class JumpFJ<bits<6> op, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 235 | FJ<op, (outs), (ins brtarget:$target), |
| 236 | !strconcat(instr_asm, "\t$target"), [(br bb:$target)], IIBranch>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 237 | |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 238 | let isBranch=1, isTerminator=1, isBarrier=1, rd=0, hasDelaySlot = 1 in |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 239 | class JumpFR<bits<6> op, bits<6> func, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 240 | FR<op, func, (outs), (ins CPURegs:$target), |
| 241 | !strconcat(instr_asm, "\t$target"), [(brind CPURegs:$target)], IIBranch>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 242 | |
| 243 | // Jump and Link (Call) |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 244 | let isCall=1, hasDelaySlot=1, |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 245 | // All calls clobber the non-callee saved registers... |
Jakob Stoklund Olesen | de12e43 | 2010-02-17 20:18:50 +0000 | [diff] [blame] | 246 | Defs = [AT, V0, V1, A0, A1, A2, A3, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, |
| 247 | K0, K1, D0, D1, D2, D3, D4, D5, D6, D7, D8, D9], Uses = [GP] in { |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 248 | class JumpLink<bits<6> op, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 249 | FJ<op, (outs), (ins calltarget:$target, variable_ops), |
| 250 | !strconcat(instr_asm, "\t$target"), [(MipsJmpLink imm:$target)], |
| 251 | IIBranch>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 252 | |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 253 | let rd=31 in |
| 254 | class JumpLinkReg<bits<6> op, bits<6> func, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 255 | FR<op, func, (outs), (ins CPURegs:$rs, variable_ops), |
| 256 | !strconcat(instr_asm, "\t$rs"), [(MipsJmpLink CPURegs:$rs)], IIBranch>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 257 | |
| 258 | class BranchLink<string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 259 | FI<0x1, (outs), (ins CPURegs:$rs, brtarget:$target, variable_ops), |
| 260 | !strconcat(instr_asm, "\t$rs, $target"), [], IIBranch>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 261 | } |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 262 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 263 | // Mul, Div |
| 264 | class MulDiv<bits<6> func, string instr_asm, InstrItinClass itin>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 265 | FR<0x00, func, (outs), (ins CPURegs:$a, CPURegs:$b), |
| 266 | !strconcat(instr_asm, "\t$a, $b"), [], itin>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 267 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 268 | // Move from Hi/Lo |
Bruno Cardoso Lopes | 91ef849 | 2008-08-02 19:42:36 +0000 | [diff] [blame] | 269 | class MoveFromLOHI<bits<6> func, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 270 | FR<0x00, func, (outs CPURegs:$dst), (ins), |
| 271 | !strconcat(instr_asm, "\t$dst"), [], IIHiLo>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 272 | |
Bruno Cardoso Lopes | 91ef849 | 2008-08-02 19:42:36 +0000 | [diff] [blame] | 273 | class MoveToLOHI<bits<6> func, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 274 | FR<0x00, func, (outs), (ins CPURegs:$src), |
| 275 | !strconcat(instr_asm, "\t$src"), [], IIHiLo>; |
Bruno Cardoso Lopes | 91ef849 | 2008-08-02 19:42:36 +0000 | [diff] [blame] | 276 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 277 | class EffectiveAddress<string instr_asm> : |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 278 | FI<0x09, (outs CPURegs:$dst), (ins mem:$addr), |
| 279 | instr_asm, [(set CPURegs:$dst, addr:$addr)], IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 280 | |
Bruno Cardoso Lopes | 65ad452 | 2008-08-08 06:16:31 +0000 | [diff] [blame] | 281 | // Count Leading Ones/Zeros in Word |
Bruno Cardoso Lopes | c4bb67c | 2010-11-10 02:13:22 +0000 | [diff] [blame] | 282 | class CountLeading<bits<6> func, string instr_asm, list<dag> pattern>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 283 | FR<0x1c, func, (outs CPURegs:$dst), (ins CPURegs:$src), |
Bruno Cardoso Lopes | c4bb67c | 2010-11-10 02:13:22 +0000 | [diff] [blame] | 284 | !strconcat(instr_asm, "\t$dst, $src"), pattern, IIAlu>, |
| 285 | Requires<[HasBitCount]> { |
| 286 | let shamt = 0; |
| 287 | let rt = rd; |
| 288 | } |
Bruno Cardoso Lopes | 65ad452 | 2008-08-08 06:16:31 +0000 | [diff] [blame] | 289 | |
| 290 | // Sign Extend in Register. |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 291 | class SignExtInReg<bits<6> func, string instr_asm, ValueType vt>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 292 | FR<0x3f, func, (outs CPURegs:$dst), (ins CPURegs:$src), |
| 293 | !strconcat(instr_asm, "\t$dst, $src"), |
| 294 | [(set CPURegs:$dst, (sext_inreg CPURegs:$src, vt))], NoItinerary>; |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 295 | |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 296 | // Byte Swap |
| 297 | class ByteSwap<bits<6> func, string instr_asm>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 298 | FR<0x1f, func, (outs CPURegs:$dst), (ins CPURegs:$src), |
| 299 | !strconcat(instr_asm, "\t$dst, $src"), |
| 300 | [(set CPURegs:$dst, (bswap CPURegs:$src))], NoItinerary>; |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 301 | |
| 302 | // Conditional Move |
| 303 | class CondMov<bits<6> func, string instr_asm, PatLeaf MovCode>: |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 304 | FR<0x00, func, (outs CPURegs:$dst), (ins CPURegs:$F, CPURegs:$T, |
| 305 | CPURegs:$cond), !strconcat(instr_asm, "\t$dst, $T, $cond"), |
Bruno Cardoso Lopes | bd3af09c | 2010-12-07 19:04:14 +0000 | [diff] [blame^] | 306 | [], NoItinerary>; |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 307 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 308 | //===----------------------------------------------------------------------===// |
| 309 | // Pseudo instructions |
| 310 | //===----------------------------------------------------------------------===// |
| 311 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 312 | // As stack alignment is always done with addiu, we need a 16-bit immediate |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 313 | let Defs = [SP], Uses = [SP] in { |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 314 | def ADJCALLSTACKDOWN : MipsPseudo<(outs), (ins uimm16:$amt), |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 315 | "!ADJCALLSTACKDOWN $amt", |
Chris Lattner | e563bbc | 2008-10-11 22:08:30 +0000 | [diff] [blame] | 316 | [(callseq_start timm:$amt)]>; |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 317 | def ADJCALLSTACKUP : MipsPseudo<(outs), (ins uimm16:$amt1, uimm16:$amt2), |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 318 | "!ADJCALLSTACKUP $amt1", |
Chris Lattner | e563bbc | 2008-10-11 22:08:30 +0000 | [diff] [blame] | 319 | [(callseq_end timm:$amt1, timm:$amt2)]>; |
Evan Cheng | 071a279 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 320 | } |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 321 | |
Bruno Cardoso Lopes | 43d526d | 2008-07-14 14:42:54 +0000 | [diff] [blame] | 322 | // Some assembly macros need to avoid pseudoinstructions and assembler |
| 323 | // automatic reodering, we should reorder ourselves. |
| 324 | def MACRO : MipsPseudo<(outs), (ins), ".set\tmacro", []>; |
| 325 | def REORDER : MipsPseudo<(outs), (ins), ".set\treorder", []>; |
| 326 | def NOMACRO : MipsPseudo<(outs), (ins), ".set\tnomacro", []>; |
| 327 | def NOREORDER : MipsPseudo<(outs), (ins), ".set\tnoreorder", []>; |
| 328 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 329 | // When handling PIC code the assembler needs .cpload and .cprestore |
| 330 | // directives. If the real instructions corresponding these directives |
| 331 | // are used, we have the same behavior, but get also a bunch of warnings |
Bruno Cardoso Lopes | e78080c | 2007-10-09 02:55:31 +0000 | [diff] [blame] | 332 | // from the assembler. |
Bruno Cardoso Lopes | 43d526d | 2008-07-14 14:42:54 +0000 | [diff] [blame] | 333 | def CPLOAD : MipsPseudo<(outs), (ins CPURegs:$picreg), ".cpload\t$picreg", []>; |
| 334 | def CPRESTORE : MipsPseudo<(outs), (ins uimm16:$loc), ".cprestore\t$loc\n", []>; |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 335 | |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 336 | // The supported Mips ISAs dont have any instruction close to the SELECT_CC |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 337 | // operation. The solution is to create a Mips pseudo SELECT_CC instruction |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 338 | // (MipsSelectCC), use LowerSELECT_CC to generate this instruction and finally |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 339 | // replace it for real supported nodes into EmitInstrWithCustomInserter |
Dan Gohman | 533297b | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 340 | let usesCustomInserter = 1 in { |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 341 | class PseudoSelCC<RegisterClass RC, string asmstr>: |
| 342 | MipsPseudo<(outs RC:$dst), (ins CPURegs:$CmpRes, RC:$T, RC:$F), asmstr, |
Bruno Cardoso Lopes | 6d399bd | 2008-07-29 19:05:28 +0000 | [diff] [blame] | 343 | [(set RC:$dst, (MipsSelectCC CPURegs:$CmpRes, RC:$T, RC:$F))]>; |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 344 | } |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 345 | |
Bruno Cardoso Lopes | 6d399bd | 2008-07-29 19:05:28 +0000 | [diff] [blame] | 346 | def Select_CC : PseudoSelCC<CPURegs, "# MipsSelect_CC_i32">; |
| 347 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 348 | //===----------------------------------------------------------------------===// |
| 349 | // Instruction definition |
| 350 | //===----------------------------------------------------------------------===// |
| 351 | |
| 352 | //===----------------------------------------------------------------------===// |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 353 | // MipsI Instructions |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 354 | //===----------------------------------------------------------------------===// |
| 355 | |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 356 | /// Arithmetic Instructions (ALU Immediate) |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 357 | def ADDiu : ArithI<0x09, "addiu", add, simm16, immSExt16>; |
| 358 | def ADDi : ArithOverflowI<0x08, "addi", add, simm16, immSExt16>; |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 359 | def SLTi : SetCC_I<0x0a, "slti", setlt, simm16, immSExt16>; |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 360 | def SLTiu : SetCC_I<0x0b, "sltiu", setult, simm16, immSExt16>; |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 361 | def ANDi : LogicI<0x0c, "andi", and>; |
| 362 | def ORi : LogicI<0x0d, "ori", or>; |
| 363 | def XORi : LogicI<0x0e, "xori", xor>; |
| 364 | def LUi : LoadUpper<0x0f, "lui">; |
| 365 | |
| 366 | /// Arithmetic Instructions (3-Operand, R-Type) |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 367 | def ADDu : ArithR<0x00, 0x21, "addu", add, IIAlu>; |
| 368 | def SUBu : ArithR<0x00, 0x23, "subu", sub, IIAlu>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 369 | def ADD : ArithOverflowR<0x00, 0x20, "add">; |
| 370 | def SUB : ArithOverflowR<0x00, 0x22, "sub">; |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 371 | def SLT : SetCC_R<0x00, 0x2a, "slt", setlt>; |
| 372 | def SLTu : SetCC_R<0x00, 0x2b, "sltu", setult>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 373 | def AND : LogicR<0x24, "and", and>; |
| 374 | def OR : LogicR<0x25, "or", or>; |
| 375 | def XOR : LogicR<0x26, "xor", xor>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 376 | def NOR : LogicNOR<0x00, 0x27, "nor">; |
| 377 | |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 378 | /// Shift Instructions |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 379 | def SLL : LogicR_shift_imm<0x00, "sll", shl>; |
| 380 | def SRL : LogicR_shift_imm<0x02, "srl", srl>; |
| 381 | def SRA : LogicR_shift_imm<0x03, "sra", sra>; |
| 382 | def SLLV : LogicR_shift_reg<0x04, "sllv", shl>; |
| 383 | def SRLV : LogicR_shift_reg<0x06, "srlv", srl>; |
| 384 | def SRAV : LogicR_shift_reg<0x07, "srav", sra>; |
| 385 | |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 386 | /// Load and Store Instructions |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 387 | def LB : LoadM<0x20, "lb", sextloadi8>; |
| 388 | def LBu : LoadM<0x24, "lbu", zextloadi8>; |
| 389 | def LH : LoadM<0x21, "lh", sextloadi16>; |
| 390 | def LHu : LoadM<0x25, "lhu", zextloadi16>; |
| 391 | def LW : LoadM<0x23, "lw", load>; |
| 392 | def SB : StoreM<0x28, "sb", truncstorei8>; |
| 393 | def SH : StoreM<0x29, "sh", truncstorei16>; |
| 394 | def SW : StoreM<0x2b, "sw", store>; |
| 395 | |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 396 | /// Jump and Branch Instructions |
| 397 | def J : JumpFJ<0x02, "j">; |
| 398 | def JR : JumpFR<0x00, 0x08, "jr">; |
| 399 | def JAL : JumpLink<0x03, "jal">; |
| 400 | def JALR : JumpLinkReg<0x00, 0x09, "jalr">; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 401 | def BEQ : CBranch<0x04, "beq", seteq>; |
| 402 | def BNE : CBranch<0x05, "bne", setne>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 403 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 404 | let rt=1 in |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 405 | def BGEZ : CBranchZero<0x01, "bgez", setge>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 406 | |
| 407 | let rt=0 in { |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 408 | def BGTZ : CBranchZero<0x07, "bgtz", setgt>; |
| 409 | def BLEZ : CBranchZero<0x07, "blez", setle>; |
| 410 | def BLTZ : CBranchZero<0x01, "bltz", setlt>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 411 | } |
| 412 | |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 413 | def BGEZAL : BranchLink<"bgezal">; |
| 414 | def BLTZAL : BranchLink<"bltzal">; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 415 | |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 416 | let isReturn=1, isTerminator=1, hasDelaySlot=1, |
| 417 | isBarrier=1, hasCtrlDep=1, rs=0, rt=0, shamt=0 in |
| 418 | def RET : FR <0x00, 0x02, (outs), (ins CPURegs:$target), |
| 419 | "jr\t$target", [(MipsRet CPURegs:$target)], IIBranch>; |
| 420 | |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 421 | /// Multiply and Divide Instructions. |
Bruno Cardoso Lopes | 91ef849 | 2008-08-02 19:42:36 +0000 | [diff] [blame] | 422 | let Defs = [HI, LO] in { |
| 423 | def MULT : MulDiv<0x18, "mult", IIImul>; |
| 424 | def MULTu : MulDiv<0x19, "multu", IIImul>; |
| 425 | def DIV : MulDiv<0x1a, "div", IIIdiv>; |
| 426 | def DIVu : MulDiv<0x1b, "divu", IIIdiv>; |
| 427 | } |
| 428 | |
| 429 | let Defs = [HI] in |
| 430 | def MTHI : MoveToLOHI<0x11, "mthi">; |
| 431 | let Defs = [LO] in |
| 432 | def MTLO : MoveToLOHI<0x13, "mtlo">; |
| 433 | |
| 434 | let Uses = [HI] in |
| 435 | def MFHI : MoveFromLOHI<0x10, "mfhi">; |
| 436 | let Uses = [LO] in |
| 437 | def MFLO : MoveFromLOHI<0x12, "mflo">; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 438 | |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 439 | /// Sign Ext In Register Instructions. |
| 440 | let Predicates = [HasSEInReg] in { |
Bruno Cardoso Lopes | d3bdf19 | 2009-05-27 17:23:44 +0000 | [diff] [blame] | 441 | let shamt = 0x10, rs = 0 in |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 442 | def SEB : SignExtInReg<0x21, "seb", i8>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 443 | |
Bruno Cardoso Lopes | d3bdf19 | 2009-05-27 17:23:44 +0000 | [diff] [blame] | 444 | let shamt = 0x18, rs = 0 in |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 445 | def SEH : SignExtInReg<0x20, "seh", i16>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 446 | } |
| 447 | |
Bruno Cardoso Lopes | 65ad452 | 2008-08-08 06:16:31 +0000 | [diff] [blame] | 448 | /// Count Leading |
Bruno Cardoso Lopes | c4bb67c | 2010-11-10 02:13:22 +0000 | [diff] [blame] | 449 | def CLZ : CountLeading<0b100000, "clz", |
| 450 | [(set CPURegs:$dst, (ctlz CPURegs:$src))]>; |
| 451 | def CLO : CountLeading<0b100001, "clo", |
| 452 | [(set CPURegs:$dst, (ctlz (not CPURegs:$src)))]>; |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 453 | |
| 454 | /// Byte Swap |
| 455 | let Predicates = [HasSwap] in { |
| 456 | let shamt = 0x3, rs = 0 in |
| 457 | def WSBW : ByteSwap<0x20, "wsbw">; |
| 458 | } |
| 459 | |
| 460 | /// Conditional Move |
| 461 | def MIPS_CMOV_ZERO : PatLeaf<(i32 0)>; |
| 462 | def MIPS_CMOV_NZERO : PatLeaf<(i32 1)>; |
| 463 | |
Eric Christopher | c452d79 | 2010-06-21 20:19:21 +0000 | [diff] [blame] | 464 | let Predicates = [HasCondMov], Constraints = "$F = $dst" in { |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 465 | def MOVN : CondMov<0x0a, "movn", MIPS_CMOV_NZERO>; |
| 466 | def MOVZ : CondMov<0x0b, "movz", MIPS_CMOV_ZERO>; |
Bruno Cardoso Lopes | 65ad452 | 2008-08-08 06:16:31 +0000 | [diff] [blame] | 467 | } |
| 468 | |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 469 | /// No operation |
| 470 | let addr=0 in |
| 471 | def NOP : FJ<0, (outs), (ins), "nop", [], IIAlu>; |
| 472 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 473 | // FrameIndexes are legalized when they are operands from load/store |
Bruno Cardoso Lopes | b42abeb | 2007-09-24 20:15:11 +0000 | [diff] [blame] | 474 | // instructions. The same not happens for stack address copies, so an |
| 475 | // add op with mem ComplexPattern is used and the stack address copy |
| 476 | // can be matched. It's similar to Sparc LEA_ADDRi |
Bruno Cardoso Lopes | 43d526d | 2008-07-14 14:42:54 +0000 | [diff] [blame] | 477 | def LEA_ADDiu : EffectiveAddress<"addiu\t$dst, ${addr:stackloc}">; |
Bruno Cardoso Lopes | b42abeb | 2007-09-24 20:15:11 +0000 | [diff] [blame] | 478 | |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 479 | // MADD*/MSUB* are not part of MipsI either. |
| 480 | //def MADD : MArithR<0x00, "madd">; |
| 481 | //def MADDU : MArithR<0x01, "maddu">; |
| 482 | //def MSUB : MArithR<0x04, "msub">; |
| 483 | //def MSUBU : MArithR<0x05, "msubu">; |
| 484 | |
Bruno Cardoso Lopes | f7d66f7 | 2008-07-30 16:58:59 +0000 | [diff] [blame] | 485 | // MUL is a assembly macro in the current used ISAs. In recent ISA's |
| 486 | // it is a real instruction. |
Bruno Cardoso Lopes | 7d5652d | 2010-11-12 00:38:32 +0000 | [diff] [blame] | 487 | def MUL : ArithR<0x1c, 0x02, "mul", mul, IIImul>, Requires<[IsMips32]>; |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 488 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 489 | //===----------------------------------------------------------------------===// |
| 490 | // Arbitrary patterns that map to one or more instructions |
| 491 | //===----------------------------------------------------------------------===// |
| 492 | |
| 493 | // Small immediates |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 494 | def : Pat<(i32 immSExt16:$in), |
Bruno Cardoso Lopes | 332a3d2 | 2007-07-11 22:47:02 +0000 | [diff] [blame] | 495 | (ADDiu ZERO, imm:$in)>; |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 496 | def : Pat<(i32 immZExt16:$in), |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 497 | (ORi ZERO, imm:$in)>; |
| 498 | |
| 499 | // Arbitrary immediates |
| 500 | def : Pat<(i32 imm:$imm), |
| 501 | (ORi (LUi (HI16 imm:$imm)), (LO16 imm:$imm))>; |
| 502 | |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 503 | // Carry patterns |
| 504 | def : Pat<(subc CPURegs:$lhs, CPURegs:$rhs), |
| 505 | (SUBu CPURegs:$lhs, CPURegs:$rhs)>; |
| 506 | def : Pat<(addc CPURegs:$lhs, CPURegs:$rhs), |
| 507 | (ADDu CPURegs:$lhs, CPURegs:$rhs)>; |
| 508 | def : Pat<(addc CPURegs:$src, imm:$imm), |
| 509 | (ADDiu CPURegs:$src, imm:$imm)>; |
| 510 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 511 | // Call |
| 512 | def : Pat<(MipsJmpLink (i32 tglobaladdr:$dst)), |
| 513 | (JAL tglobaladdr:$dst)>; |
| 514 | def : Pat<(MipsJmpLink (i32 texternalsym:$dst)), |
| 515 | (JAL texternalsym:$dst)>; |
Chris Lattner | e0d2753 | 2010-02-28 07:23:21 +0000 | [diff] [blame] | 516 | //def : Pat<(MipsJmpLink CPURegs:$dst), |
| 517 | // (JALR CPURegs:$dst)>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 518 | |
Bruno Cardoso Lopes | 92e87f2 | 2008-07-23 16:01:50 +0000 | [diff] [blame] | 519 | // hi/lo relocs |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 520 | def : Pat<(MipsHi tglobaladdr:$in), (LUi tglobaladdr:$in)>; |
Bruno Cardoso Lopes | c7db561 | 2007-11-05 03:02:32 +0000 | [diff] [blame] | 521 | def : Pat<(add CPURegs:$hi, (MipsLo tglobaladdr:$lo)), |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 522 | (ADDiu CPURegs:$hi, tglobaladdr:$lo)>; |
Bruno Cardoso Lopes | 92e87f2 | 2008-07-23 16:01:50 +0000 | [diff] [blame] | 523 | |
Bruno Cardoso Lopes | 753a987 | 2007-11-12 19:49:57 +0000 | [diff] [blame] | 524 | def : Pat<(MipsHi tjumptable:$in), (LUi tjumptable:$in)>; |
Bruno Cardoso Lopes | 753a987 | 2007-11-12 19:49:57 +0000 | [diff] [blame] | 525 | def : Pat<(add CPURegs:$hi, (MipsLo tjumptable:$lo)), |
| 526 | (ADDiu CPURegs:$hi, tjumptable:$lo)>; |
Bruno Cardoso Lopes | 92e87f2 | 2008-07-23 16:01:50 +0000 | [diff] [blame] | 527 | |
| 528 | def : Pat<(MipsHi tconstpool:$in), (LUi tconstpool:$in)>; |
| 529 | def : Pat<(add CPURegs:$hi, (MipsLo tconstpool:$lo)), |
| 530 | (ADDiu CPURegs:$hi, tconstpool:$lo)>; |
| 531 | |
| 532 | // gp_rel relocs |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 533 | def : Pat<(add CPURegs:$gp, (MipsGPRel tglobaladdr:$in)), |
Bruno Cardoso Lopes | 91fd532 | 2008-07-21 18:52:34 +0000 | [diff] [blame] | 534 | (ADDiu CPURegs:$gp, tglobaladdr:$in)>; |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 535 | def : Pat<(add CPURegs:$gp, (MipsGPRel tconstpool:$in)), |
Bruno Cardoso Lopes | 92e87f2 | 2008-07-23 16:01:50 +0000 | [diff] [blame] | 536 | (ADDiu CPURegs:$gp, tconstpool:$in)>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 537 | |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 538 | // Mips does not have "not", so we expand our way |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 539 | def : Pat<(not CPURegs:$in), |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 540 | (NOR CPURegs:$in, ZERO)>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 541 | |
Eric Christopher | 3c999a2 | 2007-10-26 04:00:13 +0000 | [diff] [blame] | 542 | // extended load and stores |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 543 | def : Pat<(extloadi1 addr:$src), (LBu addr:$src)>; |
| 544 | def : Pat<(extloadi8 addr:$src), (LBu addr:$src)>; |
| 545 | def : Pat<(extloadi16 addr:$src), (LHu addr:$src)>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 546 | |
Bruno Cardoso Lopes | 07cec75 | 2008-06-06 00:58:26 +0000 | [diff] [blame] | 547 | // peepholes |
Bruno Cardoso Lopes | c7db561 | 2007-11-05 03:02:32 +0000 | [diff] [blame] | 548 | def : Pat<(store (i32 0), addr:$dst), (SW ZERO, addr:$dst)>; |
| 549 | |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 550 | // brcond patterns |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 551 | def : Pat<(brcond (setne CPURegs:$lhs, 0), bb:$dst), |
Bruno Cardoso Lopes | 332a3d2 | 2007-07-11 22:47:02 +0000 | [diff] [blame] | 552 | (BNE CPURegs:$lhs, ZERO, bb:$dst)>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 553 | def : Pat<(brcond (seteq CPURegs:$lhs, 0), bb:$dst), |
| 554 | (BEQ CPURegs:$lhs, ZERO, bb:$dst)>; |
Bruno Cardoso Lopes | 332a3d2 | 2007-07-11 22:47:02 +0000 | [diff] [blame] | 555 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 556 | def : Pat<(brcond (setge CPURegs:$lhs, CPURegs:$rhs), bb:$dst), |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 557 | (BEQ (SLT CPURegs:$lhs, CPURegs:$rhs), ZERO, bb:$dst)>; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 558 | def : Pat<(brcond (setuge CPURegs:$lhs, CPURegs:$rhs), bb:$dst), |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 559 | (BEQ (SLTu CPURegs:$lhs, CPURegs:$rhs), ZERO, bb:$dst)>; |
| 560 | def : Pat<(brcond (setge CPURegs:$lhs, immSExt16:$rhs), bb:$dst), |
| 561 | (BEQ (SLTi CPURegs:$lhs, immSExt16:$rhs), ZERO, bb:$dst)>; |
| 562 | def : Pat<(brcond (setuge CPURegs:$lhs, immSExt16:$rhs), bb:$dst), |
| 563 | (BEQ (SLTiu CPURegs:$lhs, immSExt16:$rhs), ZERO, bb:$dst)>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 564 | |
| 565 | def : Pat<(brcond (setle CPURegs:$lhs, CPURegs:$rhs), bb:$dst), |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 566 | (BEQ (SLT CPURegs:$rhs, CPURegs:$lhs), ZERO, bb:$dst)>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 567 | def : Pat<(brcond (setule CPURegs:$lhs, CPURegs:$rhs), bb:$dst), |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 568 | (BEQ (SLTu CPURegs:$rhs, CPURegs:$lhs), ZERO, bb:$dst)>; |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 569 | |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 570 | def : Pat<(brcond CPURegs:$cond, bb:$dst), |
| 571 | (BNE CPURegs:$cond, ZERO, bb:$dst)>; |
| 572 | |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 573 | // select patterns |
| 574 | def : Pat<(select (setge CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), |
| 575 | (MOVZ CPURegs:$F, CPURegs:$T, (SLT CPURegs:$lhs, CPURegs:$rhs))>; |
| 576 | def : Pat<(select (setuge CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), |
| 577 | (MOVZ CPURegs:$F, CPURegs:$T, (SLTu CPURegs:$lhs, CPURegs:$rhs))>; |
| 578 | def : Pat<(select (setge CPURegs:$lhs, immSExt16:$rhs), CPURegs:$T, CPURegs:$F), |
| 579 | (MOVZ CPURegs:$F, CPURegs:$T, (SLTi CPURegs:$lhs, immSExt16:$rhs))>; |
| 580 | def : Pat<(select (setuge CPURegs:$lh, immSExt16:$rh), CPURegs:$T, CPURegs:$F), |
| 581 | (MOVZ CPURegs:$F, CPURegs:$T, (SLTiu CPURegs:$lh, immSExt16:$rh))>; |
| 582 | |
| 583 | def : Pat<(select (setle CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), |
| 584 | (MOVZ CPURegs:$F, CPURegs:$T, (SLT CPURegs:$rhs, CPURegs:$lhs))>; |
| 585 | def : Pat<(select (setule CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), |
| 586 | (MOVZ CPURegs:$F, CPURegs:$T, (SLTu CPURegs:$rhs, CPURegs:$lhs))>; |
| 587 | |
| 588 | def : Pat<(select (seteq CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), |
| 589 | (MOVZ CPURegs:$F, CPURegs:$T, (XOR CPURegs:$lhs, CPURegs:$rhs))>; |
| 590 | def : Pat<(select (setne CPURegs:$lhs, CPURegs:$rhs), CPURegs:$T, CPURegs:$F), |
| 591 | (MOVN CPURegs:$F, CPURegs:$T, (XOR CPURegs:$lhs, CPURegs:$rhs))>; |
| 592 | |
Bruno Cardoso Lopes | 9e03061 | 2010-11-09 17:25:34 +0000 | [diff] [blame] | 593 | def : Pat<(select CPURegs:$cond, CPURegs:$T, CPURegs:$F), |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 594 | (MOVN CPURegs:$F, CPURegs:$T, CPURegs:$cond)>; |
| 595 | |
Bruno Cardoso Lopes | ab8d53a | 2010-12-07 19:00:20 +0000 | [diff] [blame] | 596 | // select patterns with got access |
| 597 | def : Pat<(select (setne CPURegs:$lhs, CPURegs:$rhs), |
| 598 | (i32 tglobaladdr:$T), CPURegs:$F), |
| 599 | (MOVN CPURegs:$F, (ADDiu GP, tglobaladdr:$T), |
| 600 | (XOR CPURegs:$lhs, CPURegs:$rhs))>; |
| 601 | |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 602 | // setcc patterns |
| 603 | def : Pat<(seteq CPURegs:$lhs, CPURegs:$rhs), |
| 604 | (SLTu (XOR CPURegs:$lhs, CPURegs:$rhs), 1)>; |
| 605 | def : Pat<(setne CPURegs:$lhs, CPURegs:$rhs), |
| 606 | (SLTu ZERO, (XOR CPURegs:$lhs, CPURegs:$rhs))>; |
| 607 | |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 608 | def : Pat<(setle CPURegs:$lhs, CPURegs:$rhs), |
| 609 | (XORi (SLT CPURegs:$rhs, CPURegs:$lhs), 1)>; |
| 610 | def : Pat<(setule CPURegs:$lhs, CPURegs:$rhs), |
| 611 | (XORi (SLTu CPURegs:$rhs, CPURegs:$lhs), 1)>; |
| 612 | |
| 613 | def : Pat<(setgt CPURegs:$lhs, CPURegs:$rhs), |
| 614 | (SLT CPURegs:$rhs, CPURegs:$lhs)>; |
| 615 | def : Pat<(setugt CPURegs:$lhs, CPURegs:$rhs), |
| 616 | (SLTu CPURegs:$rhs, CPURegs:$lhs)>; |
| 617 | |
| 618 | def : Pat<(setge CPURegs:$lhs, CPURegs:$rhs), |
| 619 | (XORi (SLT CPURegs:$lhs, CPURegs:$rhs), 1)>; |
| 620 | def : Pat<(setuge CPURegs:$lhs, CPURegs:$rhs), |
| 621 | (XORi (SLTu CPURegs:$lhs, CPURegs:$rhs), 1)>; |
| 622 | |
Bruno Cardoso Lopes | 9710536 | 2007-08-18 02:37:46 +0000 | [diff] [blame] | 623 | def : Pat<(setge CPURegs:$lhs, immSExt16:$rhs), |
| 624 | (XORi (SLTi CPURegs:$lhs, immSExt16:$rhs), 1)>; |
Bruno Cardoso Lopes | 739e441 | 2008-08-13 07:13:40 +0000 | [diff] [blame] | 625 | def : Pat<(setuge CPURegs:$lhs, immSExt16:$rhs), |
| 626 | (XORi (SLTiu CPURegs:$lhs, immSExt16:$rhs), 1)>; |
Bruno Cardoso Lopes | 225ca9c | 2008-07-05 19:05:21 +0000 | [diff] [blame] | 627 | |
| 628 | //===----------------------------------------------------------------------===// |
| 629 | // Floating Point Support |
| 630 | //===----------------------------------------------------------------------===// |
| 631 | |
| 632 | include "MipsInstrFPU.td" |
| 633 | |