summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Campbell2020-09-07 11:40:37 +0100
committerBrian Campbell2020-09-07 13:40:24 +0100
commit19573d9ce8448f8296195fe1990a6d88593b57f1 (patch)
tree9cede2126d3ec5f542db51fbd912a07827803184 /src
parent300b517adb31ea4239812c1c47b59cef8a250c48 (diff)
Fix typo a mono_rewrites definition
- add tests for a couple of related rewrites - accept same range of constants for sign extension in the rewrite as for the zero extension version (to make the test simpler)
Diffstat (limited to 'src')
-rw-r--r--src/monomorphise.ml7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml
index f4d0aa56..9bb47774 100644
--- a/src/monomorphise.ml
+++ b/src/monomorphise.ml
@@ -2910,6 +2910,11 @@ let rec rewrite_app env typ (id,args) =
is_id env (Id "zero_extend") id || is_id env (Id "sail_zero_extend") id ||
is_id env (Id "mips_zero_extend") id || is_id env (Id "EXTZ") id
in
+ let is_sign_extend =
+ is_id env (Id "SignExtend") id ||
+ is_id env (Id "sign_extend") id || is_id env (Id "sail_sign_extend") id ||
+ is_id env (Id "mips_sign_extend") id || is_id env (Id "EXTS") id
+ in
let is_truncate = is_id env (Id "truncate") id in
let mk_exp e = E_aux (e, (Unknown, empty_tannot)) in
let rec is_zeros_exp e = match unaux_exp e with
@@ -3244,7 +3249,7 @@ let rec rewrite_app env typ (id,args) =
| _ -> E_app (id,args)
- else if is_id env (Id "SignExtend") id || is_id env (Id "sign_extend") id then
+ else if is_sign_extend then
let length_arg = List.filter (fun arg -> is_number (typ_of arg)) args in
match List.filter (fun arg -> not (is_number (typ_of arg))) args with
| [E_aux (E_app (slice1, [vector1; start1; length1]),_)]