Add some painfully untested FPU instructions.

This commit is contained in:
David Given 2018-09-02 21:36:09 +02:00
parent 1d6ecddcf4
commit f8e71d888b
4 changed files with 157 additions and 3 deletions

View file

@ -156,3 +156,97 @@
000000<RS-><RT-><RD->00000100110 "xor" RD=gpr ',' RS=gpr ',' RT=gpr 000000<RS-><RT-><RD->00000100110 "xor" RD=gpr ',' RS=gpr ',' RT=gpr
001110<RS-><RT-><IMM-----------> "xori" RT=gpr ',' RS=gpr ',' IMM=e16 001110<RS-><RT-><IMM-----------> "xori" RT=gpr ',' RS=gpr ',' IMM=e16
# FPU instructions.
010001<F-->00000<FS-><FD->000101 "abs." F=FMT FD=fpr ',' FS=fpr
010001<F--><FT-><FS-><FD->000000 "add." F=FMT FD=fpr ',' FS=fpr ',' FT=fpr
010011<RS-><FT-><FS-><FD->011110 "alnv.ps" FD=fpr ',' FS=fpr ',' FT=fpr ',' RS=gpr
010001<F--><FT-><FS-><C>0011<CO> "c." CO=FCOND '.' F=FMT FS=fpr ',' FT=fpr
010001<F-->00000<FS-><FD->001010 "ceil.l." F=FMT FD=fpr ',' FS=fpr
010001<F-->00000<FS-><FD->001110 "ceil.w." F=FMT FD=fpr ',' FS=fpr
01000100010<RT-><FS->00000000000 "cfc1" RT=gpr ',' FS=fpr
01000100110<RT-><FS->00000000000 "ctc1" RT=gpr ',' FS=fpr
010001<F-->00000<FS-><FD->100001 "cvt.d." F=FMT FD=fpr ',' FS=fpr
010001<F-->00000<FS-><FD->100101 "cvt.l." F=FMT FD=fpr ',' FS=fpr
01000110000<FT-><FS-><FD->100110 "cvt.ps.s" FD=fpr ',' FS=fpr ',' FT=fpr
010001<F-->00000<FS-><FD->100000 "cvt.s." F=FMT FD=fpr ',' FS=fpr
0100011011000000<FS-><FD->101000 "cvt.s.pl" FS=fpr ',' FD=fpr
0100011011000000<FS-><FD->100000 "cvt.s.pu" FS=fpr ',' FD=fpr
010001<F-->00000<FS-><FD->100100 "cvt.w." F=FMT FD=fpr ',' FS=fpr
010001<F--><FT-><FS-><FD->000011 "div." F=FMT FD=fpr ',' FS=fpr ',' FT=fpr
010001<F-->00000<FS-><FD->001011 "floor.l." F=FMT FD=fpr ',' FS=fpr
010001<F-->00000<FS-><FD->001111 "floor.w." F=FMT FD=fpr ',' FS=fpr
110101<RS-><FT-><IMM-----------> "ldc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')'
010011<RS-><RT->00000<FD->000001 "ldxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')'
010011<RS-><RT->00000<FD->000101 "luxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')'
110001<RS-><FT-><IMM-----------> "lwc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')'
010011<RS-><RT->00000<FD->000000 "lwxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')'
010011<FR-><FT-><FS-><FD->100<F> "madd." F=FMT3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr
01000100000<RT-><FS->00000000000 "mfc1" RT=gpr ',' FS=fpr
01000100011<RT-><FS->00000000000 "mfhc1" RT=gpr ',' FS=fpr
010001<F-->00000<FS-><FD->000110 "mov." F=FMT FD=fpr ',' FS=fpr
000000<RS-><C>00<RD->00000000001 "movf" RD=gpr ',' RS=gpr ',' C=FCOND
010001<F--><C>00<FS-><FD->010001 "movf." F=FMT FD=fpr ',' FS=fpr ',' C=FCOND
010001<F--><RT-><FS-><FD->010011 "movn." F=FMT FD=fpr ',' FS=fpr ',' RT=gpr
000000<RS-><C>01<RD->00000000001 "movt" RD=gpr ',' RS=gpr ',' C=FCOND
010001<F--><C>01<FS-><FD->010001 "movt." F=FMT FD=fpr ',' FS=fpr ',' C=FCOND
010001<F--><RT-><FS-><FD->010010 "movz." F=FMT FD=fpr ',' FS=fpr ',' RT=gpr
010011<FR-><FT-><FS-><FD->101<F> "msub." F=FMT3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr
01000100100<RT-><FS->00000000000 "mtc1" RT=gpr ',' FS=fpr
01000100111<RT-><FS->00000000000 "mthc1" RT=gpr ',' FS=fpr
010001<F--><FT-><FS-><FD->000010 "mul." F=FMT FD=fpr ',' FS=fpr ',' FT=fpr
010001<F-->00000<FS-><FD->000111 "neg." F=FMT FD=fpr ',' FS=fpr
010011<FR-><FT-><FS-><FD->110<F> "nmadd." F=FMT3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr
010011<FR-><FT-><FS-><FD->111<F> "nmsub." F=FMT3 FD=fpr ',' FR=fpr ',' FS=fpr ',' FT=fpr
01000110110<FT-><FS-><FD->101100 "pll.ps" FD=fpr ',' FS=fpr ',' FT=fpr
01000110110<FT-><FS-><FD->101101 "plu.ps" FD=fpr ',' FS=fpr ',' FT=fpr
01000110110<FT-><FS-><FD->101110 "pul.ps" FD=fpr ',' FS=fpr ',' FT=fpr
01000110110<FT-><FS-><FD->101111 "puu.ps" FD=fpr ',' FS=fpr ',' FT=fpr
010001<F-->00000<FS-><FD->010101 "recip." F=FMT FD=fpr ',' FS=fpr
010001<F-->00000<FS-><FD->001000 "round.l." F=FMT FD=fpr ',' FS=fpr
010001<F-->00000<FS-><FD->001100 "round.w." F=FMT FD=fpr ',' FS=fpr
010001<F-->00000<FS-><FD->010110 "rsqrt." F=FMT FD=fpr ',' FS=fpr
111101<RS-><FT-><IMM-----------> "sdc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')'
010011<RS-><RT->00000<FD->001001 "sdxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')'
010001<F-->00000<FS-><FD->000100 "sqrt." F=FMT FD=fpr ',' FS=fpr
010001<F--><FT-><FS-><FD->000001 "sub." F=FMT FD=fpr ',' FS=fpr ',' FT=fpr
010011<RS-><RT->00000<FD->001101 "suxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')'
111001<RS-><FT-><IMM-----------> "swc1" FT=fpr ',' IMM=e16 '(' RS=gpr ')'
010011<RS-><RT->00000<FD->001000 "swxc1" FD=fpr ',' RT=gpr '(' RS=gpr ')'
# Generic coprocessor instructions.
01000101000<C>00<OFF-----------> "bc1f" C=u3 ',' OFF=offset16
0100010100000000<OFF-----------> "bc1f" OFF=offset16
01000101000<C>10<OFF-----------> "bc1fl" C=u3 ',' OFF=offset16
0100010100000010<OFF-----------> "bc1fl" OFF=offset16
01000101000<C>01<OFF-----------> "bc1t" C=u3 ',' OFF=offset16
0100010100000001<OFF-----------> "bc1t" OFF=offset16
01000101000<C>11<OFF-----------> "bc1tl" C=u3 ',' OFF=offset16
0100010100000011<OFF-----------> "bc1tl" OFF=offset16
01001001000<C>00<OFF-----------> "bc2f" C=u3 ',' OFF=offset16
0100100100000000<OFF-----------> "bc2f" OFF=offset16
01001001000<C>10<OFF-----------> "bc2fl" C=u3 ',' OFF=offset16
0100100100000010<OFF-----------> "bc2fl" OFF=offset16
01001001000<C>01<OFF-----------> "bc2t" C=u3 ',' OFF=offset16
0100100100000001<OFF-----------> "bc2t" OFF=offset16
01001001000<C>11<OFF-----------> "bc2tl" C=u3 ',' OFF=offset16
0100100100000011<OFF-----------> "bc2tl" OFF=offset16
01001000010<RT-><IMM-----------> "cfc2" RT=gpr ',' IMM=u16
01001000110<RT-><IMM-----------> "ctc2" RT=gpr ',' IMM=u16
0100101<FUN--------------------> "cop2" FUN=u25
110110<RS-><RT-><IMM-----------> "ldc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')'
110010<RS-><RT-><IMM-----------> "lwc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')'
01000000000<RT-><RD->00000000<S> "mfc0" RT=gpr ',' RD=u5 ',' S=u3
01001000000<RT-><IMM-----------> "mfc2" RT=gpr ',' IMM=u16
01000000010<RT-><RD->00000000<S> "mfhc0" RT=gpr ',' RD=u5 ',' S=u3
01001000011<RT-><IMM-----------> "mfhc2" RT=gpr ',' IMM=u16
01000000100<RT-><RD->00000000<S> "mtc0" RT=gpr ',' RD=u5 ',' S=u3
01001000100<RT-><IMM-----------> "mtc2" RT=gpr ',' IMM=u16
01000000110<RT-><RD->00000000<S> "mthc0" RT=gpr ',' RD=u5 ',' S=u3
01001000111<RT-><IMM-----------> "mthc2" RT=gpr ',' IMM=u16
111110<RS-><RT-><IMM-----------> "sdc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')'
111010<RS-><RT-><IMM-----------> "swc2" RT=u5 ',' IMM=e16 '(' RS=gpr ')'

View file

@ -1,9 +1,12 @@
%token <y_word> GPR %token <y_word> GPR
%token <y_word> FPR %token <y_word> FPR
%token <y_word> FMT
%token <y_word> FMT3
%token <y_word> FCOND
%type <y_word> gpr %type <y_word> gpr fpr
%type <y_word> e16 e9 %type <y_word> e16 e9
%type <y_word> u20 u5 %type <y_word> u25 u20 u16 u5 u3
%type <y_word> abs26 offset16 %type <y_word> abs26 offset16
%type <y_word> extmsblsb insmsblsb %type <y_word> extmsblsb insmsblsb

View file

@ -74,6 +74,36 @@
0, FPR, 30, "f30", 0, FPR, 30, "f30",
0, FPR, 31, "f31", 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" #include "tokens.y"

View file

@ -1,6 +1,7 @@
#include "rules.y" #include "rules.y"
gpr: GPR gpr: GPR
fpr: FPR
e16 e16
: absexp : absexp
@ -22,6 +23,15 @@ e9
} }
; ;
u25
: absexp
{
if (($1 < 0) || ($1 > 0x1ffffff))
serror("25-bit unsigned value out of range");
$$ = $1;
}
;
u20 u20
: absexp : absexp
{ {
@ -31,6 +41,14 @@ u20
} }
; ;
u16
: absexp
{
if (($1 < 0) || ($1 > 0xffff))
serror("16-bit unsigned value out of range");
$$ = $1;
}
;
u5 u5
: absexp : absexp
@ -41,6 +59,15 @@ u5
} }
; ;
u3
: absexp
{
if (($1 < 0) || ($1 > 0x7))
serror("3-bit unsigned value out of range");
$$ = $1;
}
;
offset16 offset16
: expr : expr
{ {