Craig Topper | f58f364 | 2011-12-26 02:31:10 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +bmi2 -emit-llvm -o - | FileCheck %s |
Michael Liao | 4d1499d | 2012-10-05 18:50:09 +0000 | [diff] [blame^] | 2 | // RUN: %clang_cc1 %s -O3 -triple=i386-apple-darwin -target-feature +bmi2 -emit-llvm -o - | FileCheck %s --check-prefix=B32 |
Craig Topper | f58f364 | 2011-12-26 02:31:10 +0000 | [diff] [blame] | 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 | |
Michael Liao | 4d1499d | 2012-10-05 18:50:09 +0000 | [diff] [blame^] | 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 | |
Craig Topper | f58f364 | 2011-12-26 02:31:10 +0000 | [diff] [blame] | 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 | } |
Michael Liao | 4d1499d | 2012-10-05 18:50:09 +0000 | [diff] [blame^] | 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 | } |