aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Selection.v
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2016-10-04 15:52:16 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2016-10-04 15:52:16 +0200
commitd2af79a77ed2936ff0ed90cadf8e48637d774d4c (patch)
tree09300943e12a98ae80598c79d455b31725271ead /backend/Selection.v
parenta44893028eb1dd434c68001234ad56d030205a8e (diff)
downloadcompcert-kvx-d2af79a77ed2936ff0ed90cadf8e48637d774d4c.tar.gz
compcert-kvx-d2af79a77ed2936ff0ed90cadf8e48637d774d4c.zip
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.
Diffstat (limited to 'backend/Selection.v')
-rw-r--r--backend/Selection.v5
1 files changed, 4 insertions, 1 deletions
diff --git a/backend/Selection.v b/backend/Selection.v
index 5cb5d119..abda1d95 100644
--- a/backend/Selection.v
+++ b/backend/Selection.v
@@ -389,10 +389,13 @@ Definition get_helpers (defmap: PTree.t globdef) : res helper_functions :=
do i64_shl <- lookup_helper globs "__i64_shl" sig_li_l ;
do i64_shr <- lookup_helper globs "__i64_shr" sig_li_l ;
do i64_sar <- lookup_helper globs "__i64_sar" sig_li_l ;
+ do i64_umulh <- lookup_helper globs "__i64_umulh" sig_ll_l ;
+ do i64_smulh <- lookup_helper globs "__i64_smulh" sig_ll_l ;
OK (mk_helper_functions
i64_dtos i64_dtou i64_stod i64_utod i64_stof i64_utof
i64_sdiv i64_udiv i64_smod i64_umod
- i64_shl i64_shr i64_sar).
+ i64_shl i64_shr i64_sar
+ i64_umulh i64_smulh).
(** Conversion of programs. *)