Handle word aligned bit moves more efficiently

If the source and destination of a subvector to be moved in the
vvp_vector4_t::mov method is nicely word aligned, and the transfer
size is a full word, then we ar much better off handling that as
a special case. This makes the move faster, and also avoids some
shift overflow errors.
This commit is contained in:
Stephen Williams 2009-11-26 09:34:45 -08:00
parent f07577db11
commit c73925e775
1 changed files with 16 additions and 0 deletions

View File

@ -1162,6 +1162,22 @@ void vvp_vector4_t::mov(unsigned dst, unsigned src, unsigned cnt)
if ((doff+trans) > BITS_PER_WORD)
trans = BITS_PER_WORD - doff;
if (trans == BITS_PER_WORD) {
// Special case: the transfer count is
// exactly an entire word. For this to be
// true, it must also be true that the
// pointers are aligned. The work is easy,
abits_ptr_[dptr] = abits_ptr_[sptr];
bbits_ptr_[dptr] = bbits_ptr_[sptr];
dptr += 1;
sptr += 1;
cnt -= BITS_PER_WORD;
continue;
}
// Here we know that either the source or
// destination is unaligned, and also we know that
// the count is less then a full word.
unsigned long vmask = (1UL << trans) - 1;
unsigned long tmp;