aboutsummaryrefslogtreecommitdiffstats
path: root/arm/Asmexpand.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bschommer@users.noreply.github.com>2019-08-12 16:16:10 +0200
committerXavier Leroy <xavierleroy@users.noreply.github.com>2019-08-12 16:16:10 +0200
commit040d9c67942c73d875eec9a2ab131fbae6e8f984 (patch)
tree13a98dd663fb8b7a7824d3fc629a9ab2e9301e98 /arm/Asmexpand.ml
parent2ce5e496b8d4c838c87c9f00a84ed23d1abc26fc (diff)
downloadcompcert-kvx-040d9c67942c73d875eec9a2ab131fbae6e8f984.tar.gz
compcert-kvx-040d9c67942c73d875eec9a2ab131fbae6e8f984.zip
bswap builtins: give semantics to them, support bswap64 on all targets
* Added semantic for byte swap builtins The `__builtin_bswap`, `__builtin_bswap16`, `__builtin_bswap32`, `__builtin_bswap64` builtin function are now standard builtin functions with a defined semantics. The semantics is given in terms of the decode/encode functions used for the memory model. * Added bswap64 expansion to PowerPC 32 bits. * Added bswap64 expansion for ARM.
Diffstat (limited to 'arm/Asmexpand.ml')
-rw-r--r--arm/Asmexpand.ml5
1 files changed, 5 insertions, 0 deletions
diff --git a/arm/Asmexpand.ml b/arm/Asmexpand.ml
index d9424d11..a4ec0c5d 100644
--- a/arm/Asmexpand.ml
+++ b/arm/Asmexpand.ml
@@ -304,6 +304,11 @@ let expand_builtin_va_start r =
let expand_builtin_inline name args res =
match name, args, res with
(* Integer arithmetic *)
+ | "__builtin_bswap64" , [BA_splitlong(BA(IR ah), BA(IR al))],
+ BR_splitlong(BR(IR rh), BR(IR rl)) ->
+ expand_int64_arith (rl = al) rl (fun rl ->
+ emit (Prev (rl, ah));
+ emit (Prev (rh, al)))
| ("__builtin_bswap" | "__builtin_bswap32"), [BA(IR a1)], BR(IR res) ->
emit (Prev (res, a1))
| "__builtin_bswap16", [BA(IR a1)], BR(IR res) ->