From d2af79a77ed2936ff0ed90cadf8e48637d774d4c Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 4 Oct 2016 15:52:16 +0200 Subject: Turn 64-bit integer division and modulus by constants into multiply-high This trick was already implemented for 32-bit integer division and modulus. Here we extend it to the 64-bit case. For 32-bit target processors, the runtime library must implement 64-bit multiply-high (signed and unsigned). Tentative implementations are provided for IA32 and PowerPC, but need testing. --- cfrontend/C2C.ml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cfrontend/C2C.ml') diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index b68887c5..38ef45e7 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -251,6 +251,14 @@ let builtins_generic = { "__i64_sar", (TInt(ILongLong, []), [TInt(ILongLong, []); TInt(IInt, [])], + false); + "__i64_smulh", + (TInt(ILongLong, []), + [TInt(ILongLong, []); TInt(ILongLong, [])], + false); + "__i64_umulh", + (TInt(IULongLong, []), + [TInt(IULongLong, []); TInt(IULongLong, [])], false) ] } -- cgit