]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/bmi2-builtins.c
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / CodeGen / bmi2-builtins.c
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 <x86intrin.h>
6
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
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
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
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 unsigned long long test_bzhi_u64(unsigned long long __X, unsigned long long __Y) {
32   // CHECK: @llvm.x86.bmi.bzhi.64
33   return _bzhi_u64(__X, __Y);
34 }
35
36 unsigned long long test_pdep_u64(unsigned long long __X, unsigned long long __Y) {
37   // CHECK: @llvm.x86.bmi.pdep.64
38   return _pdep_u64(__X, __Y);
39 }
40
41 unsigned long long test_pext_u64(unsigned long long __X, unsigned long long __Y) {
42   // CHECK: @llvm.x86.bmi.pext.64
43   return _pext_u64(__X, __Y);
44 }
45
46 unsigned long long test_mulx_u64(unsigned long long __X, unsigned long long __Y,
47                                  unsigned long long *__P) {
48   // CHECK: @test_mulx_u64
49   // CHECK: mul i128
50   return _mulx_u64(__X, __Y, __P);
51 }