File:  [gforth] / gforth / arch / mips / testdisasm.fs
Revision 1.8: download - view: text, annotated - select for diffs
Sat Aug 7 17:35:02 2010 UTC (11 years, 5 months ago) by dvdkhlng
Branches: MAIN
CVS tags: HEAD
Added MIPS assembler/disassembler support for the more common MIPS32
instructions (mul, madd&friends, clo, clz movn, movz).  Updated test-cases
accordingly.

Fixed MIPS assembler to even work on 64-bit platforms.  Now test-cases runs
and passes on AMD64, too.

    1: \ Copyright (C) 2000,2003,2007 Free Software Foundation, Inc.
    2: 
    3: \ This file is part of Gforth.
    4: 
    5: \ Gforth is free software; you can redistribute it and/or
    6: \ modify it under the terms of the GNU General Public License
    7: \ as published by the Free Software Foundation, either version 3
    8: \ of the License, or (at your option) any later version.
    9: 
   10: \ This program is distributed in the hope that it will be useful,
   11: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
   12: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13: \ GNU General Public License for more details.
   14: 
   15: \ You should have received a copy of the GNU General Public License
   16: \ along with this program. If not, see http://www.gnu.org/licenses/.
   17: 
   18: $3FFF820 l,  \ 31 31 31 add,  
   19: $10020 l,    \ 0 0 1 add,     
   20: $200020 l,   \ 0 1 0 add,     
   21: $820 l,	    \ 1 0 0 add,     
   22: $210820 l,   \ 1 1 1 add,     
   23: $23FFFFFF l, \ 31 31 -1 addi, 
   24: $20000001 l, \ 0 0 1 addi,    
   25: $20200000 l, \ 0 1 0 addi,    
   26: $20010000 l, \ 1 0 0 addi,    
   27: $20210001 l, \ 1 1 1 addi,    
   28: $27FFFFFF l, \ 31 31 -1 addil,
   29: $24000001 l, \ 0 0 1 addil,   
   30: $24200000 l, \ 0 1 0 addil,   
   31: $24010000 l, \ 1 0 0 addil,   
   32: $24210001 l, \ 1 1 1 addil,   
   33: $3FFF821 l,  \ 31 31 31 addl, 
   34: $10021 l,    \ 0 0 1 addl,    
   35: $200021 l,   \ 0 1 0 addl,    
   36: $821 l,	    \ 1 0 0 addl,    
   37: $210821 l,   \ 1 1 1 addl,    
   38: $3FFF824 l,  \ 31 31 31 and,  
   39: $10024 l,    \ 0 0 1 and,     
   40: $200024 l,   \ 0 1 0 and,     
   41: $824 l,	    \ 1 0 0 and,     
   42: $210824 l,   \ 1 1 1 and,     
   43: $33FFFFFF l, \ 31 31 $FFFF and
   44: $30000001 l, \ 0 0 $1 andi,   
   45: $30200000 l, \ 0 1 $0 andi,   
   46: $30010000 l, \ 1 0 $0 andi,   
   47: $30210001 l, \ 1 1 $1 andi,   
   48: $4500FFFF l, \ -1 bczf,       
   49: $45000001 l, \ 1 bczf,        
   50: $4501FFFF l, \ -1 bczt,       
   51: $45010001 l, \ 1 bczt,        
   52: $13FFFFFF l, \ 31 31 -1 beq,  
   53: $10000001 l, \ 0 0 1 beq,     
   54: $10010000 l, \ 0 1 0 beq,     
   55: $10200000 l, \ 1 0 0 beq,     
   56: $10210001 l, \ 1 1 1 beq,     
   57: $7E1FFFF l,  \ 31 -1 bgez,    
   58: $4010001 l,  \ 0 1 bgez,      
   59: $4210000 l,  \ 1 0 bgez,      
   60: $4210001 l,  \ 1 1 bgez,      
   61: $7F1FFFF l,  \ 31 -1 bgezal,  
   62: $4110001 l,  \ 0 1 bgezal,    
   63: $4310000 l,  \ 1 0 bgezal,    
   64: $4310001 l,  \ 1 1 bgezal,    
   65: $1FE0FFFF l, \ 31 -1 bgtz,    
   66: $1C000001 l, \ 0 1 bgtz,      
   67: $1C200000 l, \ 1 0 bgtz,      
   68: $1C200001 l, \ 1 1 bgtz,      
   69: $1BE0FFFF l, \ 31 -1 blez,    
   70: $18000001 l, \ 0 1 blez,      
   71: $18200000 l, \ 1 0 blez,      
   72: $18200001 l, \ 1 1 blez,      
   73: $7E0FFFF l,  \ 31 -1 bltz,    
   74: $4000001 l,  \ 0 1 bltz,      
   75: $4200000 l,  \ 1 0 bltz,      
   76: $4200001 l,  \ 1 1 bltz,      
   77: $7F0FFFF l,  \ 31 -1 bltzal,  
   78: $4100001 l,  \ 0 1 bltzal,    
   79: $4300000 l,  \ 1 0 bltzal,    
   80: $4300001 l,  \ 1 1 bltzal,    
   81: $17FFFFFF l, \ 31 31 -1 bne,  
   82: $14000001 l, \ 0 0 1 bne,     
   83: $14010000 l, \ 0 1 0 bne,     
   84: $14200000 l, \ 1 0 0 bne,     
   85: $14210001 l, \ 1 1 1 bne,     
   86: $D l,	    \ break,         
   87: $445FF800 l, \ 31 31 1 cfcz,  
   88: $44400800 l, \ 0 1 1 cfcz,    
   89: $44410000 l, \ 1 0 1 cfcz,    
   90: $44410800 l, \ 1 1 1 cfcz,    
   91: $44DFF800 l, \ 31 31 1 ctcz,  
   92: $44C00800 l, \ 0 1 1 ctcz,    
   93: $44C10000 l, \ 1 0 1 ctcz,    
   94: $44C10800 l, \ 1 1 1 ctcz,    
   95: $3FF001A l,  \ 31 31 div,     
   96: $1001A l,    \ 0 1 div,       
   97: $20001A l,   \ 1 0 div,       
   98: $21001A l,   \ 1 1 div,       
   99: $3FF001B l,  \ 31 31 divl,    
  100: $1001B l,    \ 0 1 divl,      
  101: $20001B l,   \ 1 0 divl,      
  102: $21001B l,   \ 1 1 divl,      
  103: $BFFFFFF l,  \ $43FFFFFF j,   
  104: $8000001 l,  \ $40000001 j,   
  105: $FFFFFFF l,  \ $43FFFFFF jal, 
  106: $C000001 l,  \ $40000001 jal, 
  107: $3E0F809 l,  \ 31 31 jalr,    
  108: $200009 l,   \ 0 1 jalr,      
  109: $809 l,	    \ 1 0 jalr,      
  110: $200809 l,   \ 1 1 jalr,      
  111: $3E00008 l,  \ 31 jr,         
  112: $200008 l,   \ 1 jr,          
  113: $83FFFFFF l, \ 31 -1 31 lb,   
  114: $80200000 l, \ 0 0 1 lb,      
  115: $80000001 l, \ 0 1 0 lb,      
  116: $80010000 l, \ 1 0 0 lb,      
  117: $80210001 l, \ 1 1 1 lb,      
  118: $93FFFFFF l, \ 31 -1 31 lbl,  
  119: $90200000 l, \ 0 0 1 lbl,     
  120: $90000001 l, \ 0 1 0 lbl,     
  121: $90010000 l, \ 1 0 0 lbl,     
  122: $90210001 l, \ 1 1 1 lbl,     
  123: $87FFFFFF l, \ 31 -1 31 lh,   
  124: $84200000 l, \ 0 0 1 lh,      
  125: $84000001 l, \ 0 1 0 lh,      
  126: $84010000 l, \ 1 0 0 lh,      
  127: $84210001 l, \ 1 1 1 lh,      
  128: $97FFFFFF l, \ 31 -1 31 lhl,  
  129: $94200000 l, \ 0 0 1 lhl,     
  130: $94000001 l, \ 0 1 0 lhl,     
  131: $94010000 l, \ 1 0 0 lhl,     
  132: $94210001 l, \ 1 1 1 lhl,     
  133: $3C1FFFFF l, \ 31 $FFFF lui,  
  134: $3C000001 l, \ 0 $1 lui,      
  135: $3C010000 l, \ 1 $0 lui,      
  136: $3C010001 l, \ 1 $1 lui,      
  137: $8FFFFFFF l, \ 31 -1 31 lw,   
  138: $8C200000 l, \ 0 0 1 lw,      
  139: $8C000001 l, \ 0 1 0 lw,      
  140: $8C010000 l, \ 1 0 0 lw,      
  141: $8C210001 l, \ 1 1 1 lw,      
  142: $C7FFFFFF l, \ 31 -1 31 lwc1, 
  143: $C4200000 l, \ 0 0 1 lwc1,    
  144: $C4000001 l, \ 0 1 0 lwc1,    
  145: $C4010000 l, \ 1 0 0 lwc1,    
  146: $C4210001 l, \ 1 1 1 lwc1,    
  147: $8BFFFFFF l, \ 31 -1 31 lwl,  
  148: $88200000 l, \ 0 0 1 lwl,     
  149: $88000001 l, \ 0 1 0 lwl,     
  150: $88010000 l, \ 1 0 0 lwl,     
  151: $88210001 l, \ 1 1 1 lwl,     
  152: $9BFFFFFF l, \ 31 -1 31 lwr,  
  153: $98200000 l, \ 0 0 1 lwr,     
  154: $98000001 l, \ 0 1 0 lwr,     
  155: $98010000 l, \ 1 0 0 lwr,     
  156: $98210001 l, \ 1 1 1 lwr,     
  157: $441FF800 l, \ 31 31 1 mfcz,  
  158: $44000800 l, \ 0 1 1 mfcz,    
  159: $44010000 l, \ 1 0 1 mfcz,    
  160: $44010800 l, \ 1 1 1 mfcz,    
  161: $F810 l,	    \ 31 mfhi,       
  162: $810 l,	    \ 1 mfhi,        
  163: $F812 l,	    \ 31 mflo,       
  164: $812 l,	    \ 1 mflo,        
  165: $449FF800 l, \ 31 31 1 mtcz,  
  166: $44800800 l, \ 0 1 1 mtcz,    
  167: $44810000 l, \ 1 0 1 mtcz,    
  168: $44810800 l, \ 1 1 1 mtcz,    
  169: $3E00011 l,  \ 31 mthi,       
  170: $200011 l,   \ 1 mthi,        
  171: $3E00013 l,  \ 31 mtlo,       
  172: $200013 l,   \ 1 mtlo,        
  173: $3FF0018 l,  \ 31 31 mult,    
  174: $10018 l,    \ 0 1 mult,      
  175: $200018 l,   \ 1 0 mult,      
  176: $210018 l,   \ 1 1 mult,      
  177: $3FF0019 l,  \ 31 31 multl,   
  178: $10019 l,    \ 0 1 multl,     
  179: $200019 l,   \ 1 0 multl,     
  180: $210019 l,   \ 1 1 multl,     
  181: $3FFF827 l,  \ 31 31 31 nor,  
  182: $10027 l,    \ 0 0 1 nor,     
  183: $200027 l,   \ 0 1 0 nor,     
  184: $827 l,	    \ 1 0 0 nor,     
  185: $210827 l,   \ 1 1 1 nor,     
  186: $3FFF825 l,  \ 31 31 31 or,   
  187: $10025 l,    \ 0 0 1 or,      
  188: $200025 l,   \ 0 1 0 or,      
  189: $825 l,	    \ 1 0 0 or,      
  190: $210825 l,   \ 1 1 1 or,      
  191: $37FFFFFF l, \ 31 31 $FFFF ori
  192: $34000001 l, \ 0 0 $1 ori,    
  193: $34200000 l, \ 0 1 $0 ori,    
  194: $34010000 l, \ 1 0 $0 ori,    
  195: $34210001 l, \ 1 1 $1 ori,    
  196: $A3FFFFFF l, \ 31 -1 31 sb,   
  197: $A0200000 l, \ 0 0 1 sb,      
  198: $A0000001 l, \ 0 1 0 sb,      
  199: $A0010000 l, \ 1 0 0 sb,      
  200: $A0210001 l, \ 1 1 1 sb,      
  201: $A7FFFFFF l, \ 31 -1 31 sh,   
  202: $A4200000 l, \ 0 0 1 sh,      
  203: $A4000001 l, \ 0 1 0 sh,      
  204: $A4010000 l, \ 1 0 0 sh,      
  205: $A4210001 l, \ 1 1 1 sh,      
  206: $3FFF82A l,  \ 31 31 31 slt,  
  207: $1002A l,    \ 0 0 1 slt,     
  208: $20002A l,   \ 0 1 0 slt,     
  209: $82A l,	    \ 1 0 0 slt,     
  210: $21082A l,   \ 1 1 1 slt,     
  211: $2BFFFFFF l, \ 31 31 -1 slti, 
  212: $28000001 l, \ 0 0 1 slti,    
  213: $28200000 l, \ 0 1 0 slti,    
  214: $28010000 l, \ 1 0 0 slti,    
  215: $28210001 l, \ 1 1 1 slti,    
  216: $2FFFFFFF l, \ 31 31 -1 sltil,
  217: $2C000001 l, \ 0 0 1 sltil,   
  218: $2C200000 l, \ 0 1 0 sltil,   
  219: $2C010000 l, \ 1 0 0 sltil,   
  220: $2C210001 l, \ 1 1 1 sltil,   
  221: $3FFF82B l,  \ 31 31 31 sltl, 
  222: $1002B l,    \ 0 0 1 sltl,    
  223: $20002B l,   \ 0 1 0 sltl,    
  224: $82B l,	    \ 1 0 0 sltl,    
  225: $21082B l,   \ 1 1 1 sltl,    
  226: $3FFF822 l,  \ 31 31 31 sub,  
  227: $10022 l,    \ 0 0 1 sub,     
  228: $200022 l,   \ 0 1 0 sub,     
  229: $822 l,	    \ 1 0 0 sub,     
  230: $210822 l,   \ 1 1 1 sub,     
  231: $3FFF823 l,  \ 31 31 31 subl, 
  232: $10023 l,    \ 0 0 1 subl,    
  233: $200023 l,   \ 0 1 0 subl,    
  234: $823 l,	    \ 1 0 0 subl,    
  235: $210823 l,   \ 1 1 1 subl,    
  236: $AFFFFFFF l, \ 31 -1 31 sw,   
  237: $AC200000 l, \ 0 0 1 sw,      
  238: $AC000001 l, \ 0 1 0 sw,      
  239: $AC010000 l, \ 1 0 0 sw,      
  240: $AC210001 l, \ 1 1 1 sw,      
  241: $E7FFFFFF l, \ 31 -1 31 swc1, 
  242: $E4200000 l, \ 0 0 1 swc1,    
  243: $E4000001 l, \ 0 1 0 swc1,    
  244: $E4010000 l, \ 1 0 0 swc1,    
  245: $E4210001 l, \ 1 1 1 swc1,    
  246: $ABFFFFFF l, \ 31 -1 31 swl,  
  247: $A8200000 l, \ 0 0 1 swl,     
  248: $A8000001 l, \ 0 1 0 swl,     
  249: $A8010000 l, \ 1 0 0 swl,     
  250: $A8210001 l, \ 1 1 1 swl,     
  251: $BBFFFFFF l, \ 31 -1 31 swr,  
  252: $B8200000 l, \ 0 0 1 swr,     
  253: $B8000001 l, \ 0 1 0 swr,     
  254: $B8010000 l, \ 1 0 0 swr,     
  255: $B8210001 l, \ 1 1 1 swr,     
  256: $C l,	    \ syscall,       
  257: $42000008 l, \ tlbl,          
  258: $42000001 l, \ tlbr,          
  259: $42000002 l, \ tlbwi,         
  260: $42000006 l, \ tlbwr,         
  261: $3FFF826 l,  \ 31 31 31 xor,  
  262: $10026 l,    \ 0 0 1 xor,     
  263: $200026 l,   \ 0 1 0 xor,     
  264: $826 l,	    \ 1 0 0 xor,     
  265: $210826 l,   \ 1 1 1 xor,     
  266: $3BFFFFFF l, \ 31 31 $FFFF xor
  267: $38000001 l, \ 0 0 $1 xori,   
  268: $38200000 l, \ 0 1 $0 xori,   
  269: $38010000 l, \ 1 0 $0 xori,   
  270: $38210001 l, \ 1 1 $1 xori,   
  271: $3E0F821 l,  \ 31 31 0 addl,  
  272: $200021 l,   \ 0 1 0 addl,    
  273: $821 l,	    \ 1 0 0 addl,    
  274: $200821 l,   \ 1 1 0 addl,    
  275: $7E10002 l,  \ 31 2 bgez,     
  276: $3E0F821 l,  \ 31 31 0 addl,  
  277: $1FF822 l,   \ 31 0 31 sub,   
  278: $4210002 l,  \ 1 2 bgez,      
  279: $200021 l,   \ 0 1 0 addl,    
  280: $10022 l,    \ 0 0 1 sub,     
  281: $4010002 l,  \ 0 2 bgez,      
  282: $821 l,	    \ 1 0 0 addl,    
  283: $822 l,	    \ 1 0 0 sub,     
  284: $4210002 l,  \ 1 2 bgez,      
  285: $200821 l,   \ 1 1 0 addl,    
  286: $10822 l,    \ 1 0 1 sub,     
  287: $1FF822 l,   \ 31 0 31 sub,   
  288: $10022 l,    \ 0 0 1 sub,     
  289: $822 l,	    \ 1 0 0 sub,     
  290: $10822 l,    \ 1 0 1 sub,     
  291: $1FF823 l,   \ 31 0 31 subl,  
  292: $10023 l,    \ 0 0 1 subl,    
  293: $823 l,	    \ 1 0 0 subl,    
  294: $10823 l,    \ 1 0 1 subl,    
  295: $3E0F827 l,  \ 31 31 0 nor,   
  296: $200027 l,   \ 0 1 0 nor,     
  297: $827 l,	    \ 1 0 0 nor,     
  298: $200827 l,   \ 1 1 0 nor,     
  299: $3FF082A l,  \ 1 31 31 slt,   
  300: $1420FFFF l, \ 1 0 -1 bne,    
  301: $82A l,	    \ 1 0 0 slt,     
  302: $14200001 l, \ 1 0 1 bne,     
  303: $1082A l,    \ 1 0 1 slt,     
  304: $14200000 l, \ 1 0 0 bne,     
  305: $20082A l,   \ 1 1 0 slt,     
  306: $14200000 l, \ 1 0 0 bne,     
  307: $21082A l,   \ 1 1 1 slt,     
  308: $14200001 l, \ 1 0 1 bne,     
  309: $3FF082A l,  \ 1 31 31 slt,   
  310: $1020FFFF l, \ 1 0 -1 beq,    
  311: $82A l,	    \ 1 0 0 slt,     
  312: $10200001 l, \ 1 0 1 beq,     
  313: $20082A l,   \ 1 1 0 slt,     
  314: $10200000 l, \ 1 0 0 beq,     
  315: $1082A l,    \ 1 0 1 slt,     
  316: $10200000 l, \ 1 0 0 beq,     
  317: $21082A l,   \ 1 1 1 slt,     
  318: $10200001 l, \ 1 0 1 beq,     
  319: $3FF082A l,  \ 1 31 31 slt,   
  320: $1420FFFF l, \ 1 0 -1 bne,    
  321: $82A l,	    \ 1 0 0 slt,     
  322: $14200001 l, \ 1 0 1 bne,     
  323: $20082A l,   \ 1 1 0 slt,     
  324: $14200000 l, \ 1 0 0 bne,     
  325: $1082A l,    \ 1 0 1 slt,     
  326: $14200000 l, \ 1 0 0 bne,     
  327: $21082A l,   \ 1 1 1 slt,     
  328: $14200001 l, \ 1 0 1 bne,     
  329: $3FF082B l,  \ 1 31 31 sltl,  
  330: $1020FFFF l, \ 1 0 -1 beq,    
  331: $82B l,	    \ 1 0 0 sltl,    
  332: $10200001 l, \ 1 0 1 beq,     
  333: $1082B l,    \ 1 0 1 sltl,    
  334: $10200000 l, \ 1 0 0 beq,     
  335: $20082B l,   \ 1 1 0 sltl,    
  336: $10200000 l, \ 1 0 0 beq,     
  337: $21082B l,   \ 1 1 1 sltl,    
  338: $10200001 l, \ 1 0 1 beq,     
  339: $3FF082B l,  \ 1 31 31 sltl,  
  340: $1420FFFF l, \ 1 0 -1 bne,    
  341: $82B l,	    \ 1 0 0 sltl,    
  342: $14200001 l, \ 1 0 1 bne,     
  343: $1082B l,    \ 1 0 1 sltl,    
  344: $14200000 l, \ 1 0 0 bne,     
  345: $20082B l,   \ 1 1 0 sltl,    
  346: $14200000 l, \ 1 0 0 bne,     
  347: $21082B l,   \ 1 1 1 sltl,    
  348: $14200001 l, \ 1 0 1 bne,     
  349: $3FF082B l,  \ 1 31 31 sltl,  
  350: $1020FFFF l, \ 1 0 -1 beq,    
  351: $82B l,	    \ 1 0 0 sltl,    
  352: $10200001 l, \ 1 0 1 beq,     
  353: $20082B l,   \ 1 1 0 sltl,    
  354: $10200000 l, \ 1 0 0 beq,     
  355: $1082B l,    \ 1 0 1 sltl,    
  356: $10200000 l, \ 1 0 0 beq,     
  357: $21082B l,   \ 1 1 1 sltl,    
  358: $10200001 l, \ 1 0 1 beq,     
  359: $3FF082B l,  \ 1 31 31 sltl,  
  360: $1420FFFF l, \ 1 0 -1 bne,    
  361: $82B l,	    \ 1 0 0 sltl,    
  362: $14200001 l, \ 1 0 1 bne,     
  363: $20082B l,   \ 1 1 0 sltl,    
  364: $14200000 l, \ 1 0 0 bne,     
  365: $1082B l,    \ 1 0 1 sltl,    
  366: $14200000 l, \ 1 0 0 bne,     
  367: $21082B l,   \ 1 1 1 sltl,    
  368: $14200001 l, \ 1 0 1 bne,     
  369: $3FF082B l,  \ 1 31 31 sltl,  
  370: $1020FFFF l, \ 1 0 -1 beq,    
  371: $82B l,	    \ 1 0 0 sltl,    
  372: $10200001 l, \ 1 0 1 beq,     
  373: $1082B l,    \ 1 0 1 sltl,    
  374: $10200000 l, \ 1 0 0 beq,     
  375: $20082B l,   \ 1 1 0 sltl,    
  376: $10200000 l, \ 1 0 0 beq,     
  377: $21082B l,   \ 1 1 1 sltl,    
  378: $10200001 l, \ 1 0 1 beq,     
  379: $70650802 l, \ 1 3 5 mul,
  380: $70230000 l, \ 1 3 madd,
  381: $70230001 l, \ 1 3 maddu,
  382: $70230004 l, \ 1 3 msub,
  383: $70230005 l, \ 1 3 msubu,
  384: $70A31820 l, \ 3 5 clz,
  385: $70A31821 l, \ 3 5 clo,
  386: $65080A l, \ 1 3 5 movz
  387: $65080B l, \ 1 3 5 movn
  388: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>