From 86cc6e6159412c25349c93ee42a8aa5c5324b915 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 22 May 2022 12:54:32 +0200 Subject: [PATCH] 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 */