Skip to content

Commit

Permalink
zvk: Check VR index alignment constraint and vm constraint
Browse files Browse the repository at this point in the history
The vector specification requires aligning the VR index regarding the
LMUL. Also, it requires that vd cannot be v0 when masking.

Although the vector crypto specification does not explicitly state those
two constraints, the deriving extension should include the general
constraints from the vector specification.

This commit checks the VR index and vm constraints on Zvk instructions.
  • Loading branch information
YenHaoChen committed Oct 24, 2024
1 parent 88fc84d commit b6c7855
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions riscv/zvk_ext_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@
//
#define VI_ZVK_VD_VS1_VS2_EGU32x4_NOVM_LOOP(PRELUDE, EG_BODY) \
do { \
VI_CHECK_SSS(true); \
require_element_groups_32x4; \
require_no_vmask; \
const reg_t vd_num = insn.rd(); \
Expand Down Expand Up @@ -331,6 +332,7 @@
//
#define VI_ZVK_VD_VS1_VS2_EGU32x8_NOVM_LOOP(PRELUDE, EG_BODY) \
do { \
VI_CHECK_SSS(true); \
require_element_groups_32x8;; \
require_no_vmask; \
const reg_t vd_num = insn.rd(); \
Expand Down Expand Up @@ -397,6 +399,7 @@
PRELOOP, \
EG_BODY) \
do { \
VI_CHECK_SSS(true); \
require_element_groups_32x4; \
require_no_vmask; \
const reg_t vd_num = insn.rd(); \
Expand Down Expand Up @@ -466,6 +469,7 @@
PRELOOP, \
EG_BODY) \
do { \
VI_CHECK_SSS(false); \
require_element_groups_32x4; \
require_no_vmask; \
const reg_t vd_num = insn.rd(); \
Expand Down Expand Up @@ -515,6 +519,7 @@
//
#define VI_ZVK_VD_VS2_EGU32x4_NOVM_LOOP(PRELUDE, EG_BODY) \
do { \
VI_CHECK_SSS(false); \
require_element_groups_32x4; \
require_no_vmask; \
const reg_t vd_num = insn.rd(); \
Expand Down Expand Up @@ -567,6 +572,7 @@
//
#define VI_ZVK_VD_VS2_ZIMM5_EGU32x4_NOVM_LOOP(PRELUDE, PRELOOP, EG_BODY) \
do { \
VI_CHECK_SSS(false); \
require_element_groups_32x4; \
require_no_vmask; \
const reg_t vd_num = insn.rd(); \
Expand Down Expand Up @@ -623,6 +629,7 @@
//
#define VI_ZVK_VD_VS2_ZIMM5_EGU32x8_NOVM_LOOP(PRELUDE, PRELOOP, EG_BODY) \
do { \
VI_CHECK_SSS(false); \
require_element_groups_32x8; \
require_no_vmask; \
const reg_t vd_num = insn.rd(); \
Expand Down Expand Up @@ -680,6 +687,7 @@
// in the 'vs2' vector register / vector register group.
#define VI_ZVK_VD_VS1_VS2_EGU64x4_NOVM_LOOP(PRELUDE, EG_BODY) \
do { \
VI_CHECK_SSS(true); \
require_element_groups_64x4; \
require_no_vmask; \
const reg_t vd_num = insn.rd(); \
Expand Down

0 comments on commit b6c7855

Please sign in to comment.