aboutsummaryrefslogtreecommitdiffstats
path: root/mppa_k1c
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-29 11:14:46 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-29 11:14:46 +0200
commit11cd0ace897752ef7ca33609aa1250ca1597185b (patch)
treef01066819b0ed9f42d6276e9c8880f3f6747cd31 /mppa_k1c
parentaa3ff942fb4944242c7a2398592b7e3d33f6c9dc (diff)
downloadcompcert-kvx-11cd0ace897752ef7ca33609aa1250ca1597185b.tar.gz
compcert-kvx-11cd0ace897752ef7ca33609aa1250ca1597185b.zip
arranging for selection of divisor as option
Diffstat (limited to 'mppa_k1c')
-rw-r--r--mppa_k1c/TargetPrinter.ml48
1 files changed, 44 insertions, 4 deletions
diff --git a/mppa_k1c/TargetPrinter.ml b/mppa_k1c/TargetPrinter.ml
index 96779517..4dc4b7c2 100644
--- a/mppa_k1c/TargetPrinter.ml
+++ b/mppa_k1c/TargetPrinter.ml
@@ -34,11 +34,51 @@ module Target (*: TARGET*) =
let comment = "#"
+ type idiv_function_kind =
+ | Idiv_system
+ | Idiv_stsud
+ | Idiv_fp;;
+
+ let idiv_function_kind_32bit () = Idiv_fp;;
+ let idiv_function_kind_64bit () = Idiv_stsud;;
+
let subst_symbol = function
- "__compcert_i64_udiv" -> "__udivdi3"
- | "__compcert_i64_sdiv" -> "__divdi3"
- | "__compcert_i64_umod" -> "__umoddi3"
- | "__compcert_i64_smod" -> "__moddi3"
+ "__compcert_i64_udiv" ->
+ (match idiv_function_kind_64bit () with
+ | Idiv_system | Idiv_fp -> "__udivdi3"
+ | Idiv_stsud -> "__compcert_i64_udiv_stsud")
+ | "__compcert_i64_sdiv" ->
+ (match idiv_function_kind_64bit() with
+ | Idiv_system | Idiv_fp -> "__divdi3"
+ | Idiv_stsud -> "__compcert_i64_sdiv_stsud")
+ | "__compcert_i64_umod" ->
+ (match idiv_function_kind_64bit() with
+ | Idiv_system | Idiv_fp -> "__umoddi3"
+ | Idiv_stsud -> "__compcert_i64_umod_stsud")
+ | "__compcert_i64_smod" ->
+ (match idiv_function_kind_64bit() with
+ | Idiv_system | Idiv_fp -> "__moddi3"
+ | Idiv_stsud -> "__compcert_i64_stsud")
+ | "__compcert_i32_sdiv" as s ->
+ (match idiv_function_kind_32bit() with
+ | Idiv_system -> s
+ | Idiv_fp -> "__compcert_i32_sdiv_fp"
+ | Idiv_stsud -> "__compcert_i32_sdiv_stsud")
+ | "__compcert_i32_udiv" as s ->
+ (match idiv_function_kind_32bit() with
+ | Idiv_system -> s
+ | Idiv_fp -> "__compcert_i32_udiv_fp"
+ | Idiv_stsud -> "__compcert_i32_udiv_stsud")
+ | "__compcert_i32_smod" as s ->
+ (match idiv_function_kind_32bit() with
+ | Idiv_system -> s
+ | Idiv_fp -> "__compcert_i32_smod_fp"
+ | Idiv_stsud -> "__compcert_i32_smod_stsud")
+ | "__compcert_i32_umod" as s ->
+ (match idiv_function_kind_32bit() with
+ | Idiv_system -> s
+ | Idiv_fp -> "__compcert_i32_umod_fp"
+ | Idiv_stsud -> "__compcert_i32_umod_stsud")
| "__compcert_f64_div" -> "__divdf3"
| "__compcert_f32_div" -> "__divsf3"
| x -> x;;