summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Bauereiss2018-12-13 20:37:36 +0000
committerThomas Bauereiss2018-12-13 20:37:36 +0000
commitcbd4eedf0d278572e70b04d9e9ef8750c4cae0a4 (patch)
tree303cf5190261068cf74f558df90de47d8c5f652c /lib
parent7bbed580db0abeaa1acaa47610f01571ffe75ff4 (diff)
Remove redundant zero extensions more aggressively in mono rewrites
subrange_subrange_concat does a zero extension internally, so another zero extension of its result is redundant and can lead to a type error in Lem (because Lem's type system cannot calculate the length of the intermediate result of subrange_subrange_concat).
Diffstat (limited to 'lib')
-rw-r--r--lib/mono_rewrites.sail6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/mono_rewrites.sail b/lib/mono_rewrites.sail
index 0825f9d0..93ad3db5 100644
--- a/lib/mono_rewrites.sail
+++ b/lib/mono_rewrites.sail
@@ -82,15 +82,13 @@ function subrange_subrange_eq (xs, i, j, ys, i', j') = {
xs == ys
}
-val subrange_subrange_concat : forall 'n 'o 'p 'm 'q 'r 's, 's == 'o - ('p - 1) + 'q - ('r - 1) & 'n >= 0 & 'm >= 0.
+val subrange_subrange_concat : forall 'n 'o 'p 'm 'q 'r 's, 's >= 0 & 'n >= 0 & 'm >= 0.
(bits('n), atom('o), atom('p), bits('m), atom('q), atom('r)) -> bits('s) effect pure
function subrange_subrange_concat (xs, i, j, ys, i', j') = {
let xs = (xs & slice_mask(j,i-j+1)) >> j in
let ys = (ys & slice_mask(j',i'-j'+1)) >> j' in
- // We need to avoid sizeof-rewriting
- // extzv(xs) << (i' - j' + 1) | extzv(ys)
- extz_vec(i - (j - 1) + i' - (j' - 1), xs) << (i' - j' + 1) | extz_vec(i - (j - 1) + i' - (j' - 1), ys)
+ extzv(xs) << (i' - j' + 1) | extzv(ys)
}
val place_subrange : forall 'n 'm, 'n >= 0 & 'm >= 0.