xref: /aosp_15_r20/external/clang/test/CodeGen/popcnt-builtins.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +popcnt -emit-llvm -o - | FileCheck %s
2*67e74705SXin Li 
3*67e74705SXin Li // Don't include mm_malloc.h, it's system specific.
4*67e74705SXin Li #define __MM_MALLOC_H
5*67e74705SXin Li 
6*67e74705SXin Li #include <x86intrin.h>
7*67e74705SXin Li 
test_mm_popcnt_u32(unsigned int __X)8*67e74705SXin Li unsigned int test_mm_popcnt_u32(unsigned int __X) {
9*67e74705SXin Li   //CHECK: call i32 @llvm.ctpop.i32
10*67e74705SXin Li   return _mm_popcnt_u32(__X);
11*67e74705SXin Li }
12*67e74705SXin Li 
test_popcnt_32(int __X)13*67e74705SXin Li unsigned int test_popcnt_32(int __X) {
14*67e74705SXin Li   //CHECK: call i32 @llvm.ctpop.i32
15*67e74705SXin Li   return _popcnt32(__X);
16*67e74705SXin Li }
17*67e74705SXin Li 
test_mm_popcnt_u64(unsigned long long __X)18*67e74705SXin Li unsigned long long test_mm_popcnt_u64(unsigned long long __X) {
19*67e74705SXin Li   //CHECK: call i64 @llvm.ctpop.i64
20*67e74705SXin Li   return _mm_popcnt_u64(__X);
21*67e74705SXin Li }
22*67e74705SXin Li 
test_popcnt_64(long long __X)23*67e74705SXin Li unsigned long long test_popcnt_64(long long __X) {
24*67e74705SXin Li   //CHECK: call i64 @llvm.ctpop.i64
25*67e74705SXin Li   return _popcnt64(__X);
26*67e74705SXin Li }
27