blob: 6e941ebb1af72338bb5b2ecfeeb5050e05fbf435 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// vmsif.m rd, vs2, vm
require(P.VU.vsew >= e8 && P.VU.vsew <= e64);
require_vector;
require(P.VU.vstart == 0);
require_vm;
require(insn.rd() != insn.rs2());
reg_t vl = P.VU.vl;
reg_t rd_num = insn.rd();
reg_t rs2_num = insn.rs2();
bool has_one = false;
for (reg_t i = P.VU.vstart ; i < vl; ++i) {
const int midx = i / 64;
const int mpos = i % 64;
const uint64_t mmask = UINT64_C(1) << mpos; \
bool vs2_lsb = ((P.VU.elt<uint64_t>(rs2_num, midx ) >> mpos) & 0x1) == 1;
bool do_mask = (P.VU.elt<uint64_t>(0, midx) >> mpos) & 0x1;
if (insn.v_vm() == 1 || (insn.v_vm() == 0 && do_mask)) {
auto &vd = P.VU.elt<uint64_t>(rd_num, midx, true);
uint64_t res = 0;
if (!has_one && !vs2_lsb) {
res = 1;
} else if(!has_one && vs2_lsb) {
has_one = true;
res = 1;
}
vd = (vd & ~mmask) | ((res << mpos) & mmask);
}
}
|