diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-07-29 12:10:11 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-07-29 12:10:11 +0000 |
commit | 41b7ecb127b93b1aecc29a298ec21dc94603e6fa (patch) | |
tree | 287ce1cbf88caf973534715c7816d57b9089b265 /common/Values.v | |
parent | 4bf8b331372388dc9cb39154c986c918df9e071c (diff) |
Optimize integer divisions by positive constants, turning them into
multiply-high and shifts.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2300 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'common/Values.v')
-rw-r--r-- | common/Values.v | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/Values.v b/common/Values.v index 05749b7..670f785 100644 --- a/common/Values.v +++ b/common/Values.v @@ -222,6 +222,18 @@ Definition mul (v1 v2: val): val := | _, _ => Vundef end. +Definition mulhs (v1 v2: val): val := + match v1, v2 with + | Vint n1, Vint n2 => Vint(Int.mulhs n1 n2) + | _, _ => Vundef + end. + +Definition mulhu (v1 v2: val): val := + match v1, v2 with + | Vint n1, Vint n2 => Vint(Int.mulhu n1 n2) + | _, _ => Vundef + end. + Definition divs (v1 v2: val): option val := match v1, v2 with | Vint n1, Vint n2 => |