blob: 201cac63b9fe97e30080749d965122df55bff59f [file] [log] [blame]
Craig Topperf58f3642011-12-26 02:31:10 +00001// RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +bmi2 -emit-llvm -o - | FileCheck %s
Michael Liao4d1499d2012-10-05 18:50:09 +00002// RUN: %clang_cc1 %s -O3 -triple=i386-apple-darwin -target-feature +bmi2 -emit-llvm -o - | FileCheck %s --check-prefix=B32
Craig Topperf58f3642011-12-26 02:31:10 +00003
4// Don't include mm_malloc.h, it's system specific.
5#define __MM_MALLOC_H
6
7#include <x86intrin.h>
8
9unsigned 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
14unsigned 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
19unsigned 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
Michael Liao4d1499d2012-10-05 18:50:09 +000024unsigned 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
Craig Topperf58f3642011-12-26 02:31:10 +000033unsigned 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
38unsigned 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
43unsigned 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}
Michael Liao4d1499d2012-10-05 18:50:09 +000047
48unsigned 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}