diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
| commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
| tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /test/CodeGen/bitscan-builtins.c | |
| parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
Notes
Diffstat (limited to 'test/CodeGen/bitscan-builtins.c')
| -rw-r--r-- | test/CodeGen/bitscan-builtins.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/bitscan-builtins.c b/test/CodeGen/bitscan-builtins.c new file mode 100644 index 000000000000..ae817e815749 --- /dev/null +++ b/test/CodeGen/bitscan-builtins.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s + +// Don't include mm_malloc.h, it's system specific. +#define __MM_MALLOC_H +#include <immintrin.h> + +int test_bit_scan_forward(int a) { + return _bit_scan_forward(a); +// CHECK: @test_bit_scan_forward +// CHECK: %[[call:.*]] = call i32 @llvm.cttz.i32( +// CHECK: ret i32 %[[call]] +} + +int test_bit_scan_reverse(int a) { + return _bit_scan_reverse(a); +// CHECK: %[[call:.*]] = call i32 @llvm.ctlz.i32( +// CHECK: %[[sub:.*]] = sub nsw i32 31, %[[call]] +// CHECK: ret i32 %[[sub]] +} |
