diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -573,6 +573,12 @@ let rs1 = 0; let rs2 = 0b00010; } + +def DRET : Priv<"dret", 0b0111101>, Sched<[]> { + let rd = 0; + let rs1 = 0; + let rs2 = 0b10010; +} } // isBarrier = 1, isReturn = 1, isTerminator = 1 def WFI : Priv<"wfi", 0b0001000>, Sched<[]> { diff --git a/llvm/test/MC/RISCV/priv-valid.s b/llvm/test/MC/RISCV/priv-valid.s --- a/llvm/test/MC/RISCV/priv-valid.s +++ b/llvm/test/MC/RISCV/priv-valid.s @@ -21,6 +21,10 @@ # CHECK: encoding: [0x73,0x00,0x20,0x30] mret +# CHECK-INST: dret +# CHECK: encoding: [0x73,0x00,0x20,0x7b] +dret + # CHECK-INST: wfi # CHECK: encoding: [0x73,0x00,0x50,0x10] wfi