Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Jul 3, 2024
1 parent 6e4ec54 commit 68ef9fa
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
8 changes: 4 additions & 4 deletions spectec/src/backend-interpreter/runner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ let get_externval import =

let textual_to_module textual =
match (snd textual).it with
| Script.Textual m -> m
| Script.Textual (m, _) -> m
| _ -> assert false

let get_export_addr name modulename =
Expand Down Expand Up @@ -139,9 +139,9 @@ let instantiate module_ =

let module_of_def def =
match def.it with
| Textual m -> m
| Encoded (name, bs) -> Decode.decode name bs
| Quoted (_, s) -> Parse.Module.parse_string s |> textual_to_module
| Textual (m, _) -> m
| Encoded (name, bs) -> Decode.decode name bs.it
| Quoted (_, s) -> Parse.Module.parse_string s.it |> textual_to_module

let run_action action =
match action.it with
Expand Down
8 changes: 4 additions & 4 deletions spectec/test-frontend/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -4582,17 +4582,17 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1087.1-1090.34
;; 6-typing.watsup:1087.1-1090.35
rule vload-zero{C : context, N : N, x : idx, memarg : memarg, mt : memtype}:
`%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1092.1-1096.21
rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:1098.1-1101.46
Expand All @@ -4605,7 +4605,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:524.1-524.96
Expand Down
6 changes: 3 additions & 3 deletions spectec/test-latex/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -6478,7 +6478,7 @@ $$
\frac{
C{.}\mathsf{mems}{}[x] = {\mathit{mt}}
\qquad
{2^{{\mathit{memarg}}{.}\mathsf{align}}} < N / 8
{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq N / 8
}{
C \vdash {\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{{N}{\mathsf{\_}}{\mathsf{zero}}}~x~{\mathit{memarg}} : \mathsf{i{\scriptstyle 32}} \rightarrow \mathsf{v{\scriptstyle 128}}
} \, {[\textsc{\scriptsize T{-}vload{-}zero}]}
Expand All @@ -6491,7 +6491,7 @@ $$
\frac{
C{.}\mathsf{mems}{}[x] = {\mathit{mt}}
\qquad
{2^{{\mathit{memarg}}{.}\mathsf{align}}} < N / 8
{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq N / 8
\qquad
i < 128 / N
}{
Expand Down Expand Up @@ -6519,7 +6519,7 @@ $$
\frac{
C{.}\mathsf{mems}{}[x] = {\mathit{mt}}
\qquad
{2^{{\mathit{memarg}}{.}\mathsf{align}}} < N / 8
{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq N / 8
\qquad
i < 128 / N
}{
Expand Down
40 changes: 20 additions & 20 deletions spectec/test-middlend/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -4572,17 +4572,17 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1087.1-1090.34
;; 6-typing.watsup:1087.1-1090.35
rule vload-zero{C : context, N : N, x : idx, memarg : memarg, mt : memtype}:
`%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1092.1-1096.21
rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:1098.1-1101.46
Expand All @@ -4595,7 +4595,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:524.1-524.96
Expand Down Expand Up @@ -10999,17 +10999,17 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1087.1-1090.34
;; 6-typing.watsup:1087.1-1090.35
rule vload-zero{C : context, N : N, x : idx, memarg : memarg, mt : memtype}:
`%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1092.1-1096.21
rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:1098.1-1101.46
Expand All @@ -11022,7 +11022,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:524.1-524.96
Expand Down Expand Up @@ -17426,17 +17426,17 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1087.1-1090.34
;; 6-typing.watsup:1087.1-1090.35
rule vload-zero{C : context, N : N, x : idx, memarg : memarg, mt : memtype}:
`%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1092.1-1096.21
rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:1098.1-1101.46
Expand All @@ -17449,7 +17449,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([])))
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:524.1-524.96
Expand Down Expand Up @@ -23945,19 +23945,19 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1087.1-1090.34
;; 6-typing.watsup:1087.1-1090.35
rule vload-zero{C : context, N : N, x : idx, memarg : memarg, mt : memtype}:
`%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (x!`%`_idx.0 < |C.MEMS_context|)
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))

;; 6-typing.watsup:1092.1-1096.21
rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (x!`%`_idx.0 < |C.MEMS_context|)
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:1098.1-1101.46
Expand All @@ -23972,7 +23972,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
`%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([])))
-- if (x!`%`_idx.0 < |C.MEMS_context|)
-- if (C.MEMS_context[x!`%`_idx.0] = mt)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))

;; 6-typing.watsup:524.1-524.96
Expand Down Expand Up @@ -30567,18 +30567,18 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- where mt = C.MEMS_context[x!`%`_idx.0]

;; 6-typing.watsup:1087.1-1090.34
;; 6-typing.watsup:1087.1-1090.35
rule vload-zero{C : context, N : N, x : idx, memarg : memarg, mt : memtype}:
`%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([I32_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (x!`%`_idx.0 < |C.MEMS_context|)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- where mt = C.MEMS_context[x!`%`_idx.0]

;; 6-typing.watsup:1092.1-1096.21
rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([V128_valtype])))
-- if (x!`%`_idx.0 < |C.MEMS_context|)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))
-- where mt = C.MEMS_context[x!`%`_idx.0]

Expand All @@ -30593,7 +30593,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype)
rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : nat, mt : memtype}:
`%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, `%`_laneidx(i)), `%->_%%`_instrtype(`%`_resulttype([I32_valtype V128_valtype]), [], `%`_resulttype([])))
-- if (x!`%`_idx.0 < |C.MEMS_context|)
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) < (N / 8))
-- if ((2 ^ memarg.ALIGN_memarg!`%`_u32.0) <= (N / 8))
-- if (i < (128 / N))
-- where mt = C.MEMS_context[x!`%`_idx.0]

Expand Down
8 changes: 4 additions & 4 deletions spectec/test-prose/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ validation_of_VLOAD V128 ?((SHAPE M N sx)) memarg
validation_of_VLOAD_LANE V128 n memarg laneidx
- |C.MEMS| must be greater than 0.
- (2 ^ memarg.ALIGN) must be less than (n / 8).
- (2 ^ memarg.ALIGN) must be less than or equal to (n / 8).
- laneidx must be less than (128 / n).
- Let mt be C.MEMS[0].
- The instruction is valid with type ([I32, V128] -> [V128]).
Expand All @@ -1532,7 +1532,7 @@ validation_of_VSTORE V128 memarg
validation_of_VSTORE_LANE V128 n memarg laneidx
- |C.MEMS| must be greater than 0.
- (2 ^ memarg.ALIGN) must be less than (n / 8).
- (2 ^ memarg.ALIGN) must be less than or equal to (n / 8).
- laneidx must be less than (128 / n).
- Let mt be C.MEMS[0].
- The instruction is valid with type ([I32, V128] -> []).
Expand Down Expand Up @@ -4149,7 +4149,7 @@ validation_of_VLOAD V128 ?() x memarg
validation_of_VLOAD_LANE V128 N x memarg i
- |C.MEMS| must be greater than x.
- (2 ^ memarg.ALIGN) must be less than (N / 8).
- (2 ^ memarg.ALIGN) must be less than or equal to (N / 8).
- i must be less than (128 / N).
- Let mt be C.MEMS[x].
- The instruction is valid with type ([I32, V128] ->_ [] ++ [V128]).
Expand All @@ -4162,7 +4162,7 @@ validation_of_VSTORE V128 x memarg
validation_of_VSTORE_LANE V128 N x memarg i
- |C.MEMS| must be greater than x.
- (2 ^ memarg.ALIGN) must be less than (N / 8).
- (2 ^ memarg.ALIGN) must be less than or equal to (N / 8).
- i must be less than (128 / N).
- Let mt be C.MEMS[x].
- The instruction is valid with type ([I32, V128] ->_ [] ++ []).
Expand Down

0 comments on commit 68ef9fa

Please sign in to comment.