aboutsummaryrefslogtreecommitdiffstats
path: root/powerpc/Asmexpand.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-09-08 10:44:34 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-09-08 10:44:34 +0200
commit2246044e99569fcf1c2172f0e710134123be8b49 (patch)
treedf56ebe23cb71259f346ee1f73fafe3f9a96e476 /powerpc/Asmexpand.ml
parent73e20bd6e0586e38fbc7d87d8c306fad7b578418 (diff)
downloadcompcert-kvx-2246044e99569fcf1c2172f0e710134123be8b49.tar.gz
compcert-kvx-2246044e99569fcf1c2172f0e710134123be8b49.zip
Added builtin for isel.
The builtin_isel function takes a _Bool as first argument and returns either the second or the third depending on the value of the _Bool.
Diffstat (limited to 'powerpc/Asmexpand.ml')
-rw-r--r--powerpc/Asmexpand.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml
index 929e6325..3fffc037 100644
--- a/powerpc/Asmexpand.ml
+++ b/powerpc/Asmexpand.ml
@@ -483,6 +483,10 @@ let expand_builtin_inline name args res =
emit (Plwz(res, Cint ofs, GPR1))
| "__builtin_return_address",_,BR (IR res) ->
emit (Plwz (res, Cint! retaddr_offset,GPR1))
+ (* isel *)
+ | "__builtin_isel", [BA (IR a1); BA (IR a2); BA (IR a3)],BR (IR res) ->
+ emit (Pcmpwi (a1,Cint (Int.zero)));
+ emit (Pisel (res,a3,a2,CRbit_2))
(* Catch-all *)
| _ ->
raise (Error ("unrecognized builtin " ^ name))