diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2016-06-22 10:38:21 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2016-06-22 10:38:21 +0200 |
commit | f849a03bc11b2bc3c6373213afc2a7023c636679 (patch) | |
tree | 60511dae19358e2d7d4482a7b3ff10d95a0c90dd /common | |
parent | 076e8fb1e20b5bc77e3a5d7011cd7b229fcc017d (diff) | |
download | compcert-f849a03bc11b2bc3c6373213afc2a7023c636679.tar.gz compcert-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')
-rw-r--r-- | common/Values.v | 11 |
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. |