diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-01-28 18:42:57 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-01-28 18:42:57 +0000 |
commit | 1412816686bd4a7b9d7fe72b14c5c4e62d8d4062 (patch) | |
tree | adc23c07cae4fc3ddedcdfa5ea4cc92c7421f6ba /clang/test | |
parent | de0c33556015d4235a3a553cf53ded748d695af9 (diff) | |
download | bcm5719-llvm-1412816686bd4a7b9d7fe72b14c5c4e62d8d4062.tar.gz bcm5719-llvm-1412816686bd4a7b9d7fe72b14c5c4e62d8d4062.zip |
Make the __builtin_c[lt]zs builtins target independent.
There is really no reason to have these only available on x86. It's
just __builtin_c[tl]z for shorts.
Modernize the test while at it.
llvm-svn: 149183
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/2005-05-06-CountBuiltins.c | 17 | ||||
-rw-r--r-- | clang/test/CodeGen/count-builtins.c | 33 |
2 files changed, 33 insertions, 17 deletions
diff --git a/clang/test/CodeGen/2005-05-06-CountBuiltins.c b/clang/test/CodeGen/2005-05-06-CountBuiltins.c deleted file mode 100644 index 4c12100dc50..00000000000 --- a/clang/test/CodeGen/2005-05-06-CountBuiltins.c +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: %clang_cc1 %s -emit-llvm -o %t -// RUN: not grep call*__builtin %t - -int G, H, I; -void foo(int P) { - G = __builtin_clz(P); - H = __builtin_ctz(P); - I = __builtin_popcount(P); -} - -long long g, h, i; -void fooll(float P) { - g = __builtin_clzll(P); - g = __builtin_clzll(P); - h = __builtin_ctzll(P); - i = __builtin_popcountll(P); -} diff --git a/clang/test/CodeGen/count-builtins.c b/clang/test/CodeGen/count-builtins.c new file mode 100644 index 00000000000..e6133c5cf0b --- /dev/null +++ b/clang/test/CodeGen/count-builtins.c @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s + +int leading, trailing, pop; + +void test_i16(short P) { + leading = __builtin_clzs(P); + trailing = __builtin_ctzs(P); + +// CHECK: @test_i16 +// CHECK: call i16 @llvm.ctlz.i16 +// CHECK: call i16 @llvm.cttz.i16 +} + +void test_i32(int P) { + leading = __builtin_clz(P); + trailing = __builtin_ctz(P); + pop = __builtin_popcount(P); + +// CHECK: @test_i32 +// CHECK: call i32 @llvm.ctlz.i32 +// CHECK: call i32 @llvm.cttz.i32 +// CHECK: call i32 @llvm.ctpop.i32 +} + +void test_i64(float P) { + leading = __builtin_clzll(P); + trailing = __builtin_ctzll(P); + pop = __builtin_popcountll(P); +// CHECK: @test_i64 +// CHECK: call i64 @llvm.ctlz.i64 +// CHECK: call i64 @llvm.cttz.i64 +// CHECK: call i64 @llvm.ctpop.i64 +} |