1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
2 
3 // Don't include mm_malloc.h, it's system specific.
4 #define __MM_MALLOC_H
5 #include <immintrin.h>
6 
test_bit_scan_forward(int a)7 int test_bit_scan_forward(int a) {
8   return _bit_scan_forward(a);
9 // CHECK: @test_bit_scan_forward
10 // CHECK: %[[call:.*]] = call i32 @llvm.cttz.i32(
11 // CHECK: ret i32 %[[call]]
12 }
13 
test_bit_scan_reverse(int a)14 int test_bit_scan_reverse(int a) {
15   return _bit_scan_reverse(a);
16 // CHECK:  %[[call:.*]] = call i32 @llvm.ctlz.i32(
17 // CHECK:  %[[sub:.*]] = sub nsw i32 31, %[[call]]
18 // CHECK: ret i32 %[[sub]]
19 }
20