xref: /llvm-project/clang/test/CodeGen/X86/avx512-error.c (revision f5e48fed043eaa24546aeaa656cb88342d3085e6)
1 // RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +avx512bw -target-feature -evex512 -emit-llvm -o /dev/null -verify=noevex
2 // RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +avx512bw -emit-llvm -o /dev/null -verify
3 // RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +avx10.1-256 -emit-llvm -o /dev/null -verify=noevex
4 // RUN: %clang_cc1 %s -ffreestanding -triple=x86_64-unknown-unknown -target-feature +avx10.1-512 -emit-llvm -o /dev/null -verify
5 
6 #include <immintrin.h>
7 
8 // No error emitted whether we have "evex512" feature or not.
9 __attribute__((target("avx512bw,no-evex512")))
k64_verify_1(__mmask64 a)10 __mmask64 k64_verify_1(__mmask64 a) {
11   return _knot_mask64(a); // expected-no-diagnostics
12 }
13 
k64_verify_2(__mmask64 a)14 __mmask64 k64_verify_2(__mmask64 a) {
15   return _knot_mask64(a); // expected-no-diagnostic
16 }
17 
18 __attribute__((target("avx512bw,evex512")))
zmm_verify_ok(__m512d a)19 __m512d zmm_verify_ok(__m512d a) {
20   // No error emitted if we have "evex512" feature.
21   return __builtin_ia32_sqrtpd512(a, _MM_FROUND_CUR_DIRECTION); // expected-no-diagnostic
22 }
23 
zmm_error(__m512d a)24 __m512d zmm_error(__m512d a) {
25   // CHECK-LABEL: @test_mm512_sqrt_pd
26   return __builtin_ia32_sqrtpd512(a, _MM_FROUND_CUR_DIRECTION); // noevex-error {{'__builtin_ia32_sqrtpd512' needs target feature avx512f,evex512}}
27 }
28 #if defined(__AVX10_1__) && !defined(__AVX10_1_512__)
29 // noevex-warning@*:* {{invalid feature combination: +avx512bw +avx10.1-256; will be promoted to avx10.1-512}}
30 // noevex-warning@*:* {{invalid feature combination: +avx512bw +avx10.1-256; will be promoted to avx10.1-512}}
31 // noevex-warning@*:* {{invalid feature combination: +avx512bw +avx10.1-256; will be promoted to avx10.1-512}}
32 #endif
33