diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoP.td b/llvm/lib/Target/RISCV/RISCVInstrInfoP.td index 170672200192c..ff48f0601fa76 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoP.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoP.td @@ -44,9 +44,8 @@ def simm10_unsigned : RISCVOp { //===----------------------------------------------------------------------===// let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in -class RVPLoadImm10 funct7, string opcodestr, - DAGOperand TyImm10 = simm10> - : RVInst<(outs GPR:$rd), (ins TyImm10:$imm10), opcodestr, "$rd, $imm10", [], +class PLI_i funct7, string opcodestr> + : RVInst<(outs GPR:$rd), (ins simm10:$imm10), opcodestr, "$rd, $imm10", [], InstFormatOther> { bits<10> imm10; bits<5> rd; @@ -60,7 +59,22 @@ class RVPLoadImm10 funct7, string opcodestr, } let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in -class RVPLoadImm8 funct8, string opcodestr> +class PLUI_i funct7, string opcodestr> + : RVInst<(outs GPR:$rd), (ins simm10_unsigned:$imm10), opcodestr, + "$rd, $imm10", [], InstFormatOther> { + bits<10> imm10; + bits<5> rd; + + let Inst{31-25} = funct7; + let Inst{24} = imm10{0}; + let Inst{23-15} = imm10{9-1}; + let Inst{14-12} = 0b010; + let Inst{11-7} = rd; + let Inst{6-0} = OPC_OP_IMM_32.Value; +} + +let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in +class PLI_B_i funct8, string opcodestr> : RVInst<(outs GPR:$rd), (ins uimm8:$uimm8), opcodestr, "$rd, $uimm8", [], InstFormatOther> { bits<8> uimm8; @@ -148,11 +162,11 @@ def PSSLAI_W : RVPUnaryImm5<0b101, "psslai.w">; } // Predicates = [HasStdExtP, IsRV64] let Predicates = [HasStdExtP] in -def PLI_H : RVPLoadImm10<0b1011000, "pli.h">; +def PLI_H : PLI_i<0b1011000, "pli.h">; let Predicates = [HasStdExtP, IsRV64] in -def PLI_W : RVPLoadImm10<0b1011001, "pli.w">; +def PLI_W : PLI_i<0b1011001, "pli.w">; let Predicates = [HasStdExtP] in -def PLI_B : RVPLoadImm8<0b10110100, "pli.b">; +def PLI_B : PLI_B_i<0b10110100, "pli.b">; let Predicates = [HasStdExtP] in { def PSEXT_H_B : RVPUnaryWUF<0b00, 0b00100, "psext.h.b">; @@ -165,6 +179,6 @@ def PSEXT_W_H : RVPUnaryWUF<0b01, 0b00101, "psext.w.h">; } // Predicates = [HasStdExtP, IsRV64] let Predicates = [HasStdExtP] in -def PLUI_H : RVPLoadImm10<0b1111000, "plui.h", simm10_unsigned>; +def PLUI_H : PLUI_i<0b1111000, "plui.h">; let Predicates = [HasStdExtP, IsRV64] in -def PLUI_W : RVPLoadImm10<0b1111001, "plui.w", simm10_unsigned>; +def PLUI_W : PLUI_i<0b1111001, "plui.w">; diff --git a/llvm/test/MC/RISCV/rv32p-valid.s b/llvm/test/MC/RISCV/rv32p-valid.s index c259c142f92b2..ffff0f25642a3 100644 --- a/llvm/test/MC/RISCV/rv32p-valid.s +++ b/llvm/test/MC/RISCV/rv32p-valid.s @@ -71,8 +71,8 @@ psabs.h a1, a2 # CHECK-ASM: encoding: [0x9b,0x22,0x73,0xe4] psabs.b t0, t1 # CHECK-ASM-AND-OBJ: plui.h gp, 32 -# CHECK-ASM: encoding: [0x9b,0x21,0x20,0xf0] +# CHECK-ASM: encoding: [0x9b,0x21,0x08,0xf0] plui.h gp, 32 # CHECK-ASM-AND-OBJ: plui.h gp, -412 -# CHECK-ASM: encoding: [0x9b,0xa1,0x64,0xf0] +# CHECK-ASM: encoding: [0x9b,0x21,0x99,0xf0] plui.h gp, 612 diff --git a/llvm/test/MC/RISCV/rv64p-valid.s b/llvm/test/MC/RISCV/rv64p-valid.s index 3ea6b00bbe11c..a0d6eadfb6c30 100644 --- a/llvm/test/MC/RISCV/rv64p-valid.s +++ b/llvm/test/MC/RISCV/rv64p-valid.s @@ -95,13 +95,13 @@ psabs.h t1, t5 # CHECK-ASM: encoding: [0x1b,0x25,0x79,0xe4] psabs.b a0, s2 # CHECK-ASM-AND-OBJ: plui.h s2, 4 -# CHECK-ASM: encoding: [0x1b,0x29,0x04,0xf0] +# CHECK-ASM: encoding: [0x1b,0x29,0x01,0xf0] plui.h s2, 4 # CHECK-ASM-AND-OBJ: plui.h gp, -412 -# CHECK-ASM: encoding: [0x9b,0xa1,0x64,0xf0] +# CHECK-ASM: encoding: [0x9b,0x21,0x99,0xf0] plui.h gp, 612 # CHECK-ASM-AND-OBJ: plui.w a2, 1 -# CHECK-ASM: encoding: [0x1b,0x26,0x01,0xf2] +# CHECK-ASM: encoding: [0x1b,0x26,0x00,0xf3] plui.w a2, 1 # CHECK-ASM-AND-OBJ: plui.w a2, -1 # CHECK-ASM: encoding: [0x1b,0xa6,0xff,0xf3]