diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-08-27 09:51:01 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-08-27 09:51:01 +0000 |
commit | 9ee09b9b2cb498219bd8012bed69ecf63fce63a4 (patch) | |
tree | 4b88da989f9545a80ee5fe6bcc1118a23c84d2d5 /ia32 | |
parent | 1abecb7b559c5e0eab8c093a629fd8197f57205f (diff) | |
download | compcert-9ee09b9b2cb498219bd8012bed69ecf63fce63a4.tar.gz compcert-9ee09b9b2cb498219bd8012bed69ecf63fce63a4.zip |
Rename __builtin_cntlz to __builtin_clz.
IA32: add __builtin_clz, __builtin_ctz.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2619 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'ia32')
-rw-r--r-- | ia32/CBuiltins.ml | 4 | ||||
-rw-r--r-- | ia32/PrintAsm.ml | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/ia32/CBuiltins.ml b/ia32/CBuiltins.ml index 60461260..765f5b18 100644 --- a/ia32/CBuiltins.ml +++ b/ia32/CBuiltins.ml @@ -29,6 +29,10 @@ let builtins = { (TInt(IUInt, []), [TInt(IUInt, [])], false); "__builtin_bswap16", (TInt(IUShort, []), [TInt(IUShort, [])], false); + "__builtin_clz", + (TInt(IUInt, []), [TInt(IUInt, [])], false); + "__builtin_ctz", + (TInt(IUInt, []), [TInt(IUInt, [])], false); (* Float arithmetic *) "__builtin_fsqrt", (TFloat(FDouble, []), [TFloat(FDouble, [])], false); diff --git a/ia32/PrintAsm.ml b/ia32/PrintAsm.ml index 56e837d5..8828faa3 100644 --- a/ia32/PrintAsm.ml +++ b/ia32/PrintAsm.ml @@ -448,6 +448,11 @@ let print_builtin_inline oc name args res = if a1 <> res then fprintf oc " movl %a, %a\n" ireg a1 ireg res; fprintf oc " rolw $8, %a\n" ireg16 res + | "__builtin_clz", [IR a1], [IR res] -> + fprintf oc " bsrl %a, %a\n" ireg a1 ireg res; + fprintf oc " xorl $31, %a\n" ireg res + | "__builtin_ctz", [IR a1], [IR res] -> + fprintf oc " bsfl %a, %a\n" ireg a1 ireg res (* Float arithmetic *) | "__builtin_fabs", [FR a1], [FR res] -> need_masks := true; |