blob: f98fdbd13a8a436bc1328514444c7828ebae2faf [file] [log] [blame]
Pirama Arumuga Nainar87d948e2016-03-03 15:49:35 -08001// RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
2// RUN: %clang_cc1 -fsyntax-only -ffreestanding -fno-lax-vector-conversions %s -verify
3// RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
4// expected-no-diagnostics
5
6#if defined(i386) || defined(__x86_64__)
7
8// Include the metaheader that includes all x86 intrinsic headers.
9#include <x86intrin.h>
10
11void __attribute__((__target__("mmx"))) mm_empty_wrap(void) {
12 _mm_empty();
13}
14
15__m128 __attribute__((__target__("sse"))) mm_add_ss_wrap(__m128 a, __m128 b) {
16 return _mm_add_ss(a, b);
17}
18
19__m128d __attribute__((__target__("sse2"))) mm_sqrt_sd_wrap(__m128d a, __m128d b) {
20 return _mm_sqrt_sd(a, b);
21}
22
23void __attribute__((__target__("sse3"))) mm_mwait_wrap(int a) {
24 _mm_mwait(0, 0);
25}
26
27__m64 __attribute__((__target__("ssse3"))) mm_abs_pi8_wrap(__m64 a) {
28 return _mm_abs_pi8(a);
29}
30
31__m128i __attribute__((__target__("sse4.1"))) mm_minpos_epu16_wrap(__m128i v) {
32 return _mm_minpos_epu16(v);
33}
34
35unsigned int __attribute__((__target__("sse4.2"))) mm_crc32_u8_wrap(unsigned int c, unsigned char d) {
36 return _mm_crc32_u8(c, d);
37}
38
39__m128i __attribute__((__target__("aes"))) mm_aesenc_si128_wrap(__m128i v, __m128i r) {
40 return _mm_aesenc_si128(v, r);
41}
42
43__m256d __attribute__((__target__("avx"))) mm256_add_pd_wrap(__m256d a, __m256d b) {
44 return _mm256_add_pd(a, b);
45}
46
47__m256i __attribute__((__target__("avx2"))) mm256_abs_epi8_wrap(__m256i a) {
48 return _mm256_abs_epi8(a);
49}
50
51unsigned short __attribute__((__target__("bmi"))) tzcnt_u16_wrap(unsigned short x) {
52 return __tzcnt_u16(x);
53}
54
55unsigned int __attribute__((__target__("bmi2"))) bzhi_u32_wrap(unsigned int x, unsigned int y) {
56 return _bzhi_u32(x, y);
57}
58
59unsigned short __attribute__((__target__("lzcnt"))) lzcnt16_wrap(unsigned short x) {
60 return __lzcnt16(x);
61}
62
63__m256d __attribute__((__target__("fma"))) mm256_fmsubadd_pd_wrap(__m256d a, __m256d b, __m256d c) {
64 return _mm256_fmsubadd_pd(a, b, c);
65}
66
67__m512i __attribute__((__target__("avx512f"))) mm512_setzero_si512_wrap(void) {
68 return _mm512_setzero_si512();
69}
70
71__mmask8 __attribute__((__target__("avx512vl"))) mm_cmpeq_epi32_mask_wrap(__m128i a, __m128i b) {
72 return _mm_cmpeq_epi32_mask(a, b);
73}
74
75__v64qi __attribute__((__target__("avx512bw"))) mm512_setzero_qi_wrap(void) {
76 return _mm512_setzero_qi();
77}
78
79__m512i __attribute__((__target__("avx512dq"))) mm512_mullo_epi64_wrap(__m512i a, __m512i b) {
80 return _mm512_mullo_epi64(a, b);
81}
82
83__mmask16 __attribute__((__target__("avx512vl,avx512bw"))) mm_cmpeq_epi8_mask_wrap(__m128i a, __m128i b) {
84 return _mm_cmpeq_epi8_mask(a, b);
85}
86
87__m256i __attribute__((__target__("avx512vl,avx512dq"))) mm256_mullo_epi64_wrap(__m256i a, __m256i b) {
88 return _mm256_mullo_epi64(a, b);
89}
90
91int __attribute__((__target__("rdrnd"))) rdrand16_step_wrap(unsigned short *p) {
92 return _rdrand16_step(p);
93}
94
95#if defined(__x86_64__)
96unsigned int __attribute__((__target__("fsgsbase"))) readfsbase_u32_wrap(void) {
97 return _readfsbase_u32();
98}
99#endif
100
101unsigned int __attribute__((__target__("rtm"))) xbegin_wrap(void) {
102 return _xbegin();
103}
104
105__m128i __attribute__((__target__("sha"))) mm_sha1nexte_epu32_wrap(__m128i x, __m128i y) {
106 return _mm_sha1nexte_epu32(x, y);
107}
108
109int __attribute__((__target__("rdseed"))) rdseed16_step_wrap(unsigned short *p) {
110 return _rdseed16_step(p);
111}
112
113__m128i __attribute__((__target__("sse4a"))) mm_extract_si64_wrap(__m128i x, __m128i y) {
114 return _mm_extract_si64(x, y);
115}
116
117__m128 __attribute__((__target__("fma4"))) mm_macc_ps_wrap(__m128 a, __m128 b, __m128 c) {
118 return _mm_macc_ps(a, b, c);
119}
120
121__m256 __attribute__((__target__("xop"))) mm256_frcz_ps_wrap(__m256 a) {
122 return _mm256_frcz_ps(a);
123}
124
125unsigned int __attribute__((__target__("tbm"))) blcfill_u32_wrap(unsigned int a) {
126 return __blcfill_u32(a);
127}
128
129__m128 __attribute__((__target__("f16c"))) mm_cvtph_ps_wrap(__m128i a) {
130 return _mm_cvtph_ps(a);
131}
132
133int __attribute__((__target__("rtm"))) xtest_wrap(void) {
134 return _xtest();
135}
136
137#endif