Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 1 | |
Misha Brukman | 8c02c1c | 2004-07-27 23:29:16 +0000 | [diff] [blame] | 2 | //===- PowerPCInstrInfo.td - The PowerPC Instruction Set -----*- tablegen -*-=// |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 3 | // |
| 4 | // The LLVM Compiler Infrastructure |
| 5 | // |
| 6 | // This file was developed by the LLVM research group and is distributed under |
| 7 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | // |
Misha Brukman | 4ad7d1b | 2004-08-09 17:24:04 +0000 | [diff] [blame] | 11 | // This file describes the subset of the 32-bit PowerPC instruction set, as used |
| 12 | // by the PowerPC instruction selector. |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
Misha Brukman | 28791dd | 2004-08-02 16:54:54 +0000 | [diff] [blame] | 16 | include "PowerPCInstrFormats.td" |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 17 | |
Misha Brukman | 145a5a3 | 2004-11-15 21:20:09 +0000 | [diff] [blame] | 18 | let isTerminator = 1 in { |
| 19 | let isReturn = 1 in |
Chris Lattner | 6f40789 | 2004-11-23 22:06:24 +0000 | [diff] [blame] | 20 | def BLR : XLForm_2_ext<19, 16, 20, 0, 0, 0, 0, (ops), "blr">; |
| 21 | def BCTR : XLForm_2_ext<19, 528, 20, 0, 0, 0, 0, (ops), "bctr">; |
Misha Brukman | 145a5a3 | 2004-11-15 21:20:09 +0000 | [diff] [blame] | 22 | } |
Chris Lattner | 7bb424f | 2004-08-14 23:27:29 +0000 | [diff] [blame] | 23 | |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 24 | def u5imm : Operand<i8> { |
| 25 | let PrintMethod = "printU5ImmOperand"; |
| 26 | } |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 27 | def u6imm : Operand<i8> { |
| 28 | let PrintMethod = "printU6ImmOperand"; |
| 29 | } |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 30 | def s16imm : Operand<i16> { |
| 31 | let PrintMethod = "printS16ImmOperand"; |
| 32 | } |
Chris Lattner | 97b2a2e | 2004-08-15 05:20:16 +0000 | [diff] [blame] | 33 | def u16imm : Operand<i16> { |
| 34 | let PrintMethod = "printU16ImmOperand"; |
| 35 | } |
Nate Begeman | b7a8f2c | 2004-09-02 08:13:00 +0000 | [diff] [blame] | 36 | def target : Operand<i32> { |
| 37 | let PrintMethod = "printBranchOperand"; |
| 38 | } |
| 39 | def piclabel: Operand<i32> { |
| 40 | let PrintMethod = "printPICLabel"; |
| 41 | } |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 42 | def symbolHi: Operand<i32> { |
| 43 | let PrintMethod = "printSymbolHi"; |
| 44 | } |
| 45 | def symbolLo: Operand<i32> { |
| 46 | let PrintMethod = "printSymbolLo"; |
| 47 | } |
Nate Begeman | ef7288c | 2005-04-14 03:20:38 +0000 | [diff] [blame] | 48 | def crbit: Operand<i8> { |
| 49 | let PrintMethod = "printcrbit"; |
| 50 | } |
Chris Lattner | 97b2a2e | 2004-08-15 05:20:16 +0000 | [diff] [blame] | 51 | |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 52 | // Pseudo-instructions: |
Nate Begeman | b7a8f2c | 2004-09-02 08:13:00 +0000 | [diff] [blame] | 53 | def PHI : Pseudo<(ops), "; PHI">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 54 | let isLoad = 1 in { |
Nate Begeman | b7a8f2c | 2004-09-02 08:13:00 +0000 | [diff] [blame] | 55 | def ADJCALLSTACKDOWN : Pseudo<(ops), "; ADJCALLSTACKDOWN">; |
| 56 | def ADJCALLSTACKUP : Pseudo<(ops), "; ADJCALLSTACKUP">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 57 | } |
Nate Begeman | b7a8f2c | 2004-09-02 08:13:00 +0000 | [diff] [blame] | 58 | def IMPLICIT_DEF : Pseudo<(ops), "; IMPLICIT_DEF">; |
Chris Lattner | 7a823bd | 2005-02-15 20:26:49 +0000 | [diff] [blame] | 59 | |
| 60 | let Defs = [LR] in |
| 61 | def MovePCtoLR : Pseudo<(ops piclabel:$label), "bl $label">; |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 62 | |
Misha Brukman | b2edb44 | 2004-06-28 18:23:35 +0000 | [diff] [blame] | 63 | let isBranch = 1, isTerminator = 1 in { |
Nate Begeman | b7a8f2c | 2004-09-02 08:13:00 +0000 | [diff] [blame] | 64 | def COND_BRANCH : Pseudo<(ops), "; COND_BRANCH">; |
Misha Brukman | 40a55e1 | 2004-10-23 20:29:24 +0000 | [diff] [blame] | 65 | def B : IForm<18, 0, 0, 0, 0, (ops target:$func), "b $func">; |
Chris Lattner | dd99885 | 2004-11-22 23:07:01 +0000 | [diff] [blame] | 66 | //def BA : IForm<18, 1, 0, 0, 0, (ops target:$func), "ba $func">; |
Misha Brukman | 40a55e1 | 2004-10-23 20:29:24 +0000 | [diff] [blame] | 67 | def BL : IForm<18, 0, 1, 0, 0, (ops target:$func), "bl $func">; |
Chris Lattner | dd99885 | 2004-11-22 23:07:01 +0000 | [diff] [blame] | 68 | //def BLA : IForm<18, 1, 1, 0, 0, (ops target:$func), "bla $func">; |
| 69 | |
Misha Brukman | 4ad7d1b | 2004-08-09 17:24:04 +0000 | [diff] [blame] | 70 | // FIXME: 4*CR# needs to be added to the BI field! |
| 71 | // This will only work for CR0 as it stands now |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 72 | def BLT : BForm_ext<16, 0, 0, 12, 0, 0, 0, (ops CRRC:$crS, target:$block), |
| 73 | "blt $block">; |
| 74 | def BLE : BForm_ext<16, 0, 0, 4, 1, 0, 0, (ops CRRC:$crS, target:$block), |
| 75 | "ble $block">; |
| 76 | def BEQ : BForm_ext<16, 0, 0, 12, 2, 0, 0, (ops CRRC:$crS, target:$block), |
| 77 | "beq $block">; |
| 78 | def BGE : BForm_ext<16, 0, 0, 4, 0, 0, 0, (ops CRRC:$crS, target:$block), |
| 79 | "bge $block">; |
| 80 | def BGT : BForm_ext<16, 0, 0, 12, 1, 0, 0, (ops CRRC:$crS, target:$block), |
| 81 | "bgt $block">; |
| 82 | def BNE : BForm_ext<16, 0, 0, 4, 2, 0, 0, (ops CRRC:$crS, target:$block), |
| 83 | "bne $block">; |
Misha Brukman | b2edb44 | 2004-06-28 18:23:35 +0000 | [diff] [blame] | 84 | } |
| 85 | |
Misha Brukman | 5fa2b02 | 2004-06-29 23:37:36 +0000 | [diff] [blame] | 86 | let isBranch = 1, isTerminator = 1, isCall = 1, |
| 87 | // All calls clobber the non-callee saved registers... |
Misha Brukman | c661c30 | 2004-06-30 22:00:45 +0000 | [diff] [blame] | 88 | Defs = [R0,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12, |
| 89 | F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13, |
| 90 | LR,XER,CTR, |
| 91 | CR0,CR1,CR5,CR6,CR7] in { |
| 92 | // Convenient aliases for call instructions |
Nate Begeman | b7a8f2c | 2004-09-02 08:13:00 +0000 | [diff] [blame] | 93 | def CALLpcrel : IForm<18, 0, 1, 0, 0, (ops target:$func), "bl $func">; |
Nate Begeman | 3b78e3b | 2004-11-24 00:16:37 +0000 | [diff] [blame] | 94 | def CALLindirect : XLForm_2_ext<19, 528, 20, 0, 1, 0, 0, (ops), "bctrl">; |
Misha Brukman | 5fa2b02 | 2004-06-29 23:37:36 +0000 | [diff] [blame] | 95 | } |
| 96 | |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 97 | // D-Form instructions. Most instructions that perform an operation on a |
| 98 | // register and an immediate are of this type. |
| 99 | // |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 100 | let isLoad = 1 in { |
Chris Lattner | 943f452 | 2004-11-23 19:23:18 +0000 | [diff] [blame] | 101 | def LBZ : DForm_1<34, 0, 0, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA), |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 102 | "lbz $rD, $disp($rA)">; |
| 103 | def LHA : DForm_1<42, 0, 0, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA), |
| 104 | "lha $rD, $disp($rA)">; |
| 105 | def LHZ : DForm_1<40, 0, 0, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA), |
| 106 | "lhz $rD, $disp($rA)">; |
| 107 | def LMW : DForm_1<46, 0, 0, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA), |
| 108 | "lmw $rD, $disp($rA)">; |
| 109 | def LWZ : DForm_1<32, 0, 0, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA), |
| 110 | "lwz $rD, $disp($rA)">; |
Chris Lattner | 943f452 | 2004-11-23 19:23:18 +0000 | [diff] [blame] | 111 | def LWZU : DForm_1<35, 0, 0, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA), |
Misha Brukman | 145a5a3 | 2004-11-15 21:20:09 +0000 | [diff] [blame] | 112 | "lwzu $rD, $disp($rA)">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 113 | } |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 114 | def ADDI : DForm_2<14, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), |
| 115 | "addi $rD, $rA, $imm">; |
| 116 | def ADDIC : DForm_2<12, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), |
| 117 | "addic $rD, $rA, $imm">; |
| 118 | def ADDICo : DForm_2<13, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), |
| 119 | "addic. $rD, $rA, $imm">; |
| 120 | def ADDIS : DForm_2<15, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), |
| 121 | "addis $rD, $rA, $imm">; |
Chris Lattner | 6540c6c | 2004-11-23 05:54:25 +0000 | [diff] [blame] | 122 | def LA : DForm_2<14, 0, 0, (ops GPRC:$rD, GPRC:$rA, symbolLo:$sym), |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 123 | "la $rD, $sym($rA)">; |
| 124 | def LOADHiAddr : DForm_2<15, 0, 0, (ops GPRC:$rD, GPRC:$rA, symbolHi:$sym), |
| 125 | "addis $rD, $rA, $sym">; |
| 126 | def MULLI : DForm_2< 7, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), |
| 127 | "mulli $rD, $rA, $imm">; |
| 128 | def SUBFIC : DForm_2< 8, 0, 0, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), |
| 129 | "subfic $rD, $rA, $imm">; |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 130 | def LI : DForm_2_r0<14, 0, 0, (ops GPRC:$rD, s16imm:$imm), |
| 131 | "li $rD, $imm">; |
| 132 | def LIS : DForm_2_r0<15, 0, 0, (ops GPRC:$rD, s16imm:$imm), |
| 133 | "lis $rD, $imm">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 134 | let isStore = 1 in { |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 135 | def STMW : DForm_3<47, 0, 0, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA), |
| 136 | "stmw $rS, $disp($rA)">; |
| 137 | def STB : DForm_3<38, 0, 0, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA), |
| 138 | "stb $rS, $disp($rA)">; |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 139 | def STH : DForm_3<44, 0, 0, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA), |
| 140 | "sth $rS, $disp($rA)">; |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 141 | def STW : DForm_3<36, 0, 0, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA), |
| 142 | "stw $rS, $disp($rA)">; |
| 143 | def STWU : DForm_3<37, 0, 0, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA), |
| 144 | "stwu $rS, $disp($rA)">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 145 | } |
Nate Begeman | c7bd482 | 2005-04-11 06:34:10 +0000 | [diff] [blame] | 146 | let Defs = [CR0] in { |
Nate Begeman | 6b3dc55 | 2004-08-29 22:45:13 +0000 | [diff] [blame] | 147 | def ANDIo : DForm_4<28, 0, 0, |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 148 | (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), |
| 149 | "andi. $dst, $src1, $src2">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 150 | def ANDISo : DForm_4<29, 0, 0, |
| 151 | (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), |
| 152 | "andis. $dst, $src1, $src2">; |
Nate Begeman | c7bd482 | 2005-04-11 06:34:10 +0000 | [diff] [blame] | 153 | } |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 154 | def ORI : DForm_4<24, 0, 0, |
| 155 | (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), |
| 156 | "ori $dst, $src1, $src2">; |
| 157 | def ORIS : DForm_4<25, 0, 0, |
| 158 | (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), |
| 159 | "oris $dst, $src1, $src2">; |
Chris Lattner | 97b2a2e | 2004-08-15 05:20:16 +0000 | [diff] [blame] | 160 | def XORI : DForm_4<26, 0, 0, |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 161 | (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), |
| 162 | "xori $dst, $src1, $src2">; |
Chris Lattner | 97b2a2e | 2004-08-15 05:20:16 +0000 | [diff] [blame] | 163 | def XORIS : DForm_4<27, 0, 0, |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 164 | (ops GPRC:$dst, GPRC:$src1, u16imm:$src2), |
| 165 | "xoris $dst, $src1, $src2">; |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 166 | def NOP : DForm_4_zero<24, 0, 0, (ops), "nop">; |
| 167 | def CMPI : DForm_5<11, 0, 0, (ops CRRC:$crD, i1imm:$L, GPRC:$rA, s16imm:$imm), |
| 168 | "cmpi $crD, $L, $rA, $imm">; |
| 169 | def CMPWI : DForm_5_ext<11, 0, 0, (ops CRRC:$crD, GPRC:$rA, s16imm:$imm), |
| 170 | "cmpwi $crD, $rA, $imm">; |
| 171 | def CMPDI : DForm_5_ext<11, 1, 0, (ops CRRC:$crD, GPRC:$rA, s16imm:$imm), |
| 172 | "cmpdi $crD, $rA, $imm">; |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 173 | def CMPLI : DForm_6<10, 0, 0, |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 174 | (ops CRRC:$dst, i1imm:$size, GPRC:$src1, u16imm:$src2), |
| 175 | "cmpli $dst, $size, $src1, $src2">; |
Nate Begeman | 6b3dc55 | 2004-08-29 22:45:13 +0000 | [diff] [blame] | 176 | def CMPLWI : DForm_6_ext<10, 0, 0, |
| 177 | (ops CRRC:$dst, GPRC:$src1, u16imm:$src2), |
| 178 | "cmplwi $dst, $src1, $src2">; |
| 179 | def CMPLDI : DForm_6_ext<10, 1, 0, |
| 180 | (ops CRRC:$dst, GPRC:$src1, u16imm:$src2), |
| 181 | "cmpldi $dst, $src1, $src2">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 182 | let isLoad = 1 in { |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 183 | def LFS : DForm_8<48, 0, 0, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA), |
| 184 | "lfs $rD, $disp($rA)">; |
| 185 | def LFD : DForm_8<50, 0, 0, (ops GPRC:$rD, symbolLo:$disp, GPRC:$rA), |
| 186 | "lfd $rD, $disp($rA)">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 187 | } |
| 188 | let isStore = 1 in { |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 189 | def STFS : DForm_9<52, 0, 0, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA), |
| 190 | "stfs $rS, $disp($rA)">; |
| 191 | def STFD : DForm_9<54, 0, 0, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA), |
| 192 | "stfd $rS, $disp($rA)">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 193 | } |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 194 | |
| 195 | // DS-Form instructions. Load/Store instructions available in PPC-64 |
| 196 | // |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 197 | let isLoad = 1 in { |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 198 | def LWA : DSForm_1<58, 2, 1, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA), |
| 199 | "lwa $rT, $DS($rA)">; |
| 200 | def LD : DSForm_2<58, 0, 1, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA), |
| 201 | "ld $rT, $DS($rA)">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 202 | } |
| 203 | let isStore = 1 in { |
Nate Begeman | ed42853 | 2004-09-04 05:00:00 +0000 | [diff] [blame] | 204 | def STD : DSForm_2<62, 0, 1, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA), |
| 205 | "std $rT, $DS($rA)">; |
| 206 | def STDU : DSForm_2<62, 1, 1, 0, (ops GPRC:$rT, s16imm:$DS, GPRC:$rA), |
| 207 | "stdu $rT, $DS($rA)">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 208 | } |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 209 | |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 210 | // X-Form instructions. Most instructions that perform an operation on a |
| 211 | // register and another register are of this type. |
| 212 | // |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 213 | let isLoad = 1 in { |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 214 | def LBZX : XForm_1<31, 87, 0, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), |
| 215 | "lbzx $dst, $base, $index">; |
| 216 | def LHAX : XForm_1<31, 343, 0, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), |
| 217 | "lhax $dst, $base, $index">; |
| 218 | def LHZX : XForm_1<31, 279, 0, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), |
| 219 | "lhzx $dst, $base, $index">; |
| 220 | def LWAX : XForm_1<31, 341, 1, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), |
| 221 | "lwax $dst, $base, $index">; |
| 222 | def LWZX : XForm_1<31, 23, 0, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), |
| 223 | "lwzx $dst, $base, $index">; |
| 224 | def LDX : XForm_1<31, 21, 1, 0, (ops GPRC:$dst, GPRC:$base, GPRC:$index), |
| 225 | "ldx $dst, $base, $index">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 226 | } |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 227 | def AND : XForm_6<31, 28, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 228 | "and $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 229 | let Defs = [CR0] in |
| 230 | def ANDo : XForm_6<31, 28, 1, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
| 231 | "and. $rA, $rS, $rB">; |
| 232 | def ANDC : XForm_6<31, 60, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 233 | "andc $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 234 | def EQV : XForm_6<31, 284, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 235 | "eqv $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 236 | def NAND : XForm_6<31, 476, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 237 | "nand $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 238 | def NOR : XForm_6<31, 124, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 239 | "nor $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 240 | def OR : XForm_6<31, 444, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 241 | "or $rA, $rS, $rB">; |
Chris Lattner | 5eef9f3 | 2005-04-11 15:03:48 +0000 | [diff] [blame] | 242 | let Defs = [CR0] in |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 243 | def ORo : XForm_6<31, 444, 1, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
| 244 | "or. $rA, $rS, $rB">; |
| 245 | def ORC : XForm_6<31, 412, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 246 | "orc $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 247 | def SLD : XForm_6<31, 27, 0, 1, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 248 | "sld $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 249 | def SLW : XForm_6<31, 24, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 250 | "slw $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 251 | def SRD : XForm_6<31, 539, 0, 1, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 252 | "srd $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 253 | def SRW : XForm_6<31, 536, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 254 | "srw $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 255 | def SRAD : XForm_6<31, 794, 0, 1, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 256 | "srad $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 257 | def SRAW : XForm_6<31, 792, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 258 | "sraw $rA, $rS, $rB">; |
Chris Lattner | 6b4ea2c | 2005-04-11 15:03:41 +0000 | [diff] [blame] | 259 | def XOR : XForm_6<31, 316, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 260 | "xor $rA, $rS, $rB">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 261 | let isStore = 1 in { |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 262 | def STBX : XForm_8<31, 215, 0, 0, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB), |
| 263 | "stbx $rS, $rA, $rB">; |
| 264 | def STHX : XForm_8<31, 407, 0, 0, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB), |
| 265 | "sthx $rS, $rA, $rB">; |
| 266 | def STWX : XForm_8<31, 151, 0, 0, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB), |
| 267 | "stwx $rS, $rA, $rB">; |
| 268 | def STWUX : XForm_8<31, 183, 0, 0, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB), |
| 269 | "stwux $rS, $rA, $rB">; |
| 270 | def STDX : XForm_8<31, 149, 1, 0, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB), |
| 271 | "stdx $rS, $rA, $rB">; |
| 272 | def STDUX : XForm_8<31, 181, 1, 0, (ops GPRC:$rS, GPRC:$rA, GPRC:$rB), |
| 273 | "stdux $rS, $rA, $rB">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 274 | } |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 275 | def SRAWI : XForm_10<31, 824, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, u5imm:$SH), |
| 276 | "srawi $rA, $rS, $SH">; |
| 277 | def CNTLZW : XForm_11<31, 26, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS), |
| 278 | "cntlzw $rA, $rS">; |
| 279 | def EXTSB : XForm_11<31, 954, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS), |
| 280 | "extsb $rA, $rS">; |
| 281 | def EXTSH : XForm_11<31, 922, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS), |
| 282 | "extsh $rA, $rS">; |
Nate Begeman | d332fd5 | 2004-08-29 22:02:43 +0000 | [diff] [blame] | 283 | def EXTSW : XForm_11<31, 986, 0, 1, 0, (ops GPRC:$rA, GPRC:$rS), |
| 284 | "extsw $rA, $rS">; |
Nate Begeman | b7a8f2c | 2004-09-02 08:13:00 +0000 | [diff] [blame] | 285 | def CMP : XForm_16<31, 0, 0, 0, |
| 286 | (ops CRRC:$crD, i1imm:$long, GPRC:$rA, GPRC:$rB), |
| 287 | "cmp $crD, $long, $rA, $rB">; |
| 288 | def CMPL : XForm_16<31, 32, 0, 0, |
| 289 | (ops CRRC:$crD, i1imm:$long, GPRC:$rA, GPRC:$rB), |
| 290 | "cmpl $crD, $long, $rA, $rB">; |
| 291 | def CMPW : XForm_16_ext<31, 0, 0, 0, |
| 292 | (ops CRRC:$crD, GPRC:$rA, GPRC:$rB), |
| 293 | "cmpw $crD, $rA, $rB">; |
| 294 | def CMPD : XForm_16_ext<31, 0, 1, 0, |
| 295 | (ops CRRC:$crD, GPRC:$rA, GPRC:$rB), |
| 296 | "cmpd $crD, $rA, $rB">; |
| 297 | def CMPLW : XForm_16_ext<31, 32, 0, 0, |
| 298 | (ops CRRC:$crD, GPRC:$rA, GPRC:$rB), |
| 299 | "cmplw $crD, $rA, $rB">; |
| 300 | def CMPLD : XForm_16_ext<31, 32, 1, 0, |
| 301 | (ops CRRC:$crD, GPRC:$rA, GPRC:$rB), |
| 302 | "cmpld $crD, $rA, $rB">; |
Nate Begeman | 3316252 | 2005-03-29 21:54:38 +0000 | [diff] [blame] | 303 | def FCMPO : XForm_17<63, 32, 0, 0, (ops CRRC:$crD, FPRC:$fA, FPRC:$fB), |
| 304 | "fcmpo $crD, $fA, $fB">; |
Nate Begeman | cc8bd9c | 2004-08-31 02:28:08 +0000 | [diff] [blame] | 305 | def FCMPU : XForm_17<63, 0, 0, 0, (ops CRRC:$crD, FPRC:$fA, FPRC:$fB), |
| 306 | "fcmpu $crD, $fA, $fB">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 307 | let isLoad = 1 in { |
Nate Begeman | cc8bd9c | 2004-08-31 02:28:08 +0000 | [diff] [blame] | 308 | def LFSX : XForm_25<31, 535, 0, 0, (ops FPRC:$dst, GPRC:$base, GPRC:$index), |
| 309 | "lfsx $dst, $base, $index">; |
| 310 | def LFDX : XForm_25<31, 599, 0, 0, (ops FPRC:$dst, GPRC:$base, GPRC:$index), |
| 311 | "lfdx $dst, $base, $index">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 312 | } |
Nate Begeman | d332fd5 | 2004-08-29 22:02:43 +0000 | [diff] [blame] | 313 | def FCFID : XForm_26<63, 846, 0, 1, 0, (ops FPRC:$frD, FPRC:$frB), |
| 314 | "fcfid $frD, $frB">; |
| 315 | def FCTIDZ : XForm_26<63, 815, 0, 1, 0, (ops FPRC:$frD, FPRC:$frB), |
| 316 | "fctidz $frD, $frB">; |
| 317 | def FCTIWZ : XForm_26<63, 15, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), |
| 318 | "fctiwz $frD, $frB">; |
Nate Begeman | 27eeb00 | 2005-04-02 05:59:34 +0000 | [diff] [blame] | 319 | def FABS : XForm_26<63, 264, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), |
| 320 | "fabs $frD, $frB">; |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 321 | def FMR : XForm_26<63, 72, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), |
| 322 | "fmr $frD, $frB">; |
Nate Begeman | 27eeb00 | 2005-04-02 05:59:34 +0000 | [diff] [blame] | 323 | def FNABS : XForm_26<63, 136, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), |
| 324 | "fnabs $frD, $frB">; |
Chris Lattner | a1ab451 | 2004-11-25 03:53:44 +0000 | [diff] [blame] | 325 | def FNEG : XForm_26<63, 40, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 326 | "fneg $frD, $frB">; |
| 327 | def FRSP : XForm_26<63, 12, 0, 0, 0, (ops FPRC:$frD, FPRC:$frB), |
| 328 | "frsp $frD, $frB">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 329 | let isStore = 1 in { |
Nate Begeman | c330612 | 2004-08-21 05:56:39 +0000 | [diff] [blame] | 330 | def STFSX : XForm_28<31, 663, 0, 0, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB), |
| 331 | "stfsx $frS, $rA, $rB">; |
| 332 | def STFDX : XForm_28<31, 727, 0, 0, (ops FPRC:$frS, GPRC:$rA, GPRC:$rB), |
| 333 | "stfdx $frS, $rA, $rB">; |
Nate Begeman | b816f02 | 2004-10-07 22:30:03 +0000 | [diff] [blame] | 334 | } |
Nate Begeman | 6b3dc55 | 2004-08-29 22:45:13 +0000 | [diff] [blame] | 335 | |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 336 | // XL-Form instructions. condition register logical ops. |
| 337 | // |
Nate Begeman | ef7288c | 2005-04-14 03:20:38 +0000 | [diff] [blame] | 338 | def CRAND : XLForm_1<19, 257, 0, 0, (ops CRRC:$D, crbit:$Db, |
| 339 | CRRC:$A, crbit:$Ab, CRRC:$B, crbit:$Bb), |
| 340 | "crand $Db, $Ab, $Bb">; |
| 341 | def CRANDC : XLForm_1<19, 129, 0, 0, (ops CRRC:$D, crbit:$Db, |
| 342 | CRRC:$A, crbit:$Ab, CRRC:$B, crbit:$Bb), |
| 343 | "crandc $Db, $Ab, $Bb">; |
| 344 | def CREQV : XLForm_1<19, 289, 0, 0, (ops CRRC:$D, crbit:$Db, |
| 345 | CRRC:$A, crbit:$Ab, CRRC:$B, crbit:$Bb), |
| 346 | "creqv $Db, $Ab, $Bb">; |
| 347 | def CRNAND : XLForm_1<19, 225, 0, 0, (ops CRRC:$D, crbit:$Db, |
| 348 | CRRC:$A, crbit:$Ab, CRRC:$B, crbit:$Bb), |
| 349 | "crnand $Db, $Ab, $Bb">; |
| 350 | def CRNOR : XLForm_1<19, 33, 0, 0, (ops CRRC:$D, crbit:$Db, |
| 351 | CRRC:$A, crbit:$Ab, CRRC:$B, crbit:$Bb), |
| 352 | "crnor $Db, $Ab, $Bb">; |
| 353 | def CROR : XLForm_1<19, 449, 0, 0, (ops CRRC:$D, crbit:$Db, |
| 354 | CRRC:$A, crbit:$Ab, CRRC:$B, crbit:$Bb), |
| 355 | "cror $Db, $Ab, $Bb">; |
| 356 | def CRORC : XLForm_1<19, 417, 0, 0, (ops CRRC:$D, crbit:$Db, |
| 357 | CRRC:$A, crbit:$Ab, CRRC:$B, crbit:$Bb), |
| 358 | "crorc $Db, $Ab, $Bb">; |
| 359 | def CRXOR : XLForm_1<19, 193, 0, 0, (ops CRRC:$D, crbit:$Db, |
| 360 | CRRC:$A, crbit:$Ab, CRRC:$B, crbit:$Bb), |
| 361 | "crxor $Db, $Ab, $Bb">; |
Nate Begeman | 7af0248 | 2005-04-12 07:04:16 +0000 | [diff] [blame] | 362 | def MCRF : XLForm_3<19, 0, 0, 0, (ops CRRC:$BF, CRRC:$BFA), |
Nate Begeman | 7bfba7d | 2005-04-14 09:45:08 +0000 | [diff] [blame] | 363 | "mcrf $BF, $BFA">; |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 364 | |
| 365 | // XFX-Form instructions. Instructions that deal with SPRs |
| 366 | // |
Misha Brukman | da8d96d | 2004-10-23 06:05:49 +0000 | [diff] [blame] | 367 | // Note that although LR should be listed as `8' and CTR as `9' in the SPR |
| 368 | // field, the manual lists the groups of bits as [5-9] = 0, [0-4] = 8 or 9 |
| 369 | // which means the SPR value needs to be multiplied by a factor of 32. |
| 370 | def MFCTR : XFXForm_1_ext<31, 339, 288, 0, 0, (ops GPRC:$rT), "mfctr $rT">; |
| 371 | def MFLR : XFXForm_1_ext<31, 339, 256, 0, 0, (ops GPRC:$rT), "mflr $rT">; |
Nate Begeman | 7af0248 | 2005-04-12 07:04:16 +0000 | [diff] [blame] | 372 | def MFCR : XFXForm_3<31, 19, 0, 0, (ops GPRC:$rT), "mfcr $rT">; |
Nate Begeman | 16ac709 | 2005-04-18 02:43:24 +0000 | [diff] [blame^] | 373 | def MTCRF : XFXForm_5<31, 0, 144, 0, 0, (ops CRRC:$FXM, GPRC:$rS), |
Nate Begeman | 7af0248 | 2005-04-12 07:04:16 +0000 | [diff] [blame] | 374 | "mtcrf $FXM, $rS">; |
Nate Begeman | 16ac709 | 2005-04-18 02:43:24 +0000 | [diff] [blame^] | 375 | def MFCRF : XFXForm_5<31, 1, 19, 0, 0, (ops GPRC:$rT, CRRC:$FXM), |
| 376 | "mfcr $rT, $FXM">; |
Misha Brukman | da8d96d | 2004-10-23 06:05:49 +0000 | [diff] [blame] | 377 | def MTCTR : XFXForm_7_ext<31, 467, 288, 0, 0, (ops GPRC:$rS), "mtctr $rS">; |
| 378 | def MTLR : XFXForm_7_ext<31, 467, 256, 0, 0, (ops GPRC:$rS), "mtlr $rS">; |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 379 | |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 380 | // XS-Form instructions. Just 'sradi' |
| 381 | // |
| 382 | def SRADI : XSForm_1<31, 413, 0, 1, 0, (ops GPRC:$rA, GPRC:$rS, u6imm:$SH), |
| 383 | "sradi $rA, $rS, $SH">; |
| 384 | |
| 385 | // XO-Form instructions. Arithmetic instructions that can set overflow bit |
| 386 | // |
| 387 | def ADD : XOForm_1<31, 266, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 388 | "add $rT, $rA, $rB">; |
| 389 | def ADDC : XOForm_1<31, 10, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 390 | "addc $rT, $rA, $rB">; |
| 391 | def ADDE : XOForm_1<31, 138, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 392 | "adde $rT, $rA, $rB">; |
Nate Begeman | 20136a2 | 2004-09-06 18:46:59 +0000 | [diff] [blame] | 393 | def DIVD : XOForm_1<31, 489, 0, 0, 1, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 394 | "divd $rT, $rA, $rB">; |
| 395 | def DIVDU : XOForm_1<31, 457, 0, 0, 1, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 396 | "divdu $rT, $rA, $rB">; |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 397 | def DIVW : XOForm_1<31, 491, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 398 | "divw $rT, $rA, $rB">; |
| 399 | def DIVWU : XOForm_1<31, 459, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 400 | "divwu $rT, $rA, $rB">; |
Nate Begeman | 815d6da | 2005-04-06 00:25:27 +0000 | [diff] [blame] | 401 | def MULHW : XOForm_1<31, 75, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 402 | "mulhw $rT, $rA, $rB">; |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 403 | def MULHWU : XOForm_1<31, 11, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 404 | "mulhwu $rT, $rA, $rB">; |
| 405 | def MULLD : XOForm_1<31, 233, 0, 0, 1, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 406 | "mulld $rT, $rA, $rB">; |
| 407 | def MULLW : XOForm_1<31, 235, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 408 | "mullw $rT, $rA, $rB">; |
| 409 | def SUBF : XOForm_1<31, 40, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 410 | "subf $rT, $rA, $rB">; |
| 411 | def SUBFC : XOForm_1<31, 8, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 412 | "subfc $rT, $rA, $rB">; |
| 413 | def SUBFE : XOForm_1<31, 136, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 414 | "subfe $rT, $rA, $rB">; |
| 415 | def SUB : XOForm_1r<31, 40, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), |
| 416 | "sub $rT, $rA, $rB">; |
Nate Begeman | a2de102 | 2004-09-22 04:40:25 +0000 | [diff] [blame] | 417 | def ADDME : XOForm_3<31, 234, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA), |
| 418 | "addme $rT, $rA">; |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 419 | def ADDZE : XOForm_3<31, 202, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA), |
| 420 | "addze $rT, $rA">; |
| 421 | def NEG : XOForm_3<31, 104, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA), |
| 422 | "neg $rT, $rA">; |
| 423 | def SUBFZE : XOForm_3<31, 200, 0, 0, 0, 0, (ops GPRC:$rT, GPRC:$rA), |
| 424 | "subfze $rT, $rA">; |
| 425 | |
| 426 | // A-Form instructions. Most of the instructions executed in the FPU are of |
| 427 | // this type. |
| 428 | // |
| 429 | def FMADD : AForm_1<63, 29, 0, 0, 0, |
| 430 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 431 | "fmadd $FRT, $FRA, $FRC, $FRB">; |
Nate Begeman | 178bb34 | 2005-04-04 23:01:51 +0000 | [diff] [blame] | 432 | def FMADDS : AForm_1<59, 29, 0, 0, 0, |
| 433 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 434 | "fmadds $FRT, $FRA, $FRC, $FRB">; |
| 435 | def FMSUB : AForm_1<63, 28, 0, 0, 0, |
| 436 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 437 | "fmsub $FRT, $FRA, $FRC, $FRB">; |
| 438 | def FMSUBS : AForm_1<59, 28, 0, 0, 0, |
| 439 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 440 | "fmsubs $FRT, $FRA, $FRC, $FRB">; |
| 441 | def FNMADD : AForm_1<63, 31, 0, 0, 0, |
| 442 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 443 | "fnmadd $FRT, $FRA, $FRC, $FRB">; |
| 444 | def FNMADDS : AForm_1<59, 31, 0, 0, 0, |
| 445 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 446 | "fnmadds $FRT, $FRA, $FRC, $FRB">; |
| 447 | def FNMSUB : AForm_1<63, 30, 0, 0, 0, |
| 448 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 449 | "fnmsub $FRT, $FRA, $FRC, $FRB">; |
| 450 | def FNMSUBS : AForm_1<59, 30, 0, 0, 0, |
| 451 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 452 | "fnmsubs $FRT, $FRA, $FRC, $FRB">; |
Nate Begeman | 07aada8 | 2004-08-30 02:28:06 +0000 | [diff] [blame] | 453 | def FSEL : AForm_1<63, 23, 0, 0, 0, |
| 454 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRC, FPRC:$FRB), |
| 455 | "fsel $FRT, $FRA, $FRC, $FRB">; |
| 456 | def FADD : AForm_2<63, 21, 0, 0, 0, |
| 457 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), |
| 458 | "fadd $FRT, $FRA, $FRB">; |
| 459 | def FADDS : AForm_2<59, 21, 0, 0, 0, |
| 460 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), |
| 461 | "fadds $FRT, $FRA, $FRB">; |
| 462 | def FDIV : AForm_2<63, 18, 0, 0, 0, |
| 463 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), |
| 464 | "fdiv $FRT, $FRA, $FRB">; |
| 465 | def FDIVS : AForm_2<59, 18, 0, 0, 0, |
| 466 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), |
| 467 | "fdivs $FRT, $FRA, $FRB">; |
| 468 | def FMUL : AForm_3<63, 25, 0, 0, 0, |
| 469 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), |
| 470 | "fmul $FRT, $FRA, $FRB">; |
| 471 | def FMULS : AForm_3<59, 25, 0, 0, 0, |
| 472 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), |
| 473 | "fmuls $FRT, $FRA, $FRB">; |
| 474 | def FSUB : AForm_2<63, 20, 0, 0, 0, |
| 475 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), |
| 476 | "fsub $FRT, $FRA, $FRB">; |
| 477 | def FSUBS : AForm_2<59, 20, 0, 0, 0, |
| 478 | (ops FPRC:$FRT, FPRC:$FRA, FPRC:$FRB), |
| 479 | "fsubs $FRT, $FRA, $FRB">; |
| 480 | |
Nate Begeman | cc8bd9c | 2004-08-31 02:28:08 +0000 | [diff] [blame] | 481 | // M-Form instructions. rotate and mask instructions. |
| 482 | // |
Nate Begeman | 2d4c98d | 2004-10-16 20:43:38 +0000 | [diff] [blame] | 483 | let isTwoAddress = 1 in { |
Nate Begeman | cc8bd9c | 2004-08-31 02:28:08 +0000 | [diff] [blame] | 484 | def RLWIMI : MForm_2<20, 0, 0, 0, |
Nate Begeman | 2d4c98d | 2004-10-16 20:43:38 +0000 | [diff] [blame] | 485 | (ops GPRC:$rA, GPRC:$rSi, GPRC:$rS, u5imm:$SH, u5imm:$MB, |
| 486 | u5imm:$ME), "rlwimi $rA, $rS, $SH, $MB, $ME">; |
| 487 | } |
Nate Begeman | cc8bd9c | 2004-08-31 02:28:08 +0000 | [diff] [blame] | 488 | def RLWINM : MForm_2<21, 0, 0, 0, |
| 489 | (ops GPRC:$rA, GPRC:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME), |
| 490 | "rlwinm $rA, $rS, $SH, $MB, $ME">; |
Nate Begeman | 9f833d3 | 2005-04-12 00:10:02 +0000 | [diff] [blame] | 491 | let Defs = [CR0] in |
| 492 | def RLWINMo : MForm_2<21, 1, 0, 0, |
| 493 | (ops GPRC:$rA, GPRC:$rS, u5imm:$SH, u5imm:$MB, u5imm:$ME), |
| 494 | "rlwinm. $rA, $rS, $SH, $MB, $ME">; |
Nate Begeman | cd08e4c | 2005-04-09 20:09:12 +0000 | [diff] [blame] | 495 | def RLWNM : MForm_2<23, 0, 0, 0, |
| 496 | (ops GPRC:$rA, GPRC:$rS, GPRC:$rB, u5imm:$MB, u5imm:$ME), |
| 497 | "rlwnm $rA, $rS, $rB, $MB, $ME">; |
Nate Begeman | cc8bd9c | 2004-08-31 02:28:08 +0000 | [diff] [blame] | 498 | |
| 499 | // MD-Form instructions. 64 bit rotate instructions. |
| 500 | // |
| 501 | def RLDICL : MDForm_1<30, 0, 0, 1, 0, |
| 502 | (ops GPRC:$rA, GPRC:$rS, u6imm:$SH, u6imm:$MB), |
| 503 | "rldicl $rA, $rS, $SH, $MB">; |
| 504 | def RLDICR : MDForm_1<30, 1, 0, 1, 0, |
| 505 | (ops GPRC:$rA, GPRC:$rS, u6imm:$SH, u6imm:$ME), |
| 506 | "rldicr $rA, $rS, $SH, $ME">; |
| 507 | |
Chris Lattner | be686a8 | 2004-12-16 16:31:57 +0000 | [diff] [blame] | 508 | def PowerPCInstrInfo : InstrInfo { |
| 509 | let PHIInst = PHI; |
| 510 | |
| 511 | let TSFlagsFields = [ "VMX", "PPC64" ]; |
| 512 | let TSFlagsShifts = [ 0, 1 ]; |
| 513 | |
| 514 | let isLittleEndianEncoding = 1; |
| 515 | } |
Nate Begeman | cc8bd9c | 2004-08-31 02:28:08 +0000 | [diff] [blame] | 516 | |