Skip to content

Commit 5854b39

Browse files
committed
[RISCV] Remove the uret instruction.
This was part of the N extension which did not make it into version 1.12 of the privilege specification. Reviewed By: jrtc27 Differential Revision: https://reviews.llvm.org/D149308
1 parent c266bfe commit 5854b39

File tree

5 files changed

+9
-34
lines changed

5 files changed

+9
-34
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14531,9 +14531,7 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
1453114531
StringRef Kind =
1453214532
MF.getFunction().getFnAttribute("interrupt").getValueAsString();
1453314533

14534-
if (Kind == "user")
14535-
RetOpc = RISCVISD::URET_GLUE;
14536-
else if (Kind == "supervisor")
14534+
if (Kind == "supervisor")
1453714535
RetOpc = RISCVISD::SRET_GLUE;
1453814536
else
1453914537
RetOpc = RISCVISD::MRET_GLUE;
@@ -14607,7 +14605,6 @@ const char *RISCVTargetLowering::getTargetNodeName(unsigned Opcode) const {
1460714605
case RISCVISD::FIRST_NUMBER:
1460814606
break;
1460914607
NODE_NAME_CASE(RET_GLUE)
14610-
NODE_NAME_CASE(URET_GLUE)
1461114608
NODE_NAME_CASE(SRET_GLUE)
1461214609
NODE_NAME_CASE(MRET_GLUE)
1461314610
NODE_NAME_CASE(CALL)

llvm/lib/Target/RISCV/RISCVISelLowering.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ namespace RISCVISD {
2828
enum NodeType : unsigned {
2929
FIRST_NUMBER = ISD::BUILTIN_OP_END,
3030
RET_GLUE,
31-
URET_GLUE,
3231
SRET_GLUE,
3332
MRET_GLUE,
3433
CALL,

llvm/lib/Target/RISCV/RISCVInstrInfo.td

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ def riscv_call : SDNode<"RISCVISD::CALL", SDT_RISCVCall,
5757
SDNPVariadic]>;
5858
def riscv_ret_glue : SDNode<"RISCVISD::RET_GLUE", SDTNone,
5959
[SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>;
60-
def riscv_uret_glue : SDNode<"RISCVISD::URET_GLUE", SDTNone,
61-
[SDNPHasChain, SDNPOptInGlue]>;
6260
def riscv_sret_glue : SDNode<"RISCVISD::SRET_GLUE", SDTNone,
6361
[SDNPHasChain, SDNPOptInGlue]>;
6462
def riscv_mret_glue : SDNode<"RISCVISD::MRET_GLUE", SDTNone,
@@ -822,12 +820,6 @@ def SRAW : ALUW_rr<0b0100000, 0b101, "sraw">,
822820
//===----------------------------------------------------------------------===//
823821

824822
let isBarrier = 1, isReturn = 1, isTerminator = 1 in {
825-
def URET : Priv<"uret", 0b0000000>, Sched<[]> {
826-
let rd = 0;
827-
let rs1 = 0;
828-
let rs2 = 0b00010;
829-
}
830-
831823
def SRET : Priv<"sret", 0b0001000>, Sched<[]> {
832824
let rd = 0;
833825
let rs1 = 0;
@@ -1562,7 +1554,6 @@ def PseudoCALL : Pseudo<(outs), (ins call_symbol:$func), []>,
15621554
def : Pat<(riscv_call tglobaladdr:$func), (PseudoCALL tglobaladdr:$func)>;
15631555
def : Pat<(riscv_call texternalsym:$func), (PseudoCALL texternalsym:$func)>;
15641556

1565-
def : Pat<(riscv_uret_glue), (URET X0, X0)>;
15661557
def : Pat<(riscv_sret_glue), (SRET X0, X0)>;
15671558
def : Pat<(riscv_mret_glue), (MRET X0, X0)>;
15681559

llvm/test/CodeGen/RISCV/interrupt-attr.ll

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,16 @@
1414
; RUN: 2>&1 | FileCheck %s -check-prefix CHECK -check-prefix CHECK-RV64-FD
1515

1616
;
17-
; Checking for special return instructions (uret, sret, mret).
17+
; Checking for special return instructions (sret, mret).
1818
;
19-
define void @foo_user() #0 {
20-
; CHECK-LABEL: foo_user:
21-
; CHECK: # %bb.0:
22-
; CHECK-NEXT: uret
23-
ret void
24-
}
25-
26-
define void @foo_supervisor() #1 {
19+
define void @foo_supervisor() #0 {
2720
; CHECK-LABEL: foo_supervisor:
2821
; CHECK: # %bb.0:
2922
; CHECK-NEXT: sret
3023
ret void
3124
}
3225

33-
define void @foo_machine() #2 {
26+
define void @foo_machine() #1 {
3427
; CHECK-LABEL: foo_machine:
3528
; CHECK: # %bb.0:
3629
; CHECK-NEXT: mret
@@ -49,7 +42,7 @@ define void @foo_machine() #2 {
4942
;
5043

5144
declare i32 @otherfoo(...)
52-
define void @foo_with_call() #2 {
45+
define void @foo_with_call() #1 {
5346
;
5447
; CHECK-RV32-LABEL: foo_with_call:
5548
; CHECK-RV32: # %bb.0:
@@ -547,7 +540,7 @@ define void @foo_with_call() #2 {
547540
;
548541
; Additionally check frame pointer and return address are properly saved.
549542
;
550-
define void @foo_fp_with_call() #3 {
543+
define void @foo_fp_with_call() #2 {
551544
;
552545
; CHECK-RV32-LABEL: foo_fp_with_call:
553546
; CHECK-RV32: # %bb.0:
@@ -1060,7 +1053,6 @@ define void @foo_fp_with_call() #3 {
10601053
ret void
10611054
}
10621055

1063-
attributes #0 = { nounwind "interrupt"="user" }
1064-
attributes #1 = { nounwind "interrupt"="supervisor" }
1065-
attributes #2 = { nounwind "interrupt"="machine" }
1066-
attributes #3 = { nounwind "interrupt"="machine" "frame-pointer"="all" }
1056+
attributes #0 = { nounwind "interrupt"="supervisor" }
1057+
attributes #1 = { nounwind "interrupt"="machine" }
1058+
attributes #2 = { nounwind "interrupt"="machine" "frame-pointer"="all" }

llvm/test/MC/RISCV/priv-valid.s

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
# RUN: | llvm-objdump --mattr=+svinval -M no-aliases -d - \
1010
# RUN: | FileCheck -check-prefix=CHECK-INST %s
1111

12-
# CHECK-INST: uret
13-
# CHECK: encoding: [0x73,0x00,0x20,0x00]
14-
uret
15-
1612
# CHECK-INST: sret
1713
# CHECK: encoding: [0x73,0x00,0x20,0x10]
1814
sret

0 commit comments

Comments
 (0)