diff options
Diffstat (limited to 'powerpc/Asmexpand.ml')
-rw-r--r-- | powerpc/Asmexpand.ml | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index 415b6651..704b0aba 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -14,7 +14,7 @@ of the PPC assembly code. *) open Camlcoq -open Integers +open! Integers open AST open Asm open Asmexpandaux @@ -30,8 +30,8 @@ let eref = (* Useful constants and helper functions *) -let _0 = Integers.Int.zero -let _1 = Integers.Int.one +let _0 = Int.zero +let _1 = Int.one let _2 = coqint_of_camlint 2l let _4 = coqint_of_camlint 4l let _6 = coqint_of_camlint 6l @@ -45,7 +45,7 @@ let _m4 = coqint_of_camlint (-4l) let _m8 = coqint_of_camlint (-8l) let _m16 = coqint_of_camlint (-16l) -let _0L = Integers.Int64.zero +let _0L = Int64.zero let _32L = coqint_of_camlint64 32L let _64L = coqint_of_camlint64 64L let _m1L = coqint_of_camlint64 (-1L) @@ -554,6 +554,26 @@ let expand_builtin_inline name args res = emit (Plabel lbl2) | "__builtin_cmpb", [BA(IR a1); BA(IR a2)], BR(IR res) -> emit (Pcmpb (res,a1,a2)) + | "__builtin_bswap64", [BA_splitlong(BA(IR ah), BA(IR al))], + BR_splitlong(BR(IR rh), BR(IR rl))-> + assert (not Archi.ppc64); + emit (Pstwu(ah, Cint _m8, GPR1)); + emit (Pcfi_adjust _8); + emit (Pstwu(al, Cint _m8, GPR1)); + emit (Pcfi_adjust _8); + emit (Plwbrx(rh, GPR0, GPR1)); + emit (Paddi(GPR1, GPR1, Cint _8)); + emit (Pcfi_adjust _m8); + emit (Plwbrx(rl, GPR0, GPR1)); + emit (Paddi(GPR1, GPR1, Cint _8)); + emit (Pcfi_adjust _m8) + | "__builtin_bswap64", [BA(IR a1)], BR(IR res) -> + assert (Archi.ppc64); + emit (Pstdu(a1, Cint _m8, GPR1)); + emit (Pcfi_adjust _8); + emit (Pldbrx(res, GPR0, GPR1)); + emit (Paddi(GPR1, GPR1, Cint _8)); + emit (Pcfi_adjust _m8) | ("__builtin_bswap" | "__builtin_bswap32"), [BA(IR a1)], BR(IR res) -> emit (Pstwu(a1, Cint _m8, GPR1)); emit (Pcfi_adjust _8); |