aboutsummaryrefslogtreecommitdiffstats
path: root/common/Values.v
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2016-06-22 10:38:21 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2016-06-22 10:38:21 +0200
commitf849a03bc11b2bc3c6373213afc2a7023c636679 (patch)
tree60511dae19358e2d7d4482a7b3ff10d95a0c90dd /common/Values.v
parent076e8fb1e20b5bc77e3a5d7011cd7b229fcc017d (diff)
downloadcompcert-kvx-f849a03bc11b2bc3c6373213afc2a7023c636679.tar.gz
compcert-kvx-f849a03bc11b2bc3c6373213afc2a7023c636679.zip
Improved handling of "rotate left" and "rotate right" operators
- Values: "rol" and "ror" are defined even if their second argument is not in the [0,31] range (for consistency with "rolm" and because the semantics is definitely well defined in this case). - NeedDomain: more precise analysis of "rol" and "rolm", could benefit the PowerPC port.
Diffstat (limited to 'common/Values.v')
-rw-r--r--common/Values.v11
1 files changed, 7 insertions, 4 deletions
diff --git a/common/Values.v b/common/Values.v
index 688e63ed..663bddf6 100644
--- a/common/Values.v
+++ b/common/Values.v
@@ -404,6 +404,12 @@ Definition shru (v1 v2: val): val :=
| _, _ => Vundef
end.
+Definition rol (v1 v2: val): val :=
+ match v1, v2 with
+ | Vint n1, Vint n2 => Vint(Int.rol n1 n2)
+ | _, _ => Vundef
+ end.
+
Definition rolm (v: val) (amount mask: int): val :=
match v with
| Vint n => Vint(Int.rolm n amount mask)
@@ -412,10 +418,7 @@ Definition rolm (v: val) (amount mask: int): val :=
Definition ror (v1 v2: val): val :=
match v1, v2 with
- | Vint n1, Vint n2 =>
- if Int.ltu n2 Int.iwordsize
- then Vint(Int.ror n1 n2)
- else Vundef
+ | Vint n1, Vint n2 => Vint(Int.ror n1 n2)
| _, _ => Vundef
end.