diff --git a/mach/mips/as/instructions.dat b/mach/mips/as/instructions.dat index 1f7aae7f8..f3736d651 100644 --- a/mach/mips/as/instructions.dat +++ b/mach/mips/as/instructions.dat @@ -156,3 +156,97 @@ 00000000000100110 "xor" RD=gpr ',' RS=gpr ',' RT=gpr 001110 "xori" RT=gpr ',' RS=gpr ',' IMM=e16 +# FPU instructions. + +01000100000000101 "abs." F=FMT FD=fpr ',' FS=fpr +010001000000 "add." F=FMT FD=fpr ',' FS=fpr ',' FT=fpr +010011011110 "alnv.ps" FD=fpr ',' FS=fpr ',' FT=fpr ',' RS=gpr +0100010011 "c." CO=FCOND '.' F=FMT FS=fpr ',' FT=fpr +01000100000001010 "ceil.l." F=FMT FD=fpr ',' FS=fpr +01000100000001110 "ceil.w." F=FMT FD=fpr ',' FS=fpr +0100010001000000000000 "cfc1" RT=gpr ',' FS=fpr +0100010011000000000000 "ctc1" RT=gpr ',' FS=fpr +01000100000100001 "cvt.d." F=FMT FD=fpr ',' FS=fpr +01000100000100101 "cvt.l." F=FMT FD=fpr ',' FS=fpr +01000110000100110 "cvt.ps.s" FD=fpr ',' FS=fpr ',' FT=fpr +01000100000100000 "cvt.s." F=FMT FD=fpr ',' FS=fpr +0100011011000000101000 "cvt.s.pl" FS=fpr ',' FD=fpr +0100011011000000100000 "cvt.s.pu" FS=fpr ',' FD=fpr +01000100000100100 "cvt.w." F=FMT FD=fpr ',' FS=fpr +010001000011 "div." F=FMT FD=fpr ',' FS=fpr ',' FT=fpr +01000100000001011 "floor.l." F=FMT FD=fpr ',' FS=fpr +01000100000001111 "floor.w." F=FMT FD=fpr ',' FS=fpr +110101 "ldc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')' +01001100000000001 "ldxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' +01001100000000101 "luxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' +110001 "lwc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')' +01001100000000000 "lwxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' +010011100 "madd." F=FMT3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr +0100010000000000000000 "mfc1" RT=gpr ',' FS=fpr +0100010001100000000000 "mfhc1" RT=gpr ',' FS=fpr +01000100000000110 "mov." F=FMT FD=fpr ',' FS=fpr +0000000000000000001 "movf" RD=gpr ',' RS=gpr ',' C=FCOND +01000100010001 "movf." F=FMT FD=fpr ',' FS=fpr ',' C=FCOND +010001010011 "movn." F=FMT FD=fpr ',' FS=fpr ',' RT=gpr +0000000100000000001 "movt" RD=gpr ',' RS=gpr ',' C=FCOND +01000101010001 "movt." F=FMT FD=fpr ',' FS=fpr ',' C=FCOND +010001010010 "movz." F=FMT FD=fpr ',' FS=fpr ',' RT=gpr +010011101 "msub." F=FMT3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr +0100010010000000000000 "mtc1" RT=gpr ',' FS=fpr +0100010011100000000000 "mthc1" RT=gpr ',' FS=fpr +010001000010 "mul." F=FMT FD=fpr ',' FS=fpr ',' FT=fpr +01000100000000111 "neg." F=FMT FD=fpr ',' FS=fpr +010011110 "nmadd." F=FMT3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr +010011111 "nmsub." F=FMT3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr +01000110110101100 "pll.ps" FD=fpr ',' FS=fpr ',' FT=fpr +01000110110101101 "plu.ps" FD=fpr ',' FS=fpr ',' FT=fpr +01000110110101110 "pul.ps" FD=fpr ',' FS=fpr ',' FT=fpr +01000110110101111 "puu.ps" FD=fpr ',' FS=fpr ',' FT=fpr +01000100000010101 "recip." F=FMT FD=fpr ',' FS=fpr +01000100000001000 "round.l." F=FMT FD=fpr ',' FS=fpr +01000100000001100 "round.w." F=FMT FD=fpr ',' FS=fpr +01000100000010110 "rsqrt." F=FMT FD=fpr ',' FS=fpr +111101 "sdc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')' +01001100000001001 "sdxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' +01000100000000100 "sqrt." F=FMT FD=fpr ',' FS=fpr +010001000001 "sub." F=FMT FD=fpr ',' FS=fpr ',' FT=fpr +01001100000001101 "suxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' +111001 "swc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')' +01001100000001000 "swxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')' + +# Generic coprocessor instructions. + +0100010100000 "bc1f" C=u3 ',' OFF=offset16 +0100010100000000 "bc1f" OFF=offset16 +0100010100010 "bc1fl" C=u3 ',' OFF=offset16 +0100010100000010 "bc1fl" OFF=offset16 +0100010100001 "bc1t" C=u3 ',' OFF=offset16 +0100010100000001 "bc1t" OFF=offset16 +0100010100011 "bc1tl" C=u3 ',' OFF=offset16 +0100010100000011 "bc1tl" OFF=offset16 +0100100100000 "bc2f" C=u3 ',' OFF=offset16 +0100100100000000 "bc2f" OFF=offset16 +0100100100010 "bc2fl" C=u3 ',' OFF=offset16 +0100100100000010 "bc2fl" OFF=offset16 +0100100100001 "bc2t" C=u3 ',' OFF=offset16 +0100100100000001 "bc2t" OFF=offset16 +0100100100011 "bc2tl" C=u3 ',' OFF=offset16 +0100100100000011 "bc2tl" OFF=offset16 +01001000010 "cfc2" RT=gpr ',' IMM=u16 +01001000110 "ctc2" RT=gpr ',' IMM=u16 +0100101 "cop2" FUN=u25 +110110 "ldc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')' +110010 "lwc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')' +0100000000000000000 "mfc0" RT=gpr ',' RD=u5 ',' S=u3 +01001000000 "mfc2" RT=gpr ',' IMM=u16 +0100000001000000000 "mfhc0" RT=gpr ',' RD=u5 ',' S=u3 +01001000011 "mfhc2" RT=gpr ',' IMM=u16 +0100000010000000000 "mtc0" RT=gpr ',' RD=u5 ',' S=u3 +01001000100 "mtc2" RT=gpr ',' IMM=u16 +0100000011000000000 "mthc0" RT=gpr ',' RD=u5 ',' S=u3 +01001000111 "mthc2" RT=gpr ',' IMM=u16 +111110 "sdc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')' +111010 "swc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')' + + + diff --git a/mach/mips/as/mach2.c b/mach/mips/as/mach2.c index 2672c0b9a..11886d052 100644 --- a/mach/mips/as/mach2.c +++ b/mach/mips/as/mach2.c @@ -1,9 +1,12 @@ %token GPR %token FPR +%token FMT +%token FMT3 +%token FCOND -%type gpr +%type gpr fpr %type e16 e9 -%type u20 u5 +%type u25 u20 u16 u5 u3 %type abs26 offset16 %type extmsblsb insmsblsb diff --git a/mach/mips/as/mach3.c b/mach/mips/as/mach3.c index 0de4b37be..45af1c4fd 100644 --- a/mach/mips/as/mach3.c +++ b/mach/mips/as/mach3.c @@ -74,6 +74,36 @@ 0, FPR, 30, "f30", 0, FPR, 31, "f31", +/* Floating-point comparison values */ + +0, FCOND, 0, "f", +0, FCOND, 1, "un", +0, FCOND, 2, "eq", +0, FCOND, 3, "ueq", +0, FCOND, 4, "olt", +0, FCOND, 5, "ult", +0, FCOND, 6, "ole", +0, FCOND, 7, "ule", +0, FCOND, 8, "sf", +0, FCOND, 9, "ngle", +0, FCOND, 10, "seq", +0, FCOND, 11, "ngl", +0, FCOND, 12, "lt", +0, FCOND, 13, "nge", +0, FCOND, 14, "le", +0, FCOND, 15, "ngt", + +0, FMT, 16, "s", +0, FMT, 17, "d", +0, FMT, 20, "w", +0, FMT, 21, "l", +0, FMT, 22, "ps", + +0, FMT3, 0, "s", +0, FMT3, 1, "d", +0, FMT3, 4, "w", +0, FMT3, 5, "l", +0, FMT3, 6, "ps", + #include "tokens.y" - diff --git a/mach/mips/as/mach4.c b/mach/mips/as/mach4.c index 2185fb245..f4d4c5e8d 100644 --- a/mach/mips/as/mach4.c +++ b/mach/mips/as/mach4.c @@ -1,6 +1,7 @@ #include "rules.y" gpr: GPR +fpr: FPR e16 : absexp @@ -22,6 +23,15 @@ e9 } ; +u25 + : absexp + { + if (($1 < 0) || ($1 > 0x1ffffff)) + serror("25-bit unsigned value out of range"); + $$ = $1; + } + ; + u20 : absexp { @@ -31,6 +41,14 @@ u20 } ; +u16 + : absexp + { + if (($1 < 0) || ($1 > 0xffff)) + serror("16-bit unsigned value out of range"); + $$ = $1; + } + ; u5 : absexp @@ -41,6 +59,15 @@ u5 } ; +u3 + : absexp + { + if (($1 < 0) || ($1 > 0x7)) + serror("3-bit unsigned value out of range"); + $$ = $1; + } + ; + offset16 : expr {