diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-11-24 16:38:28 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-11-24 16:38:28 +0000 |
commit | 09739ad762e9cf144f8004cdaf60d293dfd62d9a (patch) | |
tree | 0d476db332f7b0969f7d6ef48c20a535e355a578 /powerpc | |
parent | ce4951549999f403446415c135ad1403a16a15c3 (diff) |
Add __builtin_fcti (double -> int conversion w/ round to nearest)
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2071 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'powerpc')
-rw-r--r-- | powerpc/CBuiltins.ml | 4 | ||||
-rw-r--r-- | powerpc/PrintAsm.ml | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/powerpc/CBuiltins.ml b/powerpc/CBuiltins.ml index b9fc064..ff1715b 100644 --- a/powerpc/CBuiltins.ml +++ b/powerpc/CBuiltins.ml @@ -56,6 +56,10 @@ let builtins = { (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, []); TFloat(FDouble, [])], false); + "__builtin_fcti", + (TInt(IInt, []), + [TFloat(FDouble, [])], + false); (* Memory accesses *) "__builtin_read16_reversed", (TInt(IUShort, []), [TPtr(TInt(IUShort, [AConst]), [])], false); diff --git a/powerpc/PrintAsm.ml b/powerpc/PrintAsm.ml index 5bfd3ee..3ef3c74 100644 --- a/powerpc/PrintAsm.ml +++ b/powerpc/PrintAsm.ml @@ -447,6 +447,11 @@ let print_builtin_inline oc name args res = fprintf oc " fres %a, %a\n" freg res freg a1 | "__builtin_fsel", [FR a1; FR a2; FR a3], FR res -> fprintf oc " fsel %a, %a, %a, %a\n" freg res freg a1 freg a2 freg a3 + | "__builtin_fcti", [FR a1], IR res -> + fprintf oc " fctiw %a, %a\n" freg FPR13 freg a1; + fprintf oc " stfdu %a, -8(%a)\n" freg FPR13 ireg GPR1; + fprintf oc " lwz %a, 4(%a)\n" ireg res ireg GPR1; + fprintf oc " addi %a, %a, 8\n" ireg GPR1 ireg GPR1 (* Memory accesses *) | "__builtin_read16_reversed", [IR a1], IR res -> fprintf oc " lhbrx %a, %a, %a\n" ireg res ireg_or_zero GPR0 ireg a1 |