[llvm] d3a367d - [RISCV] Give ZEXT_H_RV32 and ZEXT_H_RV64 R-type format to match PACK. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 5 13:31:16 PDT 2024
Author: Craig Topper
Date: 2024-10-05T13:30:55-07:00
New Revision: d3a367dea515f147ac1380afdc286932ccf82eb0
URL: https://github.com/llvm/llvm-project/commit/d3a367dea515f147ac1380afdc286932ccf82eb0
DIFF: https://github.com/llvm/llvm-project/commit/d3a367dea515f147ac1380afdc286932ccf82eb0.diff
LOG: [RISCV] Give ZEXT_H_RV32 and ZEXT_H_RV64 R-type format to match PACK. NFC
These are different than other Zb* unary instructions because
they are specializations of PACKW or PACKH. So they should use
RVInstR instead of RVInstI.
This doesn't cause any functional difference since we only use the
format for relocations and we never have relocations on these
instructions.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
index 3eb1fc68694032..d9ce00c7704de8 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
@@ -224,6 +224,14 @@ def sh3add_uw_op : ComplexPattern<XLenVT, 1, "selectSHXADD_UWOp<3>", [], [], 6>;
// Instruction class templates
//===----------------------------------------------------------------------===//
+let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
+class RVBUnaryR<bits<7> funct7, bits<3> funct3,
+ RISCVOpcode opcode, string opcodestr>
+ : RVInstR<funct7, funct3, opcode, (outs GPR:$rd), (ins GPR:$rs1),
+ opcodestr, "$rd, $rs1"> {
+ let rs2 = 0;
+}
+
let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
class RVBUnary<bits<12> imm12, bits<3> funct3,
RISCVOpcode opcode, string opcodestr>
@@ -392,12 +400,12 @@ def PACKW : ALUW_rr<0b0000100, 0b100, "packw">,
Sched<[WritePACK32, ReadPACK32, ReadPACK32]>;
let Predicates = [HasStdExtZbb, IsRV32] in {
-def ZEXT_H_RV32 : RVBUnary<0b000010000000, 0b100, OPC_OP, "zext.h">,
+def ZEXT_H_RV32 : RVBUnaryR<0b0000100, 0b100, OPC_OP, "zext.h">,
Sched<[WriteIALU, ReadIALU]>;
} // Predicates = [HasStdExtZbb, IsRV32]
let Predicates = [HasStdExtZbb, IsRV64], IsSignExtendingOpW = 1 in {
-def ZEXT_H_RV64 : RVBUnary<0b000010000000, 0b100, OPC_OP_32, "zext.h">,
+def ZEXT_H_RV64 : RVBUnaryR<0b0000100, 0b100, OPC_OP_32, "zext.h">,
Sched<[WriteIALU, ReadIALU]>;
} // Predicates = [HasStdExtZbb, IsRV64]
More information about the llvm-commits
mailing list