| 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-target |
| 5 |
|
| 6 |
#ifdef HAS9 |
| 7 |
// expected-no-diagnostics |
| 8 |
#endif |
| 9 |
|
| 10 |
#include <arm_acle.h> |
| 11 |
#include <arm_fp16.h> |
| 12 |
#include <arm_sve.h> |
| 13 |
|
| 14 |
__attribute__((target("arch=armv8.1-a"))) |
| 15 |
int test_crc_attr() |
| 16 |
{ |
| 17 |
return __crc32cd(1, 1); |
| 18 |
} |
| 19 |
|
| 20 |
__attribute__((target("arch=armv9-a"))) |
| 21 |
svint8_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"))) |
| 27 |
float16_t test_fp16_on_v9(float16_t x, float16_t y) |
| 28 |
{ |
| 29 |
return vabdh_f16(x, y); |
| 30 |
} |
| 31 |
|
| 32 |
void test_error1() |
| 33 |
{ |
| 34 |
#ifdef HAS8 |
| 35 |
// expected-error@+2{{always_inline function '__crc32cd' requires target feature 'crc'}} |
| 36 |
#endif |
| 37 |
__crc32cd(1, 1); |
| 38 |
} |
| 39 |
|
| 40 |
void 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 |
#endif |
| 45 |
svundef_s8(); |
| 46 |
} |