Skip to content

Commit

Permalink
[RVV 0.7.1] ensure vmsge{u}.vx does not use the same register for t…
Browse files Browse the repository at this point in the history
…emporary and destination (#9)
  • Loading branch information
imkiva authored Aug 29, 2023
1 parent 8231dd1 commit 51e6d19
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3407,7 +3407,9 @@ bool RISCVAsmParser::validateInstruction(MCInst &Inst,
unsigned Opcode = Inst.getOpcode();

if (Opcode == RISCV::PseudoVMSGEU_VX_M_T ||
Opcode == RISCV::PseudoVMSGE_VX_M_T) {
Opcode == RISCV::PseudoVMSGE_VX_M_T ||
Opcode == RISCV::PseudoXVMSGEU_VX_M_T ||
Opcode == RISCV::PseudoXVMSGE_VX_M_T) {
unsigned DestReg = Inst.getOperand(0).getReg();
unsigned TempReg = Inst.getOperand(1).getReg();
if (DestReg == TempReg) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVInstrInfoXTHeadV.td
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ defm XVCOMPRESS_V : VCPR_MV_Mask<"vcompress", 0b010111>;
} // Predicates = [HasVendorXTHeadV]
} // AsmVariantName = "RVV0p71", DecoderNamespace = "RVV0p71"

// Pesudo instructions
// Pseudo instructions
let AsmVariantName = "RVV0p71" in {
let Predicates = [HasVendorXTHeadV] in {
// Vector Integer Comparison Instructions
Expand Down
14 changes: 14 additions & 0 deletions llvm/test/MC/RISCV/rvv0p71/invalid.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# RUN: not llvm-mc -triple=riscv64 --mattr=+xtheadv %s 2>&1 \
# RUN: | FileCheck %s --check-prefix=CHECK-ERROR

vmsge.vx v2, v4, a0, v0.t, v0
# CHECK-ERROR: invalid operand for instruction

vmsgeu.vx v2, v4, a0, v0.t, v0
# CHECK-ERROR: invalid operand for instruction

vmsge.vx v2, v4, a0, v0.t, v2
# CHECK-ERROR: The temporary vector register cannot be the same as the destination register.

vmsgeu.vx v2, v4, a0, v0.t, v2
# CHECK-ERROR: The temporary vector register cannot be the same as the destination register.

0 comments on commit 51e6d19

Please sign in to comment.