1 // RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -ffreestanding -Wcast-qual %s -verify
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -ffreestanding -Wcast-qual %s -verify
3 // RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -ffreestanding -flax-vector-conversions=none -Wcast-qual %s -verify
4 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -ffreestanding -flax-vector-conversions=none -Wcast-qual %s -verify
5 // RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -ffreestanding -Wcast-qual -x c++ %s -verify
6 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -ffreestanding -Wcast-qual -x c++ %s -verify
7 // expected-no-diagnostics
9 // Include the metaheader that includes all x86 intrinsic headers.
10 #include <x86intrin.h>
12 void __attribute__((__target__("mmx"))) mm_empty_wrap(void) {
16 __m128
__attribute__((__target__("sse"))) mm_add_ss_wrap(__m128 a
, __m128 b
) {
17 return _mm_add_ss(a
, b
);
20 void __attribute__((__target__("sse"))) mm_prefetch_wrap(const void *p
) {
24 __m128d
__attribute__((__target__("sse2"))) mm_sqrt_sd_wrap(__m128d a
, __m128d b
) {
25 return _mm_sqrt_sd(a
, b
);
28 void __attribute__((__target__("sse3"))) mm_mwait_wrap(int a
) {
32 __m64
__attribute__((__target__("ssse3"))) mm_abs_pi8_wrap(__m64 a
) {
33 return _mm_abs_pi8(a
);
36 __m128i
__attribute__((__target__("sse4.1"))) mm_minpos_epu16_wrap(__m128i v
) {
37 return _mm_minpos_epu16(v
);
40 unsigned int __attribute__((__target__("sse4.2"))) mm_crc32_u8_wrap(unsigned int c
, unsigned char d
) {
41 return _mm_crc32_u8(c
, d
);
44 __m128i
__attribute__((__target__("aes"))) mm_aesenc_si128_wrap(__m128i v
, __m128i r
) {
45 return _mm_aesenc_si128(v
, r
);
48 __m256d
__attribute__((__target__("avx"))) mm256_add_pd_wrap(__m256d a
, __m256d b
) {
49 return _mm256_add_pd(a
, b
);
52 __m256i
__attribute__((__target__("avx2"))) mm256_abs_epi8_wrap(__m256i a
) {
53 return _mm256_abs_epi8(a
);
56 unsigned short __attribute__((__target__("bmi"))) tzcnt_u16_wrap(unsigned short x
) {
57 return __tzcnt_u16(x
);
60 unsigned int __attribute__((__target__("bmi2"))) bzhi_u32_wrap(unsigned int x
, unsigned int y
) {
61 return _bzhi_u32(x
, y
);
64 unsigned short __attribute__((__target__("lzcnt"))) lzcnt16_wrap(unsigned short x
) {
68 __m256d
__attribute__((__target__("fma"))) mm256_fmsubadd_pd_wrap(__m256d a
, __m256d b
, __m256d c
) {
69 return _mm256_fmsubadd_pd(a
, b
, c
);
72 __m512i
__attribute__((__target__("avx512f"))) mm512_setzero_si512_wrap(void) {
73 return _mm512_setzero_si512();
76 __mmask8
__attribute__((__target__("avx512vl"))) mm_cmpeq_epi32_mask_wrap(__m128i a
, __m128i b
) {
77 return _mm_cmpeq_epi32_mask(a
, b
);
80 __m512i
__attribute__((__target__("avx512dq"))) mm512_mullo_epi64_wrap(__m512i a
, __m512i b
) {
81 return _mm512_mullo_epi64(a
, b
);
84 __mmask16
__attribute__((__target__("avx512vl,avx512bw"))) mm_cmpeq_epi8_mask_wrap(__m128i a
, __m128i b
) {
85 return _mm_cmpeq_epi8_mask(a
, b
);
88 __m256i
__attribute__((__target__("avx512vl,avx512dq"))) mm256_mullo_epi64_wrap(__m256i a
, __m256i b
) {
89 return _mm256_mullo_epi64(a
, b
);
92 int __attribute__((__target__("rdrnd"))) rdrand16_step_wrap(unsigned short *p
) {
93 return _rdrand16_step(p
);
96 #if defined(__x86_64__)
97 unsigned int __attribute__((__target__("fsgsbase"))) readfsbase_u32_wrap(void) {
98 return _readfsbase_u32();
102 unsigned int __attribute__((__target__("rtm"))) xbegin_wrap(void) {
106 __m128i
__attribute__((__target__("sha"))) mm_sha1nexte_epu32_wrap(__m128i x
, __m128i y
) {
107 return _mm_sha1nexte_epu32(x
, y
);
110 int __attribute__((__target__("rdseed"))) rdseed16_step_wrap(unsigned short *p
) {
111 return _rdseed16_step(p
);
114 __m128i
__attribute__((__target__("sse4a"))) mm_extract_si64_wrap(__m128i x
, __m128i y
) {
115 return _mm_extract_si64(x
, y
);
118 __m128
__attribute__((__target__("fma4"))) mm_macc_ps_wrap(__m128 a
, __m128 b
, __m128 c
) {
119 return _mm_macc_ps(a
, b
, c
);
122 __m256
__attribute__((__target__("xop"))) mm256_frcz_ps_wrap(__m256 a
) {
123 return _mm256_frcz_ps(a
);
126 unsigned int __attribute__((__target__("tbm"))) blcfill_u32_wrap(unsigned int a
) {
127 return __blcfill_u32(a
);
130 __m128
__attribute__((__target__("f16c"))) mm_cvtph_ps_wrap(__m128i a
) {
131 return _mm_cvtph_ps(a
);
134 int __attribute__((__target__("rtm"))) xtest_wrap(void) {