brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 056dc94 Raw
50 lines · c
1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -S -verify -o - -target-feature +avx2 3// RUN: not %clang_cc1 %s -triple=x86_64-apple-darwin -emit-obj -target-feature +avx 2> %t.err4// RUN: FileCheck < %t.err %s5// CHECK: 1 error generated6 7typedef unsigned short uint16_t;8typedef long long __m128i __attribute__((__vector_size__(16)));9typedef float __v8sf __attribute__ ((__vector_size__ (32)));10typedef float __m256 __attribute__ ((__vector_size__ (32)));11typedef uint16_t half;12typedef __attribute__ ((ext_vector_type( 8),__aligned__( 16))) half half8;13typedef __attribute__ ((ext_vector_type(16),__aligned__( 32))) half half16;14typedef __attribute__ ((ext_vector_type(16),__aligned__( 2))) half half16U;15typedef __attribute__ ((ext_vector_type( 8),__aligned__( 32))) float float8;16typedef __attribute__ ((ext_vector_type(16),__aligned__( 64))) float float16;17static inline half8 __attribute__((__overloadable__)) convert_half( float8 a ) {18  return __extension__ ({ __m256 __a = (a); (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)__a, (0x00)); }); // expected-error {{'__builtin_ia32_vcvtps2ph256' needs target feature f16c}}19}20static inline half16 __attribute__((__overloadable__)) convert_half( float16 a ) {21  half16 r;22  r.lo = convert_half(a.lo);23  return r;24}25void avx_test( uint16_t *destData, float16 argbF)26{27  ((half16U *)destData)[0] = convert_half(argbF);28}29 30half16 test( float16 a ) {31  half16 r;32  r.lo = convert_half(a.lo);33  return r;34}35void avx_test2( uint16_t *destData, float16 argbF)36{37  // expected-warning@+1{{AVX vector argument of type 'float16' (vector of 16 'float' values) without 'avx512f' enabled changes the ABI}}38  ((half16U *)destData)[0] = test(argbF);39}40 41__attribute__((always_inline)) half16 test2( float16 a ) {42  half16 r;43  r.lo = convert_half(a.lo);44  return r;45}46void avx_test3( uint16_t *destData, float16 argbF)47{48  ((half16U *)destData)[0] = test2(argbF);49}50