-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[RISCV] Add Smrnmi extension #111668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RISCV] Add Smrnmi extension #111668
Changes from 14 commits
c7a9b55
91125a1
6014139
8706286
6844754
7922fbb
c8fccb5
3d6f0fe
805fd8a
35588a3
f497950
7db01e7
29eaa52
3c5f6d1
1858bed
dedaf01
3086afc
95567b3
88dfe2b
1350674
116aa08
e077536
6249ffb
2452b33
5a58844
769d395
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -931,6 +931,10 @@ def FeatureStdExtSmepmp | |
: RISCVExtension<"smepmp", 1, 0, | ||
"'Smepmp' (Enhanced Physical Memory Protection)">; | ||
|
||
def FeatureStdExtSmrnmi | ||
: RISCVExtension<"smrnmi", 1, 0, | ||
"'Smrnmi' (Extension for Resumable Non-Maskable Interrupts)">; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we usually write "Extension for" in the description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I have deleted the relevant content. |
||
|
||
def FeatureStdExtSmcdeleg | ||
: RISCVExtension<"smcdeleg", 1, 0, | ||
"'Smcdeleg' (Counter Delegation Machine Level)">; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,8 @@ def riscv_sret_glue : SDNode<"RISCVISD::SRET_GLUE", SDTNone, | |
[SDNPHasChain, SDNPOptInGlue]>; | ||
def riscv_mret_glue : SDNode<"RISCVISD::MRET_GLUE", SDTNone, | ||
[SDNPHasChain, SDNPOptInGlue]>; | ||
def riscv_mnret_glue : SDNode<"RISCVISD::MNRET_GLUE", SDTNone, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be in another patch for CodeGen. And, do we really need it? It will only be used in supervisor IIUC. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RISCVISD::MNRET_GLUE isn't defined in this patch so it should definitely be removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I have removed the relevant content. |
||
[SDNPHasChain, SDNPOptInGlue]>; | ||
def riscv_selectcc : SDNode<"RISCVISD::SELECT_CC", SDT_RISCVSelectCC>; | ||
def riscv_brcc : SDNode<"RISCVISD::BR_CC", SDT_RISCVBrCC, | ||
[SDNPHasChain]>; | ||
|
@@ -813,6 +815,12 @@ def MRET : Priv<"mret", 0b0011000>, Sched<[]> { | |
let rs1 = 0; | ||
let rs2 = 0b00010; | ||
} | ||
|
||
def MNRET : Priv<"mnret", 0b0111000>, Sched<[]> { | ||
lenary marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let rd = 0; | ||
let rs1 = 0; | ||
let rs2 = 0b00010; | ||
} | ||
} // isBarrier = 1, isReturn = 1, isTerminator = 1 | ||
|
||
def WFI : Priv<"wfi", 0b0001000>, Sched<[]> { | ||
|
@@ -1581,6 +1589,7 @@ def : Pat<(riscv_call texternalsym:$func), (PseudoCALL texternalsym:$func)>; | |
|
||
def : Pat<(riscv_sret_glue), (SRET)>; | ||
def : Pat<(riscv_mret_glue), (MRET)>; | ||
def : Pat<(riscv_mnret_glue), (MNRET)>; | ||
|
||
let isCall = 1, Defs = [X1] in { | ||
let Predicates = [NoStdExtZicfilp] in | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1913,6 +1913,66 @@ csrrs t1, mhpmcounter31, zero | |
csrrs t2, 0xB1F, zero | ||
|
||
|
||
###################################### | ||
# Machine Counter Setup | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Section title is incorrect. The registers are already tested in rv32-machine-csr-names.s but they should be in this file. That was a mistake. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I haven't made any modifications to the content of this file |
||
###################################### | ||
# mnscratch | ||
# name | ||
# CHECK-INST: csrrs t1, mnscratch, zero | ||
# CHECK-ENC: encoding: [0x73,0x23,0x00,0x74] | ||
# CHECK-INST-ALIAS: csrr t1, mnscratch | ||
# uimm12 | ||
# CHECK-INST: csrrs t2, mnscratch, zero | ||
# CHECK-ENC: encoding: [0xf3,0x23,0x00,0x74] | ||
# CHECK-INST-ALIAS: csrr t2, mnscratch | ||
# name | ||
csrrs t1, mnscratch, zero | ||
# uimm12 | ||
csrrs t2, 0x740, zero | ||
|
||
# mnepc | ||
# name | ||
# CHECK-INST: csrrs t1, mnepc, zero | ||
# CHECK-ENC: encoding: [0x73,0x23,0x10,0x74] | ||
# CHECK-INST-ALIAS: csrr t1, mnepc | ||
# uimm12 | ||
# CHECK-INST: csrrs t2, mnepc, zero | ||
# CHECK-ENC: encoding: [0xf3,0x23,0x10,0x74] | ||
# CHECK-INST-ALIAS: csrr t2, mnepc | ||
# name | ||
csrrs t1, mnepc, zero | ||
# uimm12 | ||
csrrs t2, 0x741, zero | ||
|
||
# mncause | ||
# name | ||
# CHECK-INST: csrrs t1, mncause, zero | ||
# CHECK-ENC: encoding: [0x73,0x23,0x20,0x74] | ||
# CHECK-INST-ALIAS: csrr t1, mncause | ||
# uimm12 | ||
# CHECK-INST: csrrs t2, mncause, zero | ||
# CHECK-ENC: encoding: [0xf3,0x23,0x20,0x74] | ||
# CHECK-INST-ALIAS: csrr t2, mncause | ||
# name | ||
csrrs t1, mncause, zero | ||
# uimm12 | ||
csrrs t2, 0x742, zero | ||
|
||
# mnstatus | ||
# name | ||
# CHECK-INST: csrrs t1, mnstatus, zero | ||
# CHECK-ENC: encoding: [0x73,0x23,0x40,0x74] | ||
# CHECK-INST-ALIAS: csrr t1, mnstatus | ||
# uimm12 | ||
# CHECK-INST: csrrs t2, mnstatus, zero | ||
# CHECK-ENC: encoding: [0xf3,0x23,0x40,0x74] | ||
# CHECK-INST-ALIAS: csrr t2, mnstatus | ||
# name | ||
csrrs t1, mnstatus, zero | ||
# uimm12 | ||
csrrs t2, 0x744, zero | ||
|
||
|
||
###################################### | ||
# Machine Counter Setup | ||
###################################### | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be "Assembly Support" - some of the other
*ret
instructions have support in clang for__attribute((interrupt(<kind>)))
which doesn't yet exist formnret
- there's no obligation to add this support in the first PR, but this should mean no one expects it has the same level of featureas as the other*ret
instructions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks for your help.