aboutsummaryrefslogtreecommitdiff
path: root/riscv/insns/vmvnfr_v.h
blob: 9c528104708effccce51456061f4942f46d6f384 (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
// vmv<nf>r.v vd, vs2
require_vector(true);
const reg_t vd = insn.rd();
const reg_t vs2 = insn.rs2();
const reg_t len = insn.rs1() + 1;
require_align(vd, len);
require_align(vs2, len);
const reg_t size = len * P.VU.vlenb;
const reg_t start = P.VU.vstart->read() * (P.VU.vsew >> 3);

//register needs one-by-one copy to keep commitlog correct
if (vd != vs2 && start < size) {
  reg_t i = start / P.VU.vlenb;
  reg_t off = start % P.VU.vlenb;
  if (off) {
    memcpy(&P.VU.elt<uint8_t>(vd + i, off, true),
           &P.VU.elt<uint8_t>(vs2 + i, off), P.VU.vlenb - off);
    i++;
  }

  for (; i < len; ++i) {
    memcpy(&P.VU.elt<uint8_t>(vd + i, 0, true),
           &P.VU.elt<uint8_t>(vs2 + i, 0), P.VU.vlenb);
  }
}

P.VU.vstart->write(0);