1 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +popcnt -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-POPCNT
2 // RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
3 
4 
5 #include <x86intrin.h>
6 
7 #ifdef __POPCNT__
test_mm_popcnt_u32(unsigned int __X)8 int test_mm_popcnt_u32(unsigned int __X) {
9   //CHECK-POPCNT: call i32 @llvm.ctpop.i32
10   return _mm_popcnt_u32(__X);
11 }
12 #endif
13 
test_popcnt32(unsigned int __X)14 int test_popcnt32(unsigned int __X) {
15   //CHECK: call i32 @llvm.ctpop.i32
16   return _popcnt32(__X);
17 }
18 
test__popcntd(unsigned int __X)19 int test__popcntd(unsigned int __X) {
20   //CHECK: call i32 @llvm.ctpop.i32
21   return __popcntd(__X);
22 }
23 
24 #ifdef __x86_64__
25 #ifdef __POPCNT__
test_mm_popcnt_u64(unsigned long long __X)26 long long test_mm_popcnt_u64(unsigned long long __X) {
27   //CHECK-POPCNT: call i64 @llvm.ctpop.i64
28   return _mm_popcnt_u64(__X);
29 }
30 #endif
31 
test_popcnt64(unsigned long long __X)32 long long test_popcnt64(unsigned long long __X) {
33   //CHECK: call i64 @llvm.ctpop.i64
34   return _popcnt64(__X);
35 }
36 
test__popcntq(unsigned long long __X)37 long long test__popcntq(unsigned long long __X) {
38   //CHECK: call i64 @llvm.ctpop.i64
39   return __popcntq(__X);
40 }
41 #endif
42