1 // RUN: %clang_cc1 %s -triple mips-unknown-linux-gnu -emit-llvm -o - | FileCheck %s
3 // Test that the ctlz and cttz builtins are defined for zero.
4 // Based on count-builtin.c
6 int leading
, trailing
, pop
;
8 void test_i16(short P
) {
9 leading
= __builtin_clzs(P
);
10 trailing
= __builtin_ctzs(P
);
13 // CHECK: call i16 @llvm.ctlz.i16(i16 {{.*}}, i1 false)
14 // CHECK: call i16 @llvm.cttz.i16(i16 {{.*}}, i1 false)
17 void test_i32(int P
) {
18 leading
= __builtin_clz(P
);
19 trailing
= __builtin_ctz(P
);
22 // CHECK: call i32 @llvm.ctlz.i32(i32 {{.*}}, i1 false)
23 // CHECK: call i32 @llvm.cttz.i32(i32 {{.*}}, i1 false)
26 void test_i64(float P
) {
27 leading
= __builtin_clzll(P
);
28 trailing
= __builtin_ctzll(P
);
30 // CHECK: call i64 @llvm.ctlz.i64(i64 {{.*}}, i1 false)
31 // CHECK: call i64 @llvm.cttz.i64(i64 {{.*}}, i1 false)