aboutsummaryrefslogtreecommitdiffstats
path: root/powerpc/Asmexpand.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-07-14 22:41:24 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-07-14 22:41:24 +0200
commit4c146156a36d48209a6206f61f80dc5d4c48ce93 (patch)
treedc8e3b1c7daf41cdf965c9e3e6119dcb5d6a41e5 /powerpc/Asmexpand.ml
parentd03d47c6e4ce9324d6d59ae36cb8db78b013be54 (diff)
parentf995a671ceb28c2a83e5e5574c3cdb46fd5e0f57 (diff)
downloadcompcert-kvx-4c146156a36d48209a6206f61f80dc5d4c48ce93.tar.gz
compcert-kvx-4c146156a36d48209a6206f61f80dc5d4c48ce93.zip
Merge branch 'master' into asmexpand
Diffstat (limited to 'powerpc/Asmexpand.ml')
-rw-r--r--powerpc/Asmexpand.ml9
1 files changed, 5 insertions, 4 deletions
diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml
index ec5a767f..b8d30ae3 100644
--- a/powerpc/Asmexpand.ml
+++ b/powerpc/Asmexpand.ml
@@ -313,7 +313,7 @@ let expand_builtin_inline name args res =
| "__builtin_mulhwu", [IR a1; IR a2], [IR res] ->
emit (Pmulhwu(res, a1, a2))
| "__builtin_clz", [IR a1], [IR res] ->
- emit (Pcntlz(res, a1))
+ emit (Pcntlzw(res, a1))
| ("__builtin_bswap" | "__builtin_bswap32"), [IR a1], [IR res] ->
emit (Pstwu(a1, Cint _m8, GPR1));
emit (Pcfi_adjust _8);
@@ -397,11 +397,12 @@ let expand_builtin_inline name args res =
(* Calls to variadic functions: condition bit 6 must be set
if at least one argument is a float; clear otherwise.
- Note that variadic functions cannot have arguments of type Tsingle. *)
+ For compatibility with other compilers, do the same if the called
+ function is unprototyped. *)
let set_cr6 sg =
- if sg.sig_cc.cc_vararg then begin
- if List.mem Tfloat sg.sig_args
+ if sg.sig_cc.cc_vararg || sg.sig_cc.cc_unproto then begin
+ if List.exists (function Tfloat | Tsingle -> true | _ -> false) sg.sig_args
then emit (Pcreqv(CRbit_6, CRbit_6, CRbit_6))
else emit (Pcrxor(CRbit_6, CRbit_6, CRbit_6))
end