1*04613049SDouglas Yung // RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -ffreestanding -Wcast-qual %s -verify
2*04613049SDouglas Yung // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -ffreestanding -Wcast-qual %s -verify
3*04613049SDouglas Yung // RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -ffreestanding -flax-vector-conversions=none -Wcast-qual %s -verify
4*04613049SDouglas Yung // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -ffreestanding -flax-vector-conversions=none -Wcast-qual %s -verify
5*04613049SDouglas Yung // RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -ffreestanding -Wcast-qual -x c++ %s -verify
6*04613049SDouglas Yung // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -ffreestanding -Wcast-qual -x c++ %s -verify
79fc7fb27SEric Christopher // expected-no-diagnostics
89fc7fb27SEric Christopher
99fc7fb27SEric Christopher // Include the metaheader that includes all x86 intrinsic headers.
109fc7fb27SEric Christopher #include <x86intrin.h>
119fc7fb27SEric Christopher
mm_empty_wrap(void)129fc7fb27SEric Christopher void __attribute__((__target__("mmx"))) mm_empty_wrap(void) {
139fc7fb27SEric Christopher _mm_empty();
149fc7fb27SEric Christopher }
159fc7fb27SEric Christopher
mm_add_ss_wrap(__m128 a,__m128 b)169fc7fb27SEric Christopher __m128 __attribute__((__target__("sse"))) mm_add_ss_wrap(__m128 a, __m128 b) {
179fc7fb27SEric Christopher return _mm_add_ss(a, b);
189fc7fb27SEric Christopher }
199fc7fb27SEric Christopher
mm_prefetch_wrap(const void * p)207fcd9e3fSWarren Ristow void __attribute__((__target__("sse"))) mm_prefetch_wrap(const void *p) {
217fcd9e3fSWarren Ristow _mm_prefetch(p, 0x3);
227fcd9e3fSWarren Ristow }
237fcd9e3fSWarren Ristow
mm_sqrt_sd_wrap(__m128d a,__m128d b)249fc7fb27SEric Christopher __m128d __attribute__((__target__("sse2"))) mm_sqrt_sd_wrap(__m128d a, __m128d b) {
259fc7fb27SEric Christopher return _mm_sqrt_sd(a, b);
269fc7fb27SEric Christopher }
279fc7fb27SEric Christopher
mm_mwait_wrap(int a)289fc7fb27SEric Christopher void __attribute__((__target__("sse3"))) mm_mwait_wrap(int a) {
299fc7fb27SEric Christopher _mm_mwait(0, 0);
309fc7fb27SEric Christopher }
319fc7fb27SEric Christopher
mm_abs_pi8_wrap(__m64 a)329fc7fb27SEric Christopher __m64 __attribute__((__target__("ssse3"))) mm_abs_pi8_wrap(__m64 a) {
339fc7fb27SEric Christopher return _mm_abs_pi8(a);
349fc7fb27SEric Christopher }
359fc7fb27SEric Christopher
mm_minpos_epu16_wrap(__m128i v)369fc7fb27SEric Christopher __m128i __attribute__((__target__("sse4.1"))) mm_minpos_epu16_wrap(__m128i v) {
379fc7fb27SEric Christopher return _mm_minpos_epu16(v);
389fc7fb27SEric Christopher }
399fc7fb27SEric Christopher
mm_crc32_u8_wrap(unsigned int c,unsigned char d)409fc7fb27SEric Christopher unsigned int __attribute__((__target__("sse4.2"))) mm_crc32_u8_wrap(unsigned int c, unsigned char d) {
419fc7fb27SEric Christopher return _mm_crc32_u8(c, d);
429fc7fb27SEric Christopher }
439fc7fb27SEric Christopher
mm_aesenc_si128_wrap(__m128i v,__m128i r)449fc7fb27SEric Christopher __m128i __attribute__((__target__("aes"))) mm_aesenc_si128_wrap(__m128i v, __m128i r) {
459fc7fb27SEric Christopher return _mm_aesenc_si128(v, r);
469fc7fb27SEric Christopher }
479fc7fb27SEric Christopher
mm256_add_pd_wrap(__m256d a,__m256d b)489fc7fb27SEric Christopher __m256d __attribute__((__target__("avx"))) mm256_add_pd_wrap(__m256d a, __m256d b) {
499fc7fb27SEric Christopher return _mm256_add_pd(a, b);
509fc7fb27SEric Christopher }
519fc7fb27SEric Christopher
mm256_abs_epi8_wrap(__m256i a)529fc7fb27SEric Christopher __m256i __attribute__((__target__("avx2"))) mm256_abs_epi8_wrap(__m256i a) {
539fc7fb27SEric Christopher return _mm256_abs_epi8(a);
549fc7fb27SEric Christopher }
559fc7fb27SEric Christopher
tzcnt_u16_wrap(unsigned short x)569fc7fb27SEric Christopher unsigned short __attribute__((__target__("bmi"))) tzcnt_u16_wrap(unsigned short x) {
579fc7fb27SEric Christopher return __tzcnt_u16(x);
589fc7fb27SEric Christopher }
599fc7fb27SEric Christopher
bzhi_u32_wrap(unsigned int x,unsigned int y)609fc7fb27SEric Christopher unsigned int __attribute__((__target__("bmi2"))) bzhi_u32_wrap(unsigned int x, unsigned int y) {
619fc7fb27SEric Christopher return _bzhi_u32(x, y);
629fc7fb27SEric Christopher }
639fc7fb27SEric Christopher
lzcnt16_wrap(unsigned short x)649fc7fb27SEric Christopher unsigned short __attribute__((__target__("lzcnt"))) lzcnt16_wrap(unsigned short x) {
659fc7fb27SEric Christopher return __lzcnt16(x);
669fc7fb27SEric Christopher }
679fc7fb27SEric Christopher
mm256_fmsubadd_pd_wrap(__m256d a,__m256d b,__m256d c)689fc7fb27SEric Christopher __m256d __attribute__((__target__("fma"))) mm256_fmsubadd_pd_wrap(__m256d a, __m256d b, __m256d c) {
699fc7fb27SEric Christopher return _mm256_fmsubadd_pd(a, b, c);
709fc7fb27SEric Christopher }
719fc7fb27SEric Christopher
mm512_setzero_si512_wrap(void)729fc7fb27SEric Christopher __m512i __attribute__((__target__("avx512f"))) mm512_setzero_si512_wrap(void) {
739fc7fb27SEric Christopher return _mm512_setzero_si512();
749fc7fb27SEric Christopher }
759fc7fb27SEric Christopher
mm_cmpeq_epi32_mask_wrap(__m128i a,__m128i b)769fc7fb27SEric Christopher __mmask8 __attribute__((__target__("avx512vl"))) mm_cmpeq_epi32_mask_wrap(__m128i a, __m128i b) {
779fc7fb27SEric Christopher return _mm_cmpeq_epi32_mask(a, b);
789fc7fb27SEric Christopher }
799fc7fb27SEric Christopher
mm512_mullo_epi64_wrap(__m512i a,__m512i b)809fc7fb27SEric Christopher __m512i __attribute__((__target__("avx512dq"))) mm512_mullo_epi64_wrap(__m512i a, __m512i b) {
819fc7fb27SEric Christopher return _mm512_mullo_epi64(a, b);
829fc7fb27SEric Christopher }
839fc7fb27SEric Christopher
mm_cmpeq_epi8_mask_wrap(__m128i a,__m128i b)849fc7fb27SEric Christopher __mmask16 __attribute__((__target__("avx512vl,avx512bw"))) mm_cmpeq_epi8_mask_wrap(__m128i a, __m128i b) {
859fc7fb27SEric Christopher return _mm_cmpeq_epi8_mask(a, b);
869fc7fb27SEric Christopher }
879fc7fb27SEric Christopher
mm256_mullo_epi64_wrap(__m256i a,__m256i b)889fc7fb27SEric Christopher __m256i __attribute__((__target__("avx512vl,avx512dq"))) mm256_mullo_epi64_wrap(__m256i a, __m256i b) {
899fc7fb27SEric Christopher return _mm256_mullo_epi64(a, b);
909fc7fb27SEric Christopher }
919fc7fb27SEric Christopher
rdrand16_step_wrap(unsigned short * p)929fc7fb27SEric Christopher int __attribute__((__target__("rdrnd"))) rdrand16_step_wrap(unsigned short *p) {
939fc7fb27SEric Christopher return _rdrand16_step(p);
949fc7fb27SEric Christopher }
959fc7fb27SEric Christopher
9624d9b7d2SNAKAMURA Takumi #if defined(__x86_64__)
readfsbase_u32_wrap(void)979fc7fb27SEric Christopher unsigned int __attribute__((__target__("fsgsbase"))) readfsbase_u32_wrap(void) {
989fc7fb27SEric Christopher return _readfsbase_u32();
999fc7fb27SEric Christopher }
10024d9b7d2SNAKAMURA Takumi #endif
1019fc7fb27SEric Christopher
xbegin_wrap(void)1029fc7fb27SEric Christopher unsigned int __attribute__((__target__("rtm"))) xbegin_wrap(void) {
1039fc7fb27SEric Christopher return _xbegin();
1049fc7fb27SEric Christopher }
1059fc7fb27SEric Christopher
mm_sha1nexte_epu32_wrap(__m128i x,__m128i y)1069fc7fb27SEric Christopher __m128i __attribute__((__target__("sha"))) mm_sha1nexte_epu32_wrap(__m128i x, __m128i y) {
1079fc7fb27SEric Christopher return _mm_sha1nexte_epu32(x, y);
1089fc7fb27SEric Christopher }
1099fc7fb27SEric Christopher
rdseed16_step_wrap(unsigned short * p)1109fc7fb27SEric Christopher int __attribute__((__target__("rdseed"))) rdseed16_step_wrap(unsigned short *p) {
1119fc7fb27SEric Christopher return _rdseed16_step(p);
1129fc7fb27SEric Christopher }
1139fc7fb27SEric Christopher
mm_extract_si64_wrap(__m128i x,__m128i y)1149fc7fb27SEric Christopher __m128i __attribute__((__target__("sse4a"))) mm_extract_si64_wrap(__m128i x, __m128i y) {
1159fc7fb27SEric Christopher return _mm_extract_si64(x, y);
1169fc7fb27SEric Christopher }
1179fc7fb27SEric Christopher
mm_macc_ps_wrap(__m128 a,__m128 b,__m128 c)1189fc7fb27SEric Christopher __m128 __attribute__((__target__("fma4"))) mm_macc_ps_wrap(__m128 a, __m128 b, __m128 c) {
1199fc7fb27SEric Christopher return _mm_macc_ps(a, b, c);
1209fc7fb27SEric Christopher }
1219fc7fb27SEric Christopher
mm256_frcz_ps_wrap(__m256 a)1229fc7fb27SEric Christopher __m256 __attribute__((__target__("xop"))) mm256_frcz_ps_wrap(__m256 a) {
1239fc7fb27SEric Christopher return _mm256_frcz_ps(a);
1249fc7fb27SEric Christopher }
1259fc7fb27SEric Christopher
blcfill_u32_wrap(unsigned int a)1269fc7fb27SEric Christopher unsigned int __attribute__((__target__("tbm"))) blcfill_u32_wrap(unsigned int a) {
1279fc7fb27SEric Christopher return __blcfill_u32(a);
1289fc7fb27SEric Christopher }
1299fc7fb27SEric Christopher
mm_cvtph_ps_wrap(__m128i a)1309fc7fb27SEric Christopher __m128 __attribute__((__target__("f16c"))) mm_cvtph_ps_wrap(__m128i a) {
1319fc7fb27SEric Christopher return _mm_cvtph_ps(a);
1329fc7fb27SEric Christopher }
1339fc7fb27SEric Christopher
xtest_wrap(void)1343d920eedSEric Christopher int __attribute__((__target__("rtm"))) xtest_wrap(void) {
1353d920eedSEric Christopher return _xtest();
1363d920eedSEric Christopher }
137