mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
target/riscv: vmfirst find-first-set mask bit
Signed-off-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200701152549.1218-52-zhiwei_liu@c-sky.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
2e88f551df
commit
0db67e1c0c
4 changed files with 54 additions and 0 deletions
|
@ -4562,3 +4562,22 @@ target_ulong HELPER(vmpopc_m)(void *v0, void *vs2, CPURISCVState *env,
|
|||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/* vmfirst find-first-set mask bit*/
|
||||
target_ulong HELPER(vmfirst_m)(void *v0, void *vs2, CPURISCVState *env,
|
||||
uint32_t desc)
|
||||
{
|
||||
uint32_t mlen = vext_mlen(desc);
|
||||
uint32_t vm = vext_vm(desc);
|
||||
uint32_t vl = env->vl;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < vl; i++) {
|
||||
if (vm || vext_elem_mask(v0, mlen, i)) {
|
||||
if (vext_elem_mask(vs2, mlen, i)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1LL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue