47 lines · c
1// RUN: %clang_cc1 -triple aarch64 -target-feature +v8a -verify -DHAS8 -S %s -o -2// RUN: %clang_cc1 -triple aarch64 -target-feature +v8.1a -verify -DHAS81 -S %s -o -3// RUN: %clang_cc1 -triple aarch64 -target-feature +v9a -verify -DHAS9 -S %s -o -4// REQUIRES: aarch64-registered-target5 6#ifdef HAS97// expected-no-diagnostics8#endif9 10#include <arm_acle.h>11#include <arm_fp16.h>12#include <arm_sve.h>13 14__attribute__((target("arch=armv8.1-a")))15int test_crc_attr()16{17 return __crc32cd(1, 1);18}19 20__attribute__((target("arch=armv9-a")))21svint8_t test_svadd_attr(svbool_t pg, svint8_t op1, svint8_t op2)22{23 return svadd_s8_z(pg, op1, op2);24}25 26__attribute__((target("arch=armv9-a")))27float16_t test_fp16_on_v9(float16_t x, float16_t y)28{29 return vabdh_f16(x, y);30}31 32void test_error1()33{34#ifdef HAS835// expected-error@+2{{always_inline function '__crc32cd' requires target feature 'crc'}}36#endif37 __crc32cd(1, 1);38}39 40void test_error2()41{42#if defined(HAS8) || defined(HAS81)43// expected-error@+2{{SVE vector type 'svint8_t' (aka '__SVInt8_t') cannot be used in a target without sve}}44#endif45 svundef_s8();46}47