Browse Source

rvv: add vse1/vle1

Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
pull/655/head
Chih-Min Chao 6 years ago
parent
commit
60428fcc44
  1. 3
      disasm/disasm.cc
  2. 24
      riscv/decode.h
  3. 6
      riscv/encoding.h
  4. 2
      riscv/insns/vle16_v.h
  5. 2
      riscv/insns/vle1_v.h
  6. 2
      riscv/insns/vle32_v.h
  7. 2
      riscv/insns/vle64_v.h
  8. 2
      riscv/insns/vle8_v.h
  9. 2
      riscv/insns/vlse16_v.h
  10. 2
      riscv/insns/vlse32_v.h
  11. 2
      riscv/insns/vlse64_v.h
  12. 2
      riscv/insns/vlse8_v.h
  13. 2
      riscv/insns/vse16_v.h
  14. 2
      riscv/insns/vse1_v.h
  15. 2
      riscv/insns/vse32_v.h
  16. 2
      riscv/insns/vse64_v.h
  17. 2
      riscv/insns/vse8_v.h
  18. 2
      riscv/insns/vsse16_v.h
  19. 2
      riscv/insns/vsse32_v.h
  20. 2
      riscv/insns/vsse64_v.h
  21. 2
      riscv/insns/vsse8_v.h
  22. 2
      riscv/riscv.mk.in

3
disasm/disasm.cc

@ -816,6 +816,9 @@ disassembler_t::disassembler_t(int xlen)
std::vector<const arg_t *> v_ld_index = {&vd, &v_address, &vs2, &opt, &vm};
std::vector<const arg_t *> v_st_index = {&vs3, &v_address, &vs2, &opt, &vm};
add_insn(new disasm_insn_t("vle1.v", match_vle1_v, mask_vle1_v, v_ld_unit));
add_insn(new disasm_insn_t("vse1.v", match_vse1_v, mask_vse1_v, v_st_unit));
DISASM_VMEM_INSN(vle, v_ld_unit, );
DISASM_VMEM_INSN(vluxei, v_ld_index, );
DISASM_VMEM_INSN(vlse, v_ld_stride, );

24
riscv/decode.h

@ -531,18 +531,18 @@ static inline bool is_aligned(const unsigned val, const unsigned pos)
} \
}
#define VI_CHECK_STORE(elt_width) \
#define VI_CHECK_STORE(elt_width, is_mask_ldst) \
require_vector(false); \
reg_t veew = sizeof(elt_width##_t) * 8; \
float vemul = ((float)veew / P.VU.vsew * P.VU.vflmul); \
reg_t veew = is_mask_ldst ? 1 : sizeof(elt_width##_t) * 8; \
float vemul = is_mask_ldst ? 1 : ((float)veew / P.VU.vsew * P.VU.vflmul); \
reg_t emul = vemul < 1 ? 1 : vemul; \
require(vemul >= 0.125 && vemul <= 8); \
require_align(insn.rd(), vemul); \
require((nf * emul) <= (NVPR / 4) && \
(insn.rd() + nf * emul) <= NVPR); \
#define VI_CHECK_LOAD(elt_width) \
VI_CHECK_STORE(elt_width); \
#define VI_CHECK_LOAD(elt_width, is_mask_ldst) \
VI_CHECK_STORE(elt_width, is_mask_ldst); \
require_vm; \
#define VI_CHECK_DSS(is_vs1) \
@ -1606,12 +1606,12 @@ for (reg_t i = 0; i < P.VU.vlmax && P.VU.vl != 0; ++i) { \
} \
}
#define VI_LD(stride, offset, elt_width) \
#define VI_LD(stride, offset, elt_width, is_mask_ldst) \
const reg_t nf = insn.v_nf() + 1; \
const reg_t vl = P.VU.vl; \
const reg_t vl = is_mask_ldst ? ((P.VU.vl + 7) / 8) : P.VU.vl; \
const reg_t baseAddr = RS1; \
const reg_t vd = insn.rd(); \
VI_CHECK_LOAD(elt_width); \
VI_CHECK_LOAD(elt_width, is_mask_ldst); \
for (reg_t i = 0; i < vl; ++i) { \
VI_ELEMENT_SKIP(i); \
VI_STRIP(i); \
@ -1660,12 +1660,12 @@ for (reg_t i = 0; i < P.VU.vlmax && P.VU.vl != 0; ++i) { \
} \
P.VU.vstart = 0;
#define VI_ST(stride, offset, elt_width) \
#define VI_ST(stride, offset, elt_width, is_mask_ldst) \
const reg_t nf = insn.v_nf() + 1; \
const reg_t vl = P.VU.vl; \
const reg_t vl = is_mask_ldst ? ((P.VU.vl + 7) / 8) : P.VU.vl; \
const reg_t baseAddr = RS1; \
const reg_t vs3 = insn.rd(); \
VI_CHECK_STORE(elt_width); \
VI_CHECK_STORE(elt_width, is_mask_ldst); \
for (reg_t i = 0; i < vl; ++i) { \
VI_STRIP(i) \
VI_ELEMENT_SKIP(i); \
@ -1720,7 +1720,7 @@ for (reg_t i = 0; i < P.VU.vlmax && P.VU.vl != 0; ++i) { \
const reg_t vl = p->VU.vl; \
const reg_t baseAddr = RS1; \
const reg_t rd_num = insn.rd(); \
VI_CHECK_LOAD(elt_width); \
VI_CHECK_LOAD(elt_width, false); \
bool early_stop = false; \
for (reg_t i = p->VU.vstart; i < vl; ++i) { \
VI_STRIP(i); \

6
riscv/encoding.h

@ -1226,6 +1226,10 @@
#define MASK_VSETVLI 0x8000707f
#define MATCH_VSETVL 0x80007057
#define MASK_VSETVL 0xfe00707f
#define MATCH_VLE1_V 0x2b00007
#define MASK_VLE1_V 0xfff0707f
#define MATCH_VSE1_V 0x2b00027
#define MASK_VSE1_V 0xfff0707f
#define MATCH_VLE8_V 0x7
#define MASK_VLE8_V 0x1df0707f
#define MATCH_VLE16_V 0x5007
@ -2889,6 +2893,8 @@ DECLARE_INSN(custom3_rd_rs1, MATCH_CUSTOM3_RD_RS1, MASK_CUSTOM3_RD_RS1)
DECLARE_INSN(custom3_rd_rs1_rs2, MATCH_CUSTOM3_RD_RS1_RS2, MASK_CUSTOM3_RD_RS1_RS2)
DECLARE_INSN(vsetvli, MATCH_VSETVLI, MASK_VSETVLI)
DECLARE_INSN(vsetvl, MATCH_VSETVL, MASK_VSETVL)
DECLARE_INSN(vle1_v, MATCH_VLE1_V, MASK_VLE1_V)
DECLARE_INSN(vse1_v, MATCH_VSE1_V, MASK_VSE1_V)
DECLARE_INSN(vle8_v, MATCH_VLE8_V, MASK_VLE8_V)
DECLARE_INSN(vle16_v, MATCH_VLE16_V, MASK_VLE16_V)
DECLARE_INSN(vle32_v, MATCH_VLE32_V, MASK_VLE32_V)

2
riscv/insns/vle16_v.h

@ -1,2 +1,2 @@
// vle16.v and vlseg[2-8]e16.v
VI_LD(0, (i * nf + fn), int16);
VI_LD(0, (i * nf + fn), int16, false);

2
riscv/insns/vle1_v.h

@ -0,0 +1,2 @@
// vle1.v and vlseg[2-8]e8.v
VI_LD(0, (i * nf + fn), int8, true);

2
riscv/insns/vle32_v.h

@ -1,2 +1,2 @@
// vle32.v and vlseg[2-8]e32.v
VI_LD(0, (i * nf + fn), int32);
VI_LD(0, (i * nf + fn), int32, false);

2
riscv/insns/vle64_v.h

@ -1,2 +1,2 @@
// vle64.v and vlseg[2-8]e64.v
VI_LD(0, (i * nf + fn), int64);
VI_LD(0, (i * nf + fn), int64, false);

2
riscv/insns/vle8_v.h

@ -1,2 +1,2 @@
// vle8.v and vlseg[2-8]e8.v
VI_LD(0, (i * nf + fn), int8);
VI_LD(0, (i * nf + fn), int8, false);

2
riscv/insns/vlse16_v.h

@ -1,2 +1,2 @@
// vlse16.v and vlsseg[2-8]e16.v
VI_LD(i * RS2, fn, int16);
VI_LD(i * RS2, fn, int16, false);

2
riscv/insns/vlse32_v.h

@ -1,2 +1,2 @@
// vlse32.v and vlsseg[2-8]e32.v
VI_LD(i * RS2, fn, int32);
VI_LD(i * RS2, fn, int32, false);

2
riscv/insns/vlse64_v.h

@ -1,2 +1,2 @@
// vlse64.v and vlsseg[2-8]e64.v
VI_LD(i * RS2, fn, int64);
VI_LD(i * RS2, fn, int64, false);

2
riscv/insns/vlse8_v.h

@ -1,2 +1,2 @@
// vlse8.v and vlsseg[2-8]e8.v
VI_LD(i * RS2, fn, int8);
VI_LD(i * RS2, fn, int8, false);

2
riscv/insns/vse16_v.h

@ -1,2 +1,2 @@
// vse16.v and vsseg[2-8]e16.v
VI_ST(0, (i * nf + fn), uint16);
VI_ST(0, (i * nf + fn), uint16, false);

2
riscv/insns/vse1_v.h

@ -0,0 +1,2 @@
// vse1.v
VI_ST(0, (i * nf + fn), uint8, true);

2
riscv/insns/vse32_v.h

@ -1,2 +1,2 @@
// vse32.v and vsseg[2-8]e32.v
VI_ST(0, (i * nf + fn), uint32);
VI_ST(0, (i * nf + fn), uint32, false);

2
riscv/insns/vse64_v.h

@ -1,2 +1,2 @@
// vse64.v and vsseg[2-8]e64.v
VI_ST(0, (i * nf + fn), uint64);
VI_ST(0, (i * nf + fn), uint64, false);

2
riscv/insns/vse8_v.h

@ -1,2 +1,2 @@
// vse8.v and vsseg[2-8]e8.v
VI_ST(0, (i * nf + fn), uint8);
VI_ST(0, (i * nf + fn), uint8, false);

2
riscv/insns/vsse16_v.h

@ -1,2 +1,2 @@
// vsse16v and vssseg[2-8]e16.v
VI_ST(i * RS2, fn, uint16);
VI_ST(i * RS2, fn, uint16, false);

2
riscv/insns/vsse32_v.h

@ -1,2 +1,2 @@
// vsse32.v and vssseg[2-8]e32.v
VI_ST(i * RS2, fn, uint32);
VI_ST(i * RS2, fn, uint32, false);

2
riscv/insns/vsse64_v.h

@ -1,2 +1,2 @@
// vsse64.v and vssseg[2-8]e64.v
VI_ST(i * RS2, fn, uint64);
VI_ST(i * RS2, fn, uint64, false);

2
riscv/insns/vsse8_v.h

@ -1,2 +1,2 @@
// vsse8.v and vssseg[2-8]e8.v
VI_ST(i * RS2, fn, uint8);
VI_ST(i * RS2, fn, uint8, false);

2
riscv/riscv.mk.in

@ -815,6 +815,7 @@ riscv_insn_ext_v_amo = \
vamoxorei64_v \
riscv_insn_ext_v_ldst = \
vle1_v \
vle8_v \
vle16_v \
vle32_v \
@ -851,6 +852,7 @@ riscv_insn_ext_v_ldst = \
vl2re64_v \
vl4re64_v \
vl8re64_v \
vse1_v \
vse8_v \
vse16_v \
vse32_v \

Loading…
Cancel
Save