xref: /aosp_15_r20/external/clang/test/CodeGen/target-builtin-error-3.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -S -verify -o - -target-feature +avx
2*67e74705SXin Li 
3*67e74705SXin Li // RUN: not %clang_cc1 %s -triple=x86_64-apple-darwin -emit-obj -target-feature +avx 2> %t.err
4*67e74705SXin Li // RUN: FileCheck < %t.err %s
5*67e74705SXin Li // CHECK: 1 error generated
6*67e74705SXin Li 
7*67e74705SXin Li typedef unsigned short uint16_t;
8*67e74705SXin Li typedef long long __m128i __attribute__((__vector_size__(16)));
9*67e74705SXin Li typedef float __v8sf __attribute__ ((__vector_size__ (32)));
10*67e74705SXin Li typedef float __m256 __attribute__ ((__vector_size__ (32)));
11*67e74705SXin Li typedef uint16_t half;
12*67e74705SXin Li typedef __attribute__ ((ext_vector_type( 8),__aligned__( 16))) half half8;
13*67e74705SXin Li typedef __attribute__ ((ext_vector_type(16),__aligned__( 32))) half half16;
14*67e74705SXin Li typedef __attribute__ ((ext_vector_type(16),__aligned__( 2))) half half16U;
15*67e74705SXin Li typedef __attribute__ ((ext_vector_type( 8),__aligned__( 32))) float float8;
16*67e74705SXin Li typedef __attribute__ ((ext_vector_type(16),__aligned__( 64))) float float16;
convert_half(float8 a)17*67e74705SXin Li static inline half8 __attribute__((__overloadable__)) convert_half( float8 a ) {
18*67e74705SXin Li   return __extension__ ({ __m256 __a = (a); (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)__a, (0x00)); }); // expected-error {{'__builtin_ia32_vcvtps2ph256' needs target feature f16c}}
19*67e74705SXin Li }
convert_half(float16 a)20*67e74705SXin Li static inline half16 __attribute__((__overloadable__)) convert_half( float16 a ) {
21*67e74705SXin Li   half16 r;
22*67e74705SXin Li   r.lo = convert_half( a.lo);
23*67e74705SXin Li   return r;
24*67e74705SXin Li }
avx_test(uint16_t * destData,float16 argbF)25*67e74705SXin Li void avx_test( uint16_t *destData, float16 argbF)
26*67e74705SXin Li {
27*67e74705SXin Li    ((half16U*)destData)[0] = convert_half(argbF);
28*67e74705SXin Li }
29