[llvm] d5f94c3 - Revert "[RISCV] Strengthen register usage validation for XTheadMemPair loads (#136241)"
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 17 21:28:33 PDT 2025
Author: Fangrui Song
Date: 2025-04-17T21:28:28-07:00
New Revision: d5f94c3915ace438359524b40cf84f3f54a0afae
URL: https://github.com/llvm/llvm-project/commit/d5f94c3915ace438359524b40cf84f3f54a0afae
DIFF: https://github.com/llvm/llvm-project/commit/d5f94c3915ace438359524b40cf84f3f54a0afae.diff
LOG: Revert "[RISCV] Strengthen register usage validation for XTheadMemPair loads (#136241)"
This reverts commit a354564a64c6ab3cafa9e5e2b31f7f14d4e27d45.
Broke tests
Added:
Modified:
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/test/MC/RISCV/rv32xtheadmempair-invalid.s
llvm/test/MC/RISCV/rv64xtheadmempair-invalid.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index db9ec7ae1df02..32751782e08d4 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -3656,9 +3656,9 @@ bool RISCVAsmParser::validateInstruction(MCInst &Inst,
MCRegister Rd2 = Inst.getOperand(1).getReg();
MCRegister Rs1 = Inst.getOperand(2).getReg();
// The encoding with rd1 == rd2 == rs1 is reserved for XTHead load pair.
- if (Rs1 == Rd1 || Rs1 == Rd2 || Rd1 == Rd2) {
+ if (Rs1 == Rd1 && Rs1 == Rd2) {
SMLoc Loc = Operands[1]->getStartLoc();
- return Error(Loc, "rs1, rd1, and rd2 cannot overlap");
+ return Error(Loc, "rs1, rd1, and rd2 cannot all be the same");
}
}
diff --git a/llvm/test/MC/RISCV/rv32xtheadmempair-invalid.s b/llvm/test/MC/RISCV/rv32xtheadmempair-invalid.s
index 8a7202ffd375e..a9223ae128a40 100644
--- a/llvm/test/MC/RISCV/rv32xtheadmempair-invalid.s
+++ b/llvm/test/MC/RISCV/rv32xtheadmempair-invalid.s
@@ -15,7 +15,6 @@ th.lwd a3, a4, (a5), 3, 5 # CHECK: [[@LINE]]:25: error: operand must be consta
th.swd t3, t4, (t5), 5, 4 # CHECK: [[@LINE]]:22: error: immediate must be an integer in the range [0, 3]
th.swd t3, t4, (t5) # CHECK: [[@LINE]]:1: error: too few operands for instruction
th.swd t3, t4, (t5), 3, 5 # CHECK: [[@LINE]]:25: error: operand must be constant 3
-th.lwd x6, x7, (x7), 2, 3 # CHECK: [[@LINE]]:8: error: rs1, rd1, and rd2 cannot overlap
-th.lwud x6, x6, (x6), 2, 3 # CHECK: [[@LINE]]:9: error: rs1, rd1, and rd2 cannot overlap
+th.lwud x6, x6, (x6), 2, 3 # CHECK: [[@LINE]]:9: error: rs1, rd1, and rd2 cannot all be the same
th.ldd t0, t1, (t2), 2, 4 # CHECK: [[@LINE]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
th.sdd t0, t1, (t2), 2, 4 # CHECK: [[@LINE]]:1: error: instruction requires the following: RV64I Base Instruction Set{{$}}
diff --git a/llvm/test/MC/RISCV/rv64xtheadmempair-invalid.s b/llvm/test/MC/RISCV/rv64xtheadmempair-invalid.s
index bbd0118630fbb..342db21bbca62 100644
--- a/llvm/test/MC/RISCV/rv64xtheadmempair-invalid.s
+++ b/llvm/test/MC/RISCV/rv64xtheadmempair-invalid.s
@@ -15,5 +15,4 @@ th.lwd a3, a4, (a5), 3, 5 # CHECK: [[@LINE]]:25: error: operand must be consta
th.swd t3, t4, (t5), 5, 4 # CHECK: [[@LINE]]:22: error: immediate must be an integer in the range [0, 3]
th.swd t3, t4, (t5) # CHECK: [[@LINE]]:1: error: too few operands for instruction
th.swd t3, t4, (t5), 3, 5 # CHECK: [[@LINE]]:25: error: operand must be constant 3
-th.ldd x6, x6, (x7), 2, 3 # CHECK: [[@LINE]]:8: error: rs1, rd1, and rd2 cannot overlap
-th.lwud x6, x6, (x6), 2, 3 # CHECK: [[@LINE]]:9: error: rs1, rd1, and rd2 cannot overlap
+th.lwud x6, x6, (x6), 2, 3 # CHECK: [[@LINE]]:9: error: rs1, rd1, and rd2 cannot all be the same
More information about the llvm-commits
mailing list