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