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