From 41b7ecb127b93b1aecc29a298ec21dc94603e6fa Mon Sep 17 00:00:00 2001 From: xleroy Date: Mon, 29 Jul 2013 12:10:11 +0000 Subject: 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 --- common/Values.v | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'common') 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 => -- cgit v1.2.3