Rui Ueyama | 0fcbb28 | 2017-04-26 23:15:10 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_SSE42 |
Sanjay Patel | a4d1569 | 2016-06-21 20:22:55 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_1 |
| 3 | // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_2 |
| 4 | // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_3 |
| 5 | // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_4 |
| 6 | |
Eric Christopher | 2b2d56f | 2015-11-12 00:44:12 +0000 | [diff] [blame] | 7 | #define __MM_MALLOC_H |
| 8 | #include <x86intrin.h> |
| 9 | |
Rui Ueyama | 0fcbb28 | 2017-04-26 23:15:10 +0000 | [diff] [blame^] | 10 | #if NEED_SSE42 |
Eric Christopher | 2b2d56f | 2015-11-12 00:44:12 +0000 | [diff] [blame] | 11 | int baz(__m256i a) { |
Rui Ueyama | 0fcbb28 | 2017-04-26 23:15:10 +0000 | [diff] [blame^] | 12 | return _mm256_extract_epi32(a, 3); // expected-error {{always_inline function '_mm256_extract_epi32' requires target feature 'sse4.2', but would be inlined into function 'baz' that is compiled without support for 'sse4.2'}} |
Eric Christopher | 2b2d56f | 2015-11-12 00:44:12 +0000 | [diff] [blame] | 13 | } |
Sanjay Patel | a4d1569 | 2016-06-21 20:22:55 +0000 | [diff] [blame] | 14 | #endif |
| 15 | |
| 16 | #if NEED_AVX_1 |
| 17 | __m128 need_avx(__m128 a, __m128 b) { |
| 18 | return _mm_cmp_ps(a, b, 0); // expected-error {{'__builtin_ia32_cmpps' needs target feature avx}} |
| 19 | } |
| 20 | #endif |
| 21 | |
| 22 | #if NEED_AVX_2 |
| 23 | __m128 need_avx(__m128 a, __m128 b) { |
| 24 | return _mm_cmp_ss(a, b, 0); // expected-error {{'__builtin_ia32_cmpss' needs target feature avx}} |
| 25 | } |
| 26 | #endif |
| 27 | |
| 28 | #if NEED_AVX_3 |
| 29 | __m128d need_avx(__m128d a, __m128d b) { |
| 30 | return _mm_cmp_pd(a, b, 0); // expected-error {{'__builtin_ia32_cmppd' needs target feature avx}} |
| 31 | } |
| 32 | #endif |
| 33 | |
| 34 | #if NEED_AVX_4 |
| 35 | __m128d need_avx(__m128d a, __m128d b) { |
| 36 | return _mm_cmp_sd(a, b, 0); // expected-error {{'__builtin_ia32_cmpsd' needs target feature avx}} |
| 37 | } |
| 38 | #endif |