From 1612c6d638229bacb3312ec5f47deb7218b69f4c Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Mon, 17 Nov 2014 16:32:18 -0800 Subject: [PATCH] Instruction %concat/vec4, %pad/u and %shiftl manipulate stack in place --- vvp/vthread.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 9dab1c384..6e2bc8f61 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -1808,13 +1808,13 @@ bool of_CONCATI_STR(vthread_t thr, vvp_code_t cp) bool of_CONCAT_VEC4(vthread_t thr, vvp_code_t) { vvp_vector4_t lsb = thr->pop_vec4(); - vvp_vector4_t msb = thr->pop_vec4(); + vvp_vector4_t&msb = thr->peek_vec4(); vvp_vector4_t res (msb.size()+lsb.size(), BIT4_X); res.set_vec(0, lsb); res.set_vec(lsb.size(), msb); - thr->push_vec4(res); + msb = res; return true; } @@ -3743,7 +3743,7 @@ bool of_PAD_U(vthread_t thr, vvp_code_t cp) { unsigned wid = cp->number; - vvp_vector4_t val = thr->pop_vec4(); + vvp_vector4_t&val = thr->peek_vec4(); unsigned old_size = val.size(); val.resize(wid); @@ -3753,8 +3753,6 @@ bool of_PAD_U(vthread_t thr, vvp_code_t cp) val.set_bit(idx,pad); } - thr->push_vec4(val); - return true; } @@ -4841,13 +4839,15 @@ bool of_SET_DAR_OBJ_STR(vthread_t thr, vvp_code_t cp) /* * %shiftl + * + * Pop the operand, then push the result. */ bool of_SHIFTL(vthread_t thr, vvp_code_t cp) { int use_index = cp->number; int shift = thr->words[use_index].w_int; - vvp_vector4_t val = thr->pop_vec4(); + vvp_vector4_t&val = thr->peek_vec4(); int wid = val.size(); if (thr->flags[4] == BIT4_1) { @@ -4878,7 +4878,6 @@ bool of_SHIFTL(vthread_t thr, vvp_code_t cp) val.set_vec(wid-use_shift, tmp); } - thr->push_vec4(val); return true; }