2016-06-01 20:21:00 +08:00
|
|
|
// 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
|
2016-06-14 01:26:16 +08:00
|
|
|
// CHECK: %[[call:.*]] = call i32 @llvm.cttz.i32(
|
|
|
|
// CHECK: ret i32 %[[call]]
|
2016-06-01 20:21:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int test_bit_scan_reverse(int a) {
|
|
|
|
return _bit_scan_reverse(a);
|
2016-06-14 01:26:16 +08:00
|
|
|
// CHECK: %[[call:.*]] = call i32 @llvm.ctlz.i32(
|
2016-06-14 02:44:22 +08:00
|
|
|
// CHECK: %[[sub:.*]] = sub nsw i32 31, %[[call]]
|
2016-06-14 01:26:16 +08:00
|
|
|
// CHECK: ret i32 %[[sub]]
|
2016-06-01 20:21:00 +08:00
|
|
|
}
|