Commit 3d73929e authored by Benedikt Geßele's avatar Benedikt Geßele

mips updating c.condn.fmt

parent cec87fc2
......@@ -1509,7 +1509,6 @@ val semantics i =
| BLTZ x: sem-bltz x
| BNE x: sem-bne x
| BREAK x: sem-break x
| C-cond-fmt x: sem-default-ternop-cflrr-generic i x
| CACHE x: sem-default-binop-rr-tuple-generic i x
| CACHEE x: sem-default-binop-rr-tuple-generic i x
| CEIL-L-fmt x: sem-default-binop-flr-generic i x
......
......@@ -125,6 +125,7 @@ val revision/semantics i =
| BLTZALL x: sem-bltzall x
| BLTZL x: sem-bltzl x
| BNEL x: sem-bnel x
| C-cond-fmt x: sem-default-ternop-cflrr-generic i x
| LDC2 x: sem-default-binop-rr-tuple-generic i x
| LWC2 x: sem-default-binop-rr-tuple-generic i x
| LWL x: sem-lwl x
......
......@@ -191,6 +191,31 @@ val sem-bitswap x = do
write x.op1 (var rd_out)
end
val branch-on-overflow x cmp_op = do
rs <- rval Signed x.op1;
rt <- rval Signed x.op2;
off <- rval Signed x.op3;
size <- return (sizeof-rval x.op1);
res <- mktemp;
add size res rs rt;
t1 <- mktemp;
t2 <- mktemp;
t3 <- mktemp;
# overflow computation: mind**** alert
xorb size t1 (var res) rs;
xorb size t2 (var res) rt;
andb size t3 (var t1) (var t2);
cond <- cmp_op size (var t3) (imm 0);
cbranch-rel cond off
end
val sem-bovc x = branch-on-overflow x /lts
val sem-bnvc x = branch-on-overflow x /ges
val revision/semantics i =
case i of
ADDIUPC x: sem-addiupc x
......@@ -223,4 +248,7 @@ val revision/semantics i =
| BEQZC x: sem-beqzc x
| BNEZC x: sem-bnezc x
| BITSWAP x: sem-bitswap x
| BOVC x: sem-bovc x
| BNVC x: sem-bnvc x
| CLASS-fmt x: sem-default-binop-flr-generic i x
end
......@@ -44,7 +44,6 @@ val traverse f insn =
| BLTZ x: f "BLTZ" (BINOP_RR x)
| BNE x: f "BNE" (TERNOP_RRR x)
| BREAK x: f "BREAK" (UNOP_R x)
| C-cond-fmt x: f "C" (TERNOP_CFLRR x)
| CACHE x: f "CACHE" (BINOP_RR x)
| CACHEE x: f "CACHEE" (BINOP_RR x)
| CEIL-L-fmt x: f "CEIL.L" (BINOP_FLR x)
......
......@@ -20,6 +20,7 @@ val revision/traverse f insn =
| BLTZALL x: f "BLTZALL" (BINOP_RR x)
| BLTZL x: f "BLTZL" (BINOP_RR x)
| BNEL x: f "BNEL" (TERNOP_RRR x)
| C-cond-fmt x: f "C" (TERNOP_CFLRR x)
| LDC2 x: f "LDC2" (BINOP_RR x)
| LWC2 x: f "LWC2" (BINOP_RR x)
| LWL x: f "LWL" (BINOP_LR x)
......
......@@ -30,4 +30,7 @@ val revision/traverse f insn =
| BEQZC x: f "BEQZC" (BINOP_RR x)
| BNEZC x: f "BNEZC" (BINOP_RR x)
| BITSWAP x: f "BITSWAP" (BINOP_LR x)
| BOVC x: f "BOVC" (TERNOP_RRR x)
| BNVC x: f "BNVC" (TERNOP_RRR x)
| CLASS-fmt x: f "CLASS" (BINOP_FLR x)
end
......@@ -217,10 +217,6 @@ val / ['000000 /code10 /code10to20 001101']
| asmode? = nullop UNDEFINED
| otherwise = unop BREAK code10to20
### C-cond-fmt
### - Floating Point Compare
val / ['010001 /fmt5sdps /ft /fs /cc 0 0 11 /cond'] = ternop-cond-fmt C-cond-fmt cond fmt fcc (right fs) (right ft)
### CACHE
### - Perform Cache Operation
val / ['101111 /base /op /offset16'] = binop CACHE op offset16/base
......@@ -1315,7 +1311,6 @@ type instruction =
| BLTZ of binop-rr
| BNE of ternop-rrr
| BREAK of unop-r
| C-cond-fmt of ternop-cflrr
| CACHE of binop-rr
| CACHEE of binop-rr
| CEIL-L-fmt of binop-flr
......
......@@ -103,6 +103,10 @@ val / ['000001 /rs 00010 /offset16'] = binop BLTZL (right rs) offset18
### - Branch on Not Equal Likely
val / ['010101 /rs /rt /offset16'] = ternop BNEL (right rs) (right rt) offset18
### C-cond-fmt
### - Floating Point Compare
val / ['010001 /fmt5sdps /ft /fs /cc 0 0 11 /cond'] = ternop-cond-fmt C-cond-fmt cond fmt fcc (right fs) (right ft)
### LDC2
### - Load Doubleword to Coprocessor 2
val / ['110110 /base /rt /offset16'] = binop LDC2 rt/imm offset16/base
......@@ -169,6 +173,7 @@ type instruction =
| BLTZALL of binop-rr
| BLTZL of binop-rr
| BNEL of ternop-rrr
| C-cond-fmt of ternop-cflrr
| LDC2 of binop-rr
| LWC2 of binop-rr
| LWL of binop-lr
......
......@@ -27,6 +27,8 @@ val beqc? s = ((zx s.rs) < (zx s.rt)) and (not (s.rs == '00000')) and (not (s.rt
val bnec? s = ((zx s.rs) < (zx s.rt)) and (not (s.rs == '00000')) and (not (s.rt == '00000'))
val beqzc? s = not (s.rs == '00000')
val bnezc? s = not (s.rs == '00000')
val bovc? s = ((zx s.rs) >= (zx s.rt))
val bnvc? s = ((zx s.rs) >= (zx s.rt))
######################
......@@ -110,10 +112,10 @@ val / ['010010 01101 /ct /offset16'] = binop BC2NEZ ct offset18
### => see BLTTUC
### BEQZALC
### => see BEQC
### => see BOVC
### BNEZALC
### => see BNEC
### => see BNVC
### B<cond>C
### - Compact compare-and-branch instructions
......@@ -144,14 +146,10 @@ val / ['000111 /rs /rt /offset16']
| bltuc? = ternop BLTUC (right rs) (right rt) offset18
### BEQC
val / ['001000 /rs /rt /offset16']
| beqzalc? = binop BEQZALC (right rt) offset18
| beqc? = ternop BEQC (right rs) (right rt) offset18
### => see BOVC
### BNEC
val / ['011000 /rs /rt /offset16']
| bnezalc? = binop BNEZALC (right rt) offset18
| bnec? = ternop BNEC (right rs) (right rt) offset18
### => see BNVC
### BEQZC
val / ['110110 /rs /offset21']
......@@ -165,6 +163,28 @@ val / ['111110 /rs /offset21']
### - Swaps (reverses) bits in each byte
val / ['011111 00000 /rt /rd 00000 100000'] = binop BITSWAP rd (right rt)
### BOVC
### - Swaps (reverses) bits in each byte
val / ['001000 /rs /rt /offset16']
| beqzalc? = binop BEQZALC (right rt) offset18
| beqc? = ternop BEQC (right rs) (right rt) offset18
| bovc? = ternop BOVC (right rs) (right rt) offset18
### BNVC
### - Swaps (reverses) bits in each byte
val / ['011000 /rs /rt /offset16']
| bnezalc? = binop BNEZALC (right rt) offset18
| bnec? = ternop BNEC (right rs) (right rt) offset18
| bnvc? = ternop BNVC (right rs) (right rt) offset18
### Class-fmt
### - Scalar Floating-Point Class Mask
val / ['010001 /fmt5sd 00000 /fs /fd 011011'] = binop-fmt CLASS-fmt fmt fd (right fs)
### CMP-condn-fmt
### - Floating Point Compare setting Mask
val / ['010001 /fmt5sd/wl /ft /fs /fd 0 condn'] = binop-fmt CLASS-fmt fmt fd (right fs)
### LUI
### - Load Upper Immediate
### => see AUI r0, rt, immediate16
......@@ -201,6 +221,9 @@ type instruction =
| BEQZC of binop-rr
| BNEZC of binop-rr
| BITSWAP of binop-lr
| BOVC of ternop-rrr
| BNVC of ternop-rrr
| CLASS-fmt of binop-flr
type imm =
IMM21 of 21
......@@ -220,6 +243,10 @@ val /offset21 ['offset21:21'] = update@{offset21=offset21}
val /offset26 ['offset26:26'] = update@{offset26=offset26}
val /bp ['bp:2'] = update@{bp=bp}
val /ct ['ct:5'] = update@{ct=ct}
val /fmt5sd/wl ['10100'] = update@{fmt=S}
val /fmt5sd/wl ['10101'] = update@{fmt=D}
val /condn [''] =
###########################
# operand constructors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment