From f849a03bc11b2bc3c6373213afc2a7023c636679 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 22 Jun 2016 10:38:21 +0200 Subject: 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. --- common/Values.v | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'common/Values.v') 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. -- cgit