diff options
author | Bernhard Schommer <bschommer@users.noreply.github.com> | 2018-09-18 10:43:53 +0200 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2018-09-18 10:43:53 +0200 |
commit | 51d32b92df4eeba729c4cb950d6374b8f879ca5c (patch) | |
tree | 996b6ba29f667490777dfdade843f51b452716fc /powerpc/Asmexpand.ml | |
parent | 0af832379495bbfcd5f4cef6c5d00fad820b5856 (diff) | |
download | compcert-kvx-51d32b92df4eeba729c4cb950d6374b8f879ca5c.tar.gz compcert-kvx-51d32b92df4eeba729c4cb950d6374b8f879ca5c.zip |
Add builtin isel (conditional move) for int64, uint64 and _Bool (#140)
New builtin isel variants to support conditional moves for 64bit integers and _Bool values.
Bug 24516
Diffstat (limited to 'powerpc/Asmexpand.ml')
-rw-r--r-- | powerpc/Asmexpand.ml | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index 5a2df8d3..106193d9 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -669,7 +669,7 @@ let expand_builtin_inline name args res = | "__builtin_return_address",_,BR (IR res) -> emit (Plwz (res, Cint! retaddr_offset,GPR1)) (* Integer selection *) - | ("__builtin_isel" | "__builtin_uisel"), [BA (IR a1); BA (IR a2); BA (IR a3)],BR (IR res) -> + | ("__builtin_bsel" | "__builtin_isel" | "__builtin_uisel"), [BA (IR a1); BA (IR a2); BA (IR a3)],BR (IR res) -> if eref then begin emit (Pcmpwi (a1,Cint (Int.zero))); emit (Pisel (res,a3,a2,CRbit_2)) @@ -688,6 +688,12 @@ let expand_builtin_inline name args res = end; emit (Por (res, res, GPR0)) end + | ("__builtin_isel64" | "__builtin_uisel64"), [BA (IR a1); BA (IR a2); BA (IR a3)],BR (IR res) -> + if eref && Archi.ppc64 then begin + emit (Pcmpwi (a1,Cint (Int.zero))); + emit (Pisel (res,a3,a2,CRbit_2)) + end else + raise (Error (name ^" is only supported for PPC64 targets")) (* no operation *) | "__builtin_nop", [], _ -> emit (Pori (GPR0, GPR0, Cint _0)) |