Skip to content

Commit

Permalink
Missing TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Jun 28, 2024
1 parent 2b53f3e commit 868e522
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 111 deletions.
4 changes: 2 additions & 2 deletions spectec/spec/wasm-3.0/3-numerics.watsup
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ def $iabs(N, iN(N)) : iN(N) hint(show $iabs_(%,%))
def $ineg(N, iN(N)) : iN(N) hint(show $ineg_(%,%))
def $imin(N, sx, iN(N), iN(N)) : iN(N) hint(show $imin_(%)^(%)%((%,%)))
def $imax(N, sx, iN(N), iN(N)) : iN(N) hint(show $imax_(%)^(%)%((%,%)))
;; TODO(?, ?): make add/sub_sat
;; TODO(1, rossberg): rename to add/sub_sat to match mnemonic
def $iaddsat(N, sx, iN(N), iN(N)) : iN(N) hint(show $iaddsat_(%)^(%)#((%,%)))
def $isubsat(N, sx, iN(N), iN(N)) : iN(N) hint(show $isubsat_(%)^(%)#((%,%)))
;; TODO(?, ?): make sx parameter
;; TODO(3, rossberg): make sx parameter
def $iavgr_u(N, iN(N), iN(N)) : iN(N) hint(show $iavgr__u_(%,%,%))
def $iq15mulrsat_s(N, iN(N), iN(N)) : iN(N) hint(show $iq15mulrsat__s_(%,%,%))

Expand Down
1 change: 0 additions & 1 deletion spectec/spec/wasm-3.0/8-reduction.watsup
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,6 @@ rule Step_pure/vextract_lane-num:
(VCONST V128 c_1) (VEXTRACT_LANE (nt X N) i) ~> (CONST nt c_2)
-- if c_2 = $lanes_(nt X N, c_1)[i]

;; TODO(?, ?): fshape
rule Step_pure/vextract_lane-pack:
(VCONST V128 c_1) (VEXTRACT_LANE (pt X N) sx i) ~> (CONST I32 c_2)
-- if c_2 = $ext($psize(pt), 32, sx, $lanes_(pt X N, c_1)[i])
Expand Down
36 changes: 18 additions & 18 deletions spectec/test-frontend/TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -5965,89 +5965,89 @@ relation Step: `%~>%`(config, config)
`%~>%`(`%;%`_config(z, [REF.ARRAY_ADDR_instr(a) CONST_instr(I32_numtype, `%`_num_(i)) (val : val <: instr) ARRAY.SET_instr(x)]), `%;%`_config($with_array(z, a, i, $packfield(zt, val)), []))
-- Expand: `%~~%`($type(z, x), ARRAY_comptype(`%%`_arraytype(mut, zt)))

;; 8-reduction.watsup:737.1-738.56
;; 8-reduction.watsup:736.1-737.56
rule local.set{z : state, val : val, x : idx}:
`%~>%`(`%;%`_config(z, [(val : val <: instr) LOCAL.SET_instr(x)]), `%;%`_config($with_local(z, x, val), []))

;; 8-reduction.watsup:750.1-751.58
;; 8-reduction.watsup:749.1-750.58
rule global.set{z : state, val : val, x : idx}:
`%~>%`(`%;%`_config(z, [(val : val <: instr) GLOBAL.SET_instr(x)]), `%;%`_config($with_global(z, x, val), []))

;; 8-reduction.watsup:764.1-766.33
;; 8-reduction.watsup:763.1-765.33
rule table.set-oob{z : state, i : nat, ref : ref, x : idx}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config(z, [TRAP_instr]))
-- if (i >= |$table(z, x).REFS_tableinst|)

;; 8-reduction.watsup:768.1-770.32
;; 8-reduction.watsup:767.1-769.32
rule table.set-val{z : state, i : nat, ref : ref, x : idx}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) (ref : ref <: instr) TABLE.SET_instr(x)]), `%;%`_config($with_table(z, x, i, ref), []))
-- if (i < |$table(z, x).REFS_tableinst|)

;; 8-reduction.watsup:778.1-781.46
;; 8-reduction.watsup:777.1-780.46
rule table.grow-succeed{z : state, ref : ref, n : n, x : idx, ti : tableinst}:
`%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr(I32_numtype, `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config($with_tableinst(z, x, ti), [CONST_instr(I32_numtype, `%`_num_(|$table(z, x).REFS_tableinst|))]))
-- if (ti = $growtable($table(z, x), n, ref))

;; 8-reduction.watsup:783.1-784.80
;; 8-reduction.watsup:782.1-783.80
rule table.grow-fail{z : state, ref : ref, n : n, x : idx}:
`%~>%`(`%;%`_config(z, [(ref : ref <: instr) CONST_instr(I32_numtype, `%`_num_(n)) TABLE.GROW_instr(x)]), `%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_($invsigned(32, - (1 : nat <: int))))]))

;; 8-reduction.watsup:844.1-845.51
;; 8-reduction.watsup:843.1-844.51
rule elem.drop{z : state, x : idx}:
`%~>%`(`%;%`_config(z, [ELEM.DROP_instr(x)]), `%;%`_config($with_elem(z, x, []), []))

;; 8-reduction.watsup:924.1-927.60
;; 8-reduction.watsup:923.1-926.60
rule store-num-oob{z : state, i : nat, nt : numtype, c : num_(nt), x : idx, ao : memarg}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr]))
-- if (((i + ao.OFFSET_memarg!`%`_u32.0) + ($size(nt) / 8)) > |$mem(z, x).BYTES_meminst|)

;; 8-reduction.watsup:929.1-933.28
;; 8-reduction.watsup:928.1-932.28
rule store-num-val{z : state, i : nat, nt : numtype, c : num_(nt), x : idx, ao : memarg, b* : byte*}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i + ao.OFFSET_memarg!`%`_u32.0), ($size(nt) / 8), b*{b : byte}), []))
-- if (b*{b : byte} = $nbytes(nt, c))

;; 8-reduction.watsup:935.1-938.52
;; 8-reduction.watsup:934.1-937.52
rule store-pack-oob{z : state, i : nat, Inn : Inn, c : num_((Inn : Inn <: numtype)), nt : numtype, n : n, x : idx, ao : memarg}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) CONST_instr((Inn : Inn <: numtype), c) STORE_instr(nt, ?(`%`_sz(n)), x, ao)]), `%;%`_config(z, [TRAP_instr]))
-- if (((i + ao.OFFSET_memarg!`%`_u32.0) + (n / 8)) > |$mem(z, x).BYTES_meminst|)

;; 8-reduction.watsup:940.1-944.49
;; 8-reduction.watsup:939.1-943.49
rule store-pack-val{z : state, i : nat, Inn : Inn, c : num_((Inn : Inn <: numtype)), nt : numtype, n : n, x : idx, ao : memarg, b* : byte*}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) CONST_instr((Inn : Inn <: numtype), c) STORE_instr(nt, ?(`%`_sz(n)), x, ao)]), `%;%`_config($with_mem(z, x, (i + ao.OFFSET_memarg!`%`_u32.0), (n / 8), b*{b : byte}), []))
-- if (b*{b : byte} = $ibytes(n, $wrap($size((Inn : Inn <: numtype)), n, c)))

;; 8-reduction.watsup:946.1-948.63
;; 8-reduction.watsup:945.1-947.63
rule vstore-oob{z : state, i : nat, c : vec_(V128_Vnn), x : idx, ao : memarg}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr]))
-- if (((i + ao.OFFSET_memarg!`%`_u32.0) + ($vsize(V128_vectype) / 8)) > |$mem(z, x).BYTES_meminst|)

;; 8-reduction.watsup:950.1-952.30
;; 8-reduction.watsup:949.1-951.30
rule vstore-val{z : state, i : nat, c : vec_(V128_Vnn), x : idx, ao : memarg, b* : byte*}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i + ao.OFFSET_memarg!`%`_u32.0), ($vsize(V128_vectype) / 8), b*{b : byte}), []))
-- if (b*{b : byte} = $vbytes(V128_vectype, c))

;; 8-reduction.watsup:955.1-957.50
;; 8-reduction.watsup:954.1-956.50
rule vstore_lane-oob{z : state, i : nat, c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : nat}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, `%`_laneidx(j))]), `%;%`_config(z, [TRAP_instr]))
-- if (((i + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|)

;; 8-reduction.watsup:959.1-963.48
;; 8-reduction.watsup:958.1-962.48
rule vstore_lane-val{z : state, i : nat, c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : nat, b* : byte*, Jnn : Jnn, M : M}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(i)) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, `%`_laneidx(j))]), `%;%`_config($with_mem(z, x, (i + ao.OFFSET_memarg!`%`_u32.0), (N / 8), b*{b : byte}), []))
-- if (N = $lsize((Jnn : Jnn <: lanetype)))
-- if (M = (128 / N))
-- if (b*{b : byte} = $ibytes(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j]!`%`_lane_.0)))

;; 8-reduction.watsup:971.1-974.37
;; 8-reduction.watsup:970.1-973.37
rule memory.grow-succeed{z : state, n : n, x : idx, mi : meminst}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config($with_meminst(z, x, mi), [CONST_instr(I32_numtype, `%`_num_((|$mem(z, x).BYTES_meminst| / (64 * $Ki))))]))
-- if (mi = $growmem($mem(z, x), n))

;; 8-reduction.watsup:976.1-977.77
;; 8-reduction.watsup:975.1-976.77
rule memory.grow-fail{z : state, n : n, x : idx}:
`%~>%`(`%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_(n)) MEMORY.GROW_instr(x)]), `%;%`_config(z, [CONST_instr(I32_numtype, `%`_num_($invsigned(32, - (1 : nat <: int))))]))

;; 8-reduction.watsup:1037.1-1038.51
;; 8-reduction.watsup:1036.1-1037.51
rule data.drop{z : state, x : idx}:
`%~>%`(`%;%`_config(z, [DATA.DROP_instr(x)]), `%;%`_config($with_data(z, x, []), []))
}
Expand Down
Loading

0 comments on commit 868e522

Please sign in to comment.