File tree Expand file tree Collapse file tree 2 files changed +52
-14
lines changed
Expand file tree Collapse file tree 2 files changed +52
-14
lines changed Original file line number Diff line number Diff line change 1+ # yaml-language-server: $schema=../../../schemas/inst_schema.json
2+
3+ $schema : " inst_schema.json#"
4+ kind : instruction
5+ name : fence.tso
6+ long_name : Memory ordering fence, total store ordering
7+ description : |
8+ Orders memory operations.
9+
10+ `fence.tso` orders all load operations
11+ in its predecessor set before all memory operations in its successor set, and all store operations
12+ in its predecessor set before all store operations in its successor set. This leaves non-AMO store
13+ operations in the 'fence.tso's predecessor set unordered with non-AMO loads in its successor set.
14+
15+ The `rs1` and `rd` fields are unused and ignored.
16+
17+ In modes other than M-mode, `fence.tso` is further affected by `menvcfg.FIOM`,
18+ `senvcfg.FIOM`<% if ext?(:H) % >, and/or `henvcfg.FIOM`<% end % >.
19+
20+ definedBy : I
21+ assembly : " "
22+ encoding :
23+ match : 100000110011-----000-----0001111
24+ variables :
25+ - name : rs1
26+ location : 19-15
27+ - name : rd
28+ location : 11-7
29+ access :
30+ s : always
31+ u : always
32+ vs : always
33+ vu : always
34+ operation() : |
35+ fence_tso();
36+
37+ sail() : |
38+ {
39+ match (pred, succ) {
40+ (_ : bits(2) @ 0b11, _ : bits(2) @ 0b11) => sail_barrier(Barrier_RISCV_tso),
41+ (_ : bits(2) @ 0b00, _ : bits(2) @ 0b00) => (),
42+
43+ _ => { print("FIXME: unsupported fence");
44+ () }
45+ };
46+ RETIRE_SUCCESS
47+ }
Original file line number Diff line number Diff line change @@ -141,17 +141,10 @@ access:
141141 vs : always
142142 vu : always
143143operation() : |
144- Boolean is_fence_tso;
145144 Boolean is_pause;
146145
147- if (fm == 1) {
148- if (pred == 0x3 && succ == 0x3) {
149- # this is a fence.tso instruction
150- is_fence_tso = true;
151- }
152- }
153146 if (implemented?(ExtensionName::Zihintpause)) {
154- if ((pred == 1) && (succ == 0) && (fm == 0) && ( xd == 0) && (xs1 == 0)) {
147+ if ((pred == 1) && (succ == 0) && (xd == 0) && (xs1 == 0)) {
155148 # this is a PAUSE instruction
156149 is_pause = true;
157150 }
@@ -167,9 +160,7 @@ operation(): |
167160 Boolean succ_r = succ[1] == 1;
168161 Boolean succ_w = succ[0] == 1;
169162
170- if (is_fence_tso) {
171- fence_tso();
172- } else if (is_pause) {
163+ if (is_pause) {
173164 pause();
174165 } else {
175166
@@ -202,10 +193,10 @@ operation(): |
202193 succ_i, succ_o, succ_r, succ_w
203194 );
204195 }
196+ hints :
197+ - { $ref: inst/I/fence.tso.yaml# }
205198pseudoinstructions :
206- - when : (pred == 0x3) && (succ == 0x3) && (fm == 1)
207- to : fence.tso
208- - when : (pred == 1) && (succ == 0) && (fm == 0) && (xd == 0) && (xs1 == 0)
199+ - when : (pred == 1) && (succ == 0) && (xd == 0) && (xs1 == 0)
209200 to : pause
210201
211202# SPDX-SnippetBegin
You can’t perform that action at this time.
0 commit comments