From 781089662c6504b8eec4041bd39c66bf1085d1a6 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 22 May 2022 12:53:49 +0200 Subject: [PATCH 1/2] vvp: Remove unused `%mov/wu` instruction The `%mov/wu` instruction moves data from one index register to another. The instruction is not used. It also does the same as `%ix/mov`. So remove it. Signed-off-by: Lars-Peter Clausen --- vvp/compile.cc | 1 - vvp/opcodes.txt | 2 -- vvp/vthread.cc | 12 ------------ 3 files changed, 15 deletions(-) diff --git a/vvp/compile.cc b/vvp/compile.cc index 9d1e4d26f..a131658cc 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -216,7 +216,6 @@ static const struct opcode_table_s opcode_table[] = { { "%mod", of_MOD, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%mod/s", of_MOD_S, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%mod/wr", of_MOD_WR, 0, {OA_NONE, OA_NONE, OA_NONE} }, - { "%mov/wu", of_MOV_WU, 2, {OA_BIT1, OA_BIT2, OA_NONE} }, { "%mul", of_MUL, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%mul/wr", of_MUL_WR, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%muli", of_MULI, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 24840c5b8..461ba89f1 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -806,8 +806,6 @@ The /s form does signed %. This opcode is the real-valued modulus of the two real values. -* %mov/wu , - * %mul * %muli , , diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 0789c3b7b..6b797379f 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -4500,18 +4500,6 @@ bool of_PARTI_U(vthread_t thr, vvp_code_t cp) return of_PARTI_base(thr, cp, false); } -/* -* %mov/wu , -*/ -bool of_MOV_WU(vthread_t thr, vvp_code_t cp) -{ - unsigned dst = cp->bit_idx[0]; - unsigned src = cp->bit_idx[1]; - - thr->words[dst].w_uint = thr->words[src].w_uint; - return true; -} - /* * %mul */ From 86cc6e6159412c25349c93ee42a8aa5c5324b915 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 22 May 2022 12:54:32 +0200 Subject: [PATCH 2/2] vvp: Remove unused `%cmp/ws` and `%cmp/wu` instructions The `%cmp/ws` and `%cmp/wu` instructions compare two index registers. They are currently unused. Since the index registers are not used for data there is not really a need to compare them. Values can be compared before loading them into an index register. So remove these two instructions. Signed-off-by: Lars-Peter Clausen --- vvp/compile.cc | 2 -- vvp/opcodes.txt | 5 ----- vvp/vthread.cc | 28 ---------------------------- 3 files changed, 35 deletions(-) diff --git a/vvp/compile.cc b/vvp/compile.cc index a131658cc..46ec619d0 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -129,8 +129,6 @@ static const struct opcode_table_s opcode_table[] = { { "%cmp/we", of_CMPWE, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%cmp/wne", of_CMPWNE, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%cmp/wr", of_CMPWR, 0, {OA_NONE, OA_NONE, OA_NONE} }, - { "%cmp/ws", of_CMPWS, 2, {OA_BIT1, OA_BIT2, OA_NONE} }, - { "%cmp/wu", of_CMPWU, 2, {OA_BIT1, OA_BIT2, OA_NONE} }, { "%cmp/x", of_CMPX, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%cmp/z", of_CMPZ, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%cmpi/e", of_CMPIE, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 461ba89f1..44414b080 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -341,11 +341,6 @@ values from the real-value stack and writes the comparison result to bits 4/5. The expressions (a < b) and (a==b) are calculated, with (b) popped from the stack first, then (a). -* %cmp/ws , -* %cmp/wu , - -[compare signed/unsigned integer words.] - * %cmp/z * %cmp/x diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 6b797379f..ac09ff96c 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -2245,34 +2245,6 @@ bool of_CMPWR(vthread_t thr, vvp_code_t) return true; } -bool of_CMPWS(vthread_t thr, vvp_code_t cp) -{ - int64_t l = thr->words[cp->bit_idx[0]].w_int; - int64_t r = thr->words[cp->bit_idx[1]].w_int; - - vvp_bit4_t eq = (l == r)? BIT4_1 : BIT4_0; - vvp_bit4_t lt = (l < r)? BIT4_1 : BIT4_0; - - thr->flags[4] = eq; - thr->flags[5] = lt; - - return true; -} - -bool of_CMPWU(vthread_t thr, vvp_code_t cp) -{ - uint64_t l = thr->words[cp->bit_idx[0]].w_uint; - uint64_t r = thr->words[cp->bit_idx[1]].w_uint; - - vvp_bit4_t eq = (l == r)? BIT4_1 : BIT4_0; - vvp_bit4_t lt = (l < r)? BIT4_1 : BIT4_0; - - thr->flags[4] = eq; - thr->flags[5] = lt; - - return true; -} - /* * %cmp/z */