[PATCH] D155683: [RISCV] Fix the check assertion in hasMergeOp and hasMaskOp
Jianjian Guan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 20:35:00 PDT 2023
jacquesguan updated this revision to Diff 543803.
jacquesguan added a comment.
Add some enumeration to mark the begin and end of vl op.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155683/new/
https://reviews.llvm.org/D155683
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
Index: llvm/lib/Target/RISCV/RISCVISelLowering.h
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.h
+++ llvm/lib/Target/RISCV/RISCVISelLowering.h
@@ -143,10 +143,11 @@
SM3P0, SM3P1,
// Vector Extension
+ FIRST_VL_VECTOR_OP,
// VMV_V_V_VL matches the semantics of vmv.v.v but includes an extra operand
// for the VL value to be used for the operation. The first operand is
// passthru operand.
- VMV_V_V_VL,
+ VMV_V_V_VL = FIRST_VL_VECTOR_OP,
// VMV_V_X_VL matches the semantics of vmv.v.x but includes an extra operand
// for the VL value to be used for the operation. The first operand is
// passthru operand.
@@ -360,6 +361,8 @@
// vfirst.m with additional mask and VL operands.
VFIRST_VL,
+ LAST_VL_VECTOR_OP = VFIRST_VL,
+
// Reads value of CSR.
// The first operand is a chain pointer. The second specifies address of the
// required CSR. Two results are produced, the read value and the new chain
@@ -405,6 +408,7 @@
STRICT_FSETCC_VL,
STRICT_FSETCCS_VL,
STRICT_VFROUND_NOEXCEPT_VL,
+ LAST_RISCV_STRICTFP_OPCODE = STRICT_VFROUND_NOEXCEPT_VL,
// WARNING: Do not add anything in the end unless you want the node to
// have memop! In fact, starting from FIRST_TARGET_MEMORY_OPCODE all
Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -4726,9 +4726,12 @@
/// Return true if a RISC-V target specified op has a merge operand.
static bool hasMergeOp(unsigned Opcode) {
assert(Opcode > RISCVISD::FIRST_NUMBER &&
- Opcode <= RISCVISD::STRICT_VFROUND_NOEXCEPT_VL &&
+ Opcode <= RISCVISD::LAST_RISCV_STRICTFP_OPCODE &&
"not a RISC-V target specific op");
- assert(RISCVISD::STRICT_VFROUND_NOEXCEPT_VL - RISCVISD::FIRST_NUMBER == 421 &&
+ assert(RISCVISD::LAST_VL_VECTOR_OP - RISCVISD::FIRST_VL_VECTOR_OP == 123 &&
+ RISCVISD::LAST_RISCV_STRICTFP_OPCODE -
+ ISD::FIRST_TARGET_STRICTFP_OPCODE ==
+ 21 &&
"adding target specific op should update this function");
if (Opcode >= RISCVISD::ADD_VL && Opcode <= RISCVISD::FMAXNUM_VL)
return true;
@@ -4744,9 +4747,12 @@
/// Return true if a RISC-V target specified op has a mask operand.
static bool hasMaskOp(unsigned Opcode) {
assert(Opcode > RISCVISD::FIRST_NUMBER &&
- Opcode <= RISCVISD::STRICT_VFROUND_NOEXCEPT_VL &&
+ Opcode <= RISCVISD::LAST_RISCV_STRICTFP_OPCODE &&
"not a RISC-V target specific op");
- assert(RISCVISD::STRICT_VFROUND_NOEXCEPT_VL - RISCVISD::FIRST_NUMBER == 421 &&
+ assert(RISCVISD::LAST_VL_VECTOR_OP - RISCVISD::FIRST_VL_VECTOR_OP == 123 &&
+ RISCVISD::LAST_RISCV_STRICTFP_OPCODE -
+ ISD::FIRST_TARGET_STRICTFP_OPCODE ==
+ 21 &&
"adding target specific op should update this function");
if (Opcode >= RISCVISD::TRUNCATE_VECTOR_VL && Opcode <= RISCVISD::SETCC_VL)
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155683.543803.patch
Type: text/x-patch
Size: 3113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230725/1fa70a94/attachment.bin>
More information about the llvm-commits
mailing list