%load/av now matches %load/v for truncating/extension.
This patch adds code to make %load/av extend or truncate a value like %load/v.
This commit is contained in:
parent
893aae2ca4
commit
e719dc250a
|
|
@ -414,8 +414,9 @@ ended, then the %join does not block or yield the thread.
|
|||
* %load/av <bit>, <array-label>, <wid>
|
||||
|
||||
This instruction loads a word from the specified array. The word
|
||||
address is in index register 3. The width should match the width of
|
||||
the array word.
|
||||
address is in index register 3. Like %load/v below the width does
|
||||
not have to match the width of the array word. See the %load/v
|
||||
description for more information.
|
||||
|
||||
* %load/avp0 <bit>, <array-label>, <wid>
|
||||
* %load/avp0/s <bit>, <array-label>, <wid>
|
||||
|
|
|
|||
|
|
@ -2363,19 +2363,21 @@ bool of_LOAD_AV(vthread_t thr, vvp_code_t cp)
|
|||
|
||||
vvp_vector4_t word = array_get_word(cp->array, adr);
|
||||
|
||||
if (word.size() != wid) {
|
||||
fprintf(stderr, "internal error: array width=%u, word.size()=%u, wid=%u\n",
|
||||
0, word.size(), wid);
|
||||
assert(word.size() == wid);
|
||||
}
|
||||
|
||||
/* Check the address once, before we scan the vector. */
|
||||
thr_check_addr(thr, bit+wid-1);
|
||||
|
||||
if (word.size() > wid)
|
||||
word.resize(wid);
|
||||
|
||||
/* Copy the vector bits into the bits4 vector. Do the copy
|
||||
directly to skip the excess calls to thr_check_addr. */
|
||||
thr->bits4.set_vec(bit, word);
|
||||
|
||||
/* If the source is shorter then the desired width, then pad
|
||||
with BIT4_X values. */
|
||||
for (unsigned idx = word.size() ; idx < wid ; idx += 1)
|
||||
thr->bits4.set_bit(bit+idx, BIT4_X);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue