| 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__ |
| 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 | |
| 14 | int test_popcnt32(unsigned int __X) { |
| 15 | //CHECK: call i32 @llvm.ctpop.i32 |
| 16 | return _popcnt32(__X); |
| 17 | } |
| 18 | |
| 19 | int test__popcntd(unsigned int __X) { |
| 20 | //CHECK: call i32 @llvm.ctpop.i32 |
| 21 | return __popcntd(__X); |
| 22 | } |
| 23 | |
| 24 | #ifdef __POPCNT__ |
| 25 | long long test_mm_popcnt_u64(unsigned long long __X) { |
| 26 | //CHECK-POPCNT: call i64 @llvm.ctpop.i64 |
| 27 | return _mm_popcnt_u64(__X); |
| 28 | } |
| 29 | #endif |
| 30 | |
| 31 | long long test_popcnt64(unsigned long long __X) { |
| 32 | //CHECK: call i64 @llvm.ctpop.i64 |
| 33 | return _popcnt64(__X); |
| 34 | } |
| 35 | |
| 36 | long long test__popcntq(unsigned long long __X) { |
| 37 | //CHECK: call i64 @llvm.ctpop.i64 |
| 38 | return __popcntq(__X); |
| 39 | } |
| 40 | |