[flang] Fix crash in HLFIR generation (#118399)
[llvm-project.git] / clang / test / CodeGen / target-features-error-2.c
blob1599b0135b747f981da0c4a9c05a2c3e67b51a5d
1 // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_1
2 // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_2
3 // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX512f
4 // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +movdir64b -S -verify -o - -D NEED_MOVDIRI
5 // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +avx512vnni -target-feature +movdiri -S -verify -o - -D NEED_CLWB
7 #define __MM_MALLOC_H
8 #include <x86intrin.h>
10 #if NEED_AVX_1
11 int baz(__m256i a) {
12 return _mm256_extract_epi32(a, 3); // expected-error {{'__builtin_ia32_vec_ext_v8si' needs target feature avx}}
14 #endif
16 #if NEED_AVX_2
17 __m128 need_avx(__m128 a, __m128 b) {
18 return _mm_cmp_ps(a, b, 8); // expected-error {{'__builtin_ia32_cmpps' needs target feature avx}}
20 #endif
22 #if NEED_AVX512f
23 unsigned short need_avx512f(unsigned short a, unsigned short b) {
24 return __builtin_ia32_korhi(a, b); // expected-error {{'__builtin_ia32_korhi' needs target feature avx512f}}
26 #endif
28 #if NEED_MOVDIRI
29 void need_movdiri(unsigned int *a, unsigned int b) {
30 __builtin_ia32_directstore_u32(a, b); // expected-error {{'__builtin_ia32_directstore_u32' needs target feature movdiri}}
32 #endif
34 #if NEED_CLWB
35 static __inline__ void
36 __attribute__((__always_inline__, __nodebug__, __target__("avx512vnni,clwb,movdiri,movdir64b")))
37 func(unsigned int *a, unsigned int b)
39 __builtin_ia32_directstore_u32(a, b);
42 void need_clwb(unsigned int *a, unsigned int b) {
43 func(a, b); // expected-error {{always_inline function 'func' requires target feature 'clwb', but would be inlined into function 'need_clwb' that is compiled without support for 'clwb'}}
46 #endif