aboutsummaryrefslogtreecommitdiffstats
path: root/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arm')
-rw-r--r--arm/CBuiltins.ml2
-rw-r--r--arm/PrintAsm.ml2
2 files changed, 4 insertions, 0 deletions
diff --git a/arm/CBuiltins.ml b/arm/CBuiltins.ml
index dc4ca60e..6c01a36a 100644
--- a/arm/CBuiltins.ml
+++ b/arm/CBuiltins.ml
@@ -24,6 +24,8 @@ let builtins = {
(* Integer arithmetic *)
"__builtin_bswap",
(TInt(IUInt, []), [TInt(IUInt, [])], false);
+ "__builtin_cntlz",
+ (TInt(IUInt, []), [TInt(IUInt, [])], false);
(* Float arithmetic *)
"__builtin_fsqrt",
(TFloat(FDouble, []), [TFloat(FDouble, [])], false);
diff --git a/arm/PrintAsm.ml b/arm/PrintAsm.ml
index 542f3a4e..db95e549 100644
--- a/arm/PrintAsm.ml
+++ b/arm/PrintAsm.ml
@@ -392,6 +392,8 @@ let print_builtin_inline oc name args res =
(* Integer arithmetic *)
| "__builtin_bswap", [IR a1], IR res ->
print_bswap oc a1 IR14 res; 4
+ | "__builtin_cntlz", [IR a1], IR res ->
+ fprintf oc " clz %a, %a\n" ireg res ireg a1; 1
(* Float arithmetic *)
| "__builtin_fabs", [FR a1], FR res ->
fprintf oc " fabsd %a, %a\n" freg res freg a1; 1