diff options
Diffstat (limited to 'riscv')
-rw-r--r-- | riscv/decode.h | 32 | ||||
-rw-r--r-- | riscv/insns/vsext_vf2.h | 1 | ||||
-rw-r--r-- | riscv/insns/vsext_vf4.h | 1 | ||||
-rw-r--r-- | riscv/insns/vsext_vf8.h | 1 | ||||
-rw-r--r-- | riscv/insns/vzext_vf2.h | 1 | ||||
-rw-r--r-- | riscv/insns/vzext_vf4.h | 1 | ||||
-rw-r--r-- | riscv/insns/vzext_vf8.h | 1 | ||||
-rw-r--r-- | riscv/riscv.mk.in | 6 |
8 files changed, 44 insertions, 0 deletions
diff --git a/riscv/decode.h b/riscv/decode.h index 4361466..e912789 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -1756,6 +1756,38 @@ for (reg_t i = 0; i < P.VU.vlmax && P.VU.vl != 0; ++i) { \ } \ P.VU.vstart = 0; +// vector: sign/unsiged extension +#define VI_VV_EXT(div, type) \ + reg_t from = P.VU.vsew / div; \ + require(from >= e8 && from <= e64); \ + const reg_t mew = insn.v_mew(); \ + const reg_t width = insn.v_width(); \ + VI_EEW(mew, width); \ + VI_GENERAL_LOOP_BASE \ + switch (((P.VU.vsew >> 3) << 4)| from) { \ + case 0x21: \ + P.VU.elt<type##16_t>(rd_num, i, true) = P.VU.elt<type##8_t>(rs2_num, i); \ + break; \ + case 0x41: \ + P.VU.elt<type##32_t>(rd_num, i, true) = P.VU.elt<type##8_t>(rs2_num, i); \ + break; \ + case 0x81: \ + P.VU.elt<type##64_t>(rd_num, i, true) = P.VU.elt<type##8_t>(rs2_num, i); \ + break; \ + case 0x42: \ + P.VU.elt<type##32_t>(rd_num, i, true) = P.VU.elt<type##16_t>(rs2_num, i); \ + break; \ + case 0x82: \ + P.VU.elt<type##64_t>(rd_num, i, true) = P.VU.elt<type##16_t>(rs2_num, i); \ + break; \ + case 0x84: \ + P.VU.elt<type##64_t>(rd_num, i, true) = P.VU.elt<type##32_t>(rs2_num, i); \ + break; \ + default: \ + break; \ + } \ + VI_LOOP_END + // // vector: vfp helper // diff --git a/riscv/insns/vsext_vf2.h b/riscv/insns/vsext_vf2.h new file mode 100644 index 0000000..16ccfac --- /dev/null +++ b/riscv/insns/vsext_vf2.h @@ -0,0 +1 @@ +VI_VV_EXT(2, int); diff --git a/riscv/insns/vsext_vf4.h b/riscv/insns/vsext_vf4.h new file mode 100644 index 0000000..d4476a3 --- /dev/null +++ b/riscv/insns/vsext_vf4.h @@ -0,0 +1 @@ +VI_VV_EXT(4, int); diff --git a/riscv/insns/vsext_vf8.h b/riscv/insns/vsext_vf8.h new file mode 100644 index 0000000..09fdc2c --- /dev/null +++ b/riscv/insns/vsext_vf8.h @@ -0,0 +1 @@ +VI_VV_EXT(8, int); diff --git a/riscv/insns/vzext_vf2.h b/riscv/insns/vzext_vf2.h new file mode 100644 index 0000000..100f2e3 --- /dev/null +++ b/riscv/insns/vzext_vf2.h @@ -0,0 +1 @@ +VI_VV_EXT(2, uint); diff --git a/riscv/insns/vzext_vf4.h b/riscv/insns/vzext_vf4.h new file mode 100644 index 0000000..6ff920e --- /dev/null +++ b/riscv/insns/vzext_vf4.h @@ -0,0 +1 @@ +VI_VV_EXT(4, uint); diff --git a/riscv/insns/vzext_vf8.h b/riscv/insns/vzext_vf8.h new file mode 100644 index 0000000..b1762fb --- /dev/null +++ b/riscv/insns/vzext_vf8.h @@ -0,0 +1 @@ +VI_VV_EXT(8, uint); diff --git a/riscv/riscv.mk.in b/riscv/riscv.mk.in index 768439f..b11bc8c 100644 --- a/riscv/riscv.mk.in +++ b/riscv/riscv.mk.in @@ -479,6 +479,9 @@ riscv_insn_ext_v_alu_int = \ vsaddu_vx \ vsbc_vvm \ vsbc_vxm \ + vsext_vf2 \ + vsext_vf4 \ + vsext_vf8 \ vslide1down_vx \ vslide1up_vx \ vslidedown_vi \ @@ -542,6 +545,9 @@ riscv_insn_ext_v_alu_int = \ vxor_vi \ vxor_vv \ vxor_vx \ + vzext_vf2 \ + vzext_vf4 \ + vzext_vf8 \ riscv_insn_ext_v_alu_fp = \ vfadd_vf \ |