summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/builtin-count-zeros.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGen/builtin-count-zeros.c')
-rw-r--r--clang/test/CodeGen/builtin-count-zeros.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtin-count-zeros.c b/clang/test/CodeGen/builtin-count-zeros.c
new file mode 100644
index 0000000..acd22e6
--- /dev/null
+++ b/clang/test/CodeGen/builtin-count-zeros.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple arm-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-ARM
+
+int a(int a) {return __builtin_ctz(a) + __builtin_clz(a);}
+// CHECK: call i32 @llvm.cttz.i32({{.*}}, i1 true)
+// CHECK: call i32 @llvm.ctlz.i32({{.*}}, i1 true)
+// CHECK-ARM: call i32 @llvm.cttz.i32({{.*}}, i1 false)
+// CHECK-ARM: call i32 @llvm.ctlz.i32({{.*}}, i1 false)