1*3d8817e4Smiod /* Assembler instructions for Motorola's Mcore processor 2*3d8817e4Smiod Copyright 1999, 2000, 2002 Free Software Foundation, Inc. 3*3d8817e4Smiod 4*3d8817e4Smiod 5*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 6*3d8817e4Smiod it under the terms of the GNU General Public License as published by 7*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 8*3d8817e4Smiod (at your option) any later version. 9*3d8817e4Smiod 10*3d8817e4Smiod This program is distributed in the hope that it will be useful, 11*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 12*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*3d8817e4Smiod GNU General Public License for more details. 14*3d8817e4Smiod 15*3d8817e4Smiod You should have received a copy of the GNU General Public License 16*3d8817e4Smiod along with this program; if not, write to the Free Software 17*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 18*3d8817e4Smiod 19*3d8817e4Smiod #include "ansidecl.h" 20*3d8817e4Smiod 21*3d8817e4Smiod typedef enum 22*3d8817e4Smiod { 23*3d8817e4Smiod O0, OT, O1, OC, O2, X1, OI, OB, 24*3d8817e4Smiod OMa, SI, I7, LS, BR, BL, LR, LJ, 25*3d8817e4Smiod RM, RQ, JSR, JMP, OBRa, OBRb, OBRc, OBR2, 26*3d8817e4Smiod O1R1, OMb, OMc, SIa, 27*3d8817e4Smiod MULSH, OPSR, 28*3d8817e4Smiod JC, JU, JL, RSI, DO21, OB2 29*3d8817e4Smiod } 30*3d8817e4Smiod mcore_opclass; 31*3d8817e4Smiod 32*3d8817e4Smiod typedef struct inst 33*3d8817e4Smiod { 34*3d8817e4Smiod char * name; 35*3d8817e4Smiod mcore_opclass opclass; 36*3d8817e4Smiod unsigned char transfer; 37*3d8817e4Smiod unsigned short inst; 38*3d8817e4Smiod } 39*3d8817e4Smiod mcore_opcode_info; 40*3d8817e4Smiod 41*3d8817e4Smiod #ifdef DEFINE_TABLE 42*3d8817e4Smiod const mcore_opcode_info mcore_table[] = 43*3d8817e4Smiod { 44*3d8817e4Smiod { "bkpt", O0, 0, 0x0000 }, 45*3d8817e4Smiod { "sync", O0, 0, 0x0001 }, 46*3d8817e4Smiod { "rte", O0, 1, 0x0002 }, 47*3d8817e4Smiod { "rfe", O0, 1, 0x0002 }, 48*3d8817e4Smiod { "rfi", O0, 1, 0x0003 }, 49*3d8817e4Smiod { "stop", O0, 0, 0x0004 }, 50*3d8817e4Smiod { "wait", O0, 0, 0x0005 }, 51*3d8817e4Smiod { "doze", O0, 0, 0x0006 }, 52*3d8817e4Smiod { "idly4", O0, 0, 0x0007 }, 53*3d8817e4Smiod { "trap", OT, 0, 0x0008 }, 54*3d8817e4Smiod /* SPACE: 0x000C - 0x000F */ 55*3d8817e4Smiod /* SPACE: 0x0010 - 0x001F */ 56*3d8817e4Smiod { "mvc", O1, 0, 0x0020 }, 57*3d8817e4Smiod { "mvcv", O1, 0, 0x0030 }, 58*3d8817e4Smiod { "ldq", RQ, 0, 0x0040 }, 59*3d8817e4Smiod { "stq", RQ, 0, 0x0050 }, 60*3d8817e4Smiod { "ldm", RM, 0, 0x0060 }, 61*3d8817e4Smiod { "stm", RM, 0, 0x0070 }, 62*3d8817e4Smiod { "dect", O1, 0, 0x0080 }, 63*3d8817e4Smiod { "decf", O1, 0, 0x0090 }, 64*3d8817e4Smiod { "inct", O1, 0, 0x00A0 }, 65*3d8817e4Smiod { "incf", O1, 0, 0x00B0 }, 66*3d8817e4Smiod { "jmp", JMP, 2, 0x00C0 }, 67*3d8817e4Smiod #define MCORE_INST_JMP 0x00C0 68*3d8817e4Smiod { "jsr", JSR, 0, 0x00D0 }, 69*3d8817e4Smiod #define MCORE_INST_JSR 0x00E0 70*3d8817e4Smiod { "ff1", O1, 0, 0x00E0 }, 71*3d8817e4Smiod { "brev", O1, 0, 0x00F0 }, 72*3d8817e4Smiod { "xtrb3", X1, 0, 0x0100 }, 73*3d8817e4Smiod { "xtrb2", X1, 0, 0x0110 }, 74*3d8817e4Smiod { "xtrb1", X1, 0, 0x0120 }, 75*3d8817e4Smiod { "xtrb0", X1, 0, 0x0130 }, 76*3d8817e4Smiod { "zextb", O1, 0, 0x0140 }, 77*3d8817e4Smiod { "sextb", O1, 0, 0x0150 }, 78*3d8817e4Smiod { "zexth", O1, 0, 0x0160 }, 79*3d8817e4Smiod { "sexth", O1, 0, 0x0170 }, 80*3d8817e4Smiod { "declt", O1, 0, 0x0180 }, 81*3d8817e4Smiod { "tstnbz", O1, 0, 0x0190 }, 82*3d8817e4Smiod { "decgt", O1, 0, 0x01A0 }, 83*3d8817e4Smiod { "decne", O1, 0, 0x01B0 }, 84*3d8817e4Smiod { "clrt", O1, 0, 0x01C0 }, 85*3d8817e4Smiod { "clrf", O1, 0, 0x01D0 }, 86*3d8817e4Smiod { "abs", O1, 0, 0x01E0 }, 87*3d8817e4Smiod { "not", O1, 0, 0x01F0 }, 88*3d8817e4Smiod { "movt", O2, 0, 0x0200 }, 89*3d8817e4Smiod { "mult", O2, 0, 0x0300 }, 90*3d8817e4Smiod { "loopt", BL, 0, 0x0400 }, 91*3d8817e4Smiod { "subu", O2, 0, 0x0500 }, 92*3d8817e4Smiod { "sub", O2, 0, 0x0500 }, /* Official alias. */ 93*3d8817e4Smiod { "addc", O2, 0, 0x0600 }, 94*3d8817e4Smiod { "subc", O2, 0, 0x0700 }, 95*3d8817e4Smiod /* SPACE: 0x0800-0x08ff for a diadic operation */ 96*3d8817e4Smiod /* SPACE: 0x0900-0x09ff for a diadic operation */ 97*3d8817e4Smiod { "movf", O2, 0, 0x0A00 }, 98*3d8817e4Smiod { "lsr", O2, 0, 0x0B00 }, 99*3d8817e4Smiod { "cmphs", O2, 0, 0x0C00 }, 100*3d8817e4Smiod { "cmplt", O2, 0, 0x0D00 }, 101*3d8817e4Smiod { "tst", O2, 0, 0x0E00 }, 102*3d8817e4Smiod { "cmpne", O2, 0, 0x0F00 }, 103*3d8817e4Smiod { "mfcr", OC, 0, 0x1000 }, 104*3d8817e4Smiod { "psrclr", OPSR, 0, 0x11F0 }, 105*3d8817e4Smiod { "psrset", OPSR, 0, 0x11F8 }, 106*3d8817e4Smiod { "mov", O2, 0, 0x1200 }, 107*3d8817e4Smiod { "bgenr", O2, 0, 0x1300 }, 108*3d8817e4Smiod { "rsub", O2, 0, 0x1400 }, 109*3d8817e4Smiod { "ixw", O2, 0, 0x1500 }, 110*3d8817e4Smiod { "and", O2, 0, 0x1600 }, 111*3d8817e4Smiod { "xor", O2, 0, 0x1700 }, 112*3d8817e4Smiod { "mtcr", OC, 0, 0x1800 }, 113*3d8817e4Smiod { "asr", O2, 0, 0x1A00 }, 114*3d8817e4Smiod { "lsl", O2, 0, 0x1B00 }, 115*3d8817e4Smiod { "addu", O2, 0, 0x1C00 }, 116*3d8817e4Smiod { "add", O2, 0, 0x1C00 }, /* Official alias. */ 117*3d8817e4Smiod { "ixh", O2, 0, 0x1D00 }, 118*3d8817e4Smiod { "or", O2, 0, 0x1E00 }, 119*3d8817e4Smiod { "andn", O2, 0, 0x1F00 }, 120*3d8817e4Smiod { "addi", OI, 0, 0x2000 }, 121*3d8817e4Smiod #define MCORE_INST_ADDI 0x2000 122*3d8817e4Smiod { "cmplti", OI, 0, 0x2200 }, 123*3d8817e4Smiod { "subi", OI, 0, 0x2400 }, 124*3d8817e4Smiod /* SPACE: 0x2600-0x27ff open for a register+immediate operation */ 125*3d8817e4Smiod { "rsubi", OB, 0, 0x2800 }, 126*3d8817e4Smiod { "cmpnei", OB, 0, 0x2A00 }, 127*3d8817e4Smiod { "bmaski", OMa, 0, 0x2C00 }, 128*3d8817e4Smiod { "divu", O1R1, 0, 0x2C10 }, 129*3d8817e4Smiod /* SPACE: 0x2c20 - 0x2c7f */ 130*3d8817e4Smiod { "bmaski", OMb, 0, 0x2C80 }, 131*3d8817e4Smiod { "bmaski", OMc, 0, 0x2D00 }, 132*3d8817e4Smiod { "andi", OB, 0, 0x2E00 }, 133*3d8817e4Smiod { "bclri", OB, 0, 0x3000 }, 134*3d8817e4Smiod /* SPACE: 0x3200 - 0x320f */ 135*3d8817e4Smiod { "divs", O1R1, 0, 0x3210 }, 136*3d8817e4Smiod /* SPACE: 0x3220 - 0x326f */ 137*3d8817e4Smiod { "bgeni", OBRa, 0, 0x3270 }, 138*3d8817e4Smiod { "bgeni", OBRb, 0, 0x3280 }, 139*3d8817e4Smiod { "bgeni", OBRc, 0, 0x3300 }, 140*3d8817e4Smiod { "bseti", OB, 0, 0x3400 }, 141*3d8817e4Smiod { "btsti", OB, 0, 0x3600 }, 142*3d8817e4Smiod { "xsr", O1, 0, 0x3800 }, 143*3d8817e4Smiod { "rotli", SIa, 0, 0x3800 }, 144*3d8817e4Smiod { "asrc", O1, 0, 0x3A00 }, 145*3d8817e4Smiod { "asri", SIa, 0, 0x3A00 }, 146*3d8817e4Smiod { "lslc", O1, 0, 0x3C00 }, 147*3d8817e4Smiod { "lsli", SIa, 0, 0x3C00 }, 148*3d8817e4Smiod { "lsrc", O1, 0, 0x3E00 }, 149*3d8817e4Smiod { "lsri", SIa, 0, 0x3E00 }, 150*3d8817e4Smiod /* SPACE: 0x4000 - 0x5fff */ 151*3d8817e4Smiod { "movi", I7, 0, 0x6000 }, 152*3d8817e4Smiod #define MCORE_INST_BMASKI_ALT 0x6000 153*3d8817e4Smiod #define MCORE_INST_BGENI_ALT 0x6000 154*3d8817e4Smiod { "mulsh", MULSH, 0, 0x6800 }, 155*3d8817e4Smiod { "muls.h", MULSH, 0, 0x6800 }, 156*3d8817e4Smiod /* SPACE: 0x6900 - 0x6FFF */ 157*3d8817e4Smiod { "jmpi", LJ, 1, 0x7000 }, 158*3d8817e4Smiod { "jsri", LJ, 0, 0x7F00 }, 159*3d8817e4Smiod #define MCORE_INST_JMPI 0x7000 160*3d8817e4Smiod { "lrw", LR, 0, 0x7000 }, 161*3d8817e4Smiod #define MCORE_INST_JSRI 0x7F00 162*3d8817e4Smiod { "ld", LS, 0, 0x8000 }, 163*3d8817e4Smiod { "ldw", LS, 0, 0x8000 }, 164*3d8817e4Smiod { "ld.w", LS, 0, 0x8000 }, 165*3d8817e4Smiod { "st", LS, 0, 0x9000 }, 166*3d8817e4Smiod { "stw", LS, 0, 0x9000 }, 167*3d8817e4Smiod { "st.w", LS, 0, 0x9000 }, 168*3d8817e4Smiod { "ldb", LS, 0, 0xA000 }, 169*3d8817e4Smiod { "ld.b", LS, 0, 0xA000 }, 170*3d8817e4Smiod { "stb", LS, 0, 0xB000 }, 171*3d8817e4Smiod { "st.b", LS, 0, 0xB000 }, 172*3d8817e4Smiod { "ldh", LS, 0, 0xC000 }, 173*3d8817e4Smiod { "ld.h", LS, 0, 0xC000 }, 174*3d8817e4Smiod { "sth", LS, 0, 0xD000 }, 175*3d8817e4Smiod { "st.h", LS, 0, 0xD000 }, 176*3d8817e4Smiod { "bt", BR, 0, 0xE000 }, 177*3d8817e4Smiod { "bf", BR, 0, 0xE800 }, 178*3d8817e4Smiod { "br", BR, 1, 0xF000 }, 179*3d8817e4Smiod #define MCORE_INST_BR 0xF000 180*3d8817e4Smiod { "bsr", BR, 0, 0xF800 }, 181*3d8817e4Smiod #define MCORE_INST_BSR 0xF800 182*3d8817e4Smiod 183*3d8817e4Smiod /* The following are relaxable branches */ 184*3d8817e4Smiod { "jbt", JC, 0, 0xE000 }, 185*3d8817e4Smiod { "jbf", JC, 0, 0xE800 }, 186*3d8817e4Smiod { "jbr", JU, 1, 0xF000 }, 187*3d8817e4Smiod { "jbsr", JL, 0, 0xF800 }, 188*3d8817e4Smiod 189*3d8817e4Smiod /* The following are aliases for other instructions */ 190*3d8817e4Smiod { "rts", O0, 2, 0x00CF }, /* jmp r15 */ 191*3d8817e4Smiod { "rolc", DO21, 0, 0x0600 }, /* addc rd,rd */ 192*3d8817e4Smiod { "rotlc", DO21, 0, 0x0600 }, /* addc rd,rd */ 193*3d8817e4Smiod { "setc", O0, 0, 0x0C00 }, /* cmphs r0,r0 */ 194*3d8817e4Smiod { "clrc", O0, 0, 0x0F00 }, /* cmpne r0,r0 */ 195*3d8817e4Smiod { "tstle", O1, 0, 0x2200 }, /* cmplti rd,1 */ 196*3d8817e4Smiod { "cmplei", OB, 0, 0x2200 }, /* cmplei rd,X -> cmplti rd,X+1 */ 197*3d8817e4Smiod { "neg", O1, 0, 0x2800 }, /* rsubi rd,0 */ 198*3d8817e4Smiod { "tstne", O1, 0, 0x2A00 }, /* cmpnei rd,0 */ 199*3d8817e4Smiod { "tstlt", O1, 0, 0x37F0 }, /* btsti rx,31 */ 200*3d8817e4Smiod { "mclri", OB2, 0, 0x3000 }, /* bclri rx,log2(imm) */ 201*3d8817e4Smiod { "mgeni", OBR2, 0, 0x3200 }, /* bgeni rx,log2(imm) */ 202*3d8817e4Smiod { "mseti", OB2, 0, 0x3400 }, /* bseti rx,log2(imm) */ 203*3d8817e4Smiod { "mtsti", OB2, 0, 0x3600 }, /* btsti rx,log2(imm) */ 204*3d8817e4Smiod { "rori", RSI, 0, 0x3800 }, 205*3d8817e4Smiod { "rotri", RSI, 0, 0x3800 }, 206*3d8817e4Smiod { "nop", O0, 0, 0x1200 }, /* mov r0, r0 */ 207*3d8817e4Smiod { 0, 0, 0, 0 } 208*3d8817e4Smiod }; 209*3d8817e4Smiod #endif 210