1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-feature +bmi2 -emit-llvm -o - | FileCheck %s 2 // RUN: %clang_cc1 %s -triple=i386-apple-darwin -target-feature +bmi2 -emit-llvm -o - | FileCheck %s --check-prefix=B32 3 4 // Don't include mm_malloc.h, it's system specific. 5 #define __MM_MALLOC_H 6 7 #include <x86intrin.h> 8 9 unsigned int test_bzhi_u32(unsigned int __X, unsigned int __Y) { 10 // CHECK: @llvm.x86.bmi.bzhi.32 11 return _bzhi_u32(__X, __Y); 12 } 13 14 unsigned int test_pdep_u32(unsigned int __X, unsigned int __Y) { 15 // CHECK: @llvm.x86.bmi.pdep.32 16 return _pdep_u32(__X, __Y); 17 } 18 19 unsigned int test_pext_u32(unsigned int __X, unsigned int __Y) { 20 // CHECK: @llvm.x86.bmi.pext.32 21 return _pext_u32(__X, __Y); 22 } 23 24 unsigned int test_mulx_u32(unsigned int __X, unsigned int __Y, 25 unsigned int *__P) { 26 // CHECK: @test_mulx_u32 27 // CHECK-NOT: mul i64 28 // B32: @test_mulx_u32 29 // B32: mul i64 30 return _mulx_u32(__X, __Y, __P); 31 } 32 33 unsigned long long test_bzhi_u64(unsigned long long __X, unsigned long long __Y) { 34 // CHECK: @llvm.x86.bmi.bzhi.64 35 return _bzhi_u64(__X, __Y); 36 } 37 38 unsigned long long test_pdep_u64(unsigned long long __X, unsigned long long __Y) { 39 // CHECK: @llvm.x86.bmi.pdep.64 40 return _pdep_u64(__X, __Y); 41 } 42 43 unsigned long long test_pext_u64(unsigned long long __X, unsigned long long __Y) { 44 // CHECK: @llvm.x86.bmi.pext.64 45 return _pext_u64(__X, __Y); 46 } 47 48 unsigned long long test_mulx_u64(unsigned long long __X, unsigned long long __Y, 49 unsigned long long *__P) { 50 // CHECK: @test_mulx_u64 51 // CHECK: mul i128 52 return _mulx_u64(__X, __Y, __P); 53 } 54