| 1 |
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify %s |
| 2 |
|
| 3 |
void __attribute__((target_clones("fp16+sve2-aes", "sb+sve2-sha3+rcpc3+mops", "rdma"))) no_def(void); |
| 4 |
|
| 5 |
// expected-warning@+1 {{unsupported 'default' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 6 |
void __attribute__((target_clones("default+sha3"))) warn1(void); |
| 7 |
|
| 8 |
// expected-error@+2 {{'target_clones' and 'target_version' attributes are not compatible}} |
| 9 |
// expected-note@+1 {{conflicting attribute is here}} |
| 10 |
void __attribute__((target_version("sve"), target_clones("sme+memtag"))) not_compat(void); |
| 11 |
|
| 12 |
int redecl(void); |
| 13 |
int __attribute__((target_clones("frintts", "simd+fp", "default"))) redecl(void) { return 1; } |
| 14 |
|
| 15 |
int __attribute__((target_clones("jscvt+fcma", "rcpc", "default"))) redecl2(void); |
| 16 |
// expected-error@+2 {{'target_clones' attribute does not match previous declaration}} |
| 17 |
// expected-note@-2 {{previous declaration is here}} |
| 18 |
int __attribute__((target_clones("jscvt+fcma", "rcpc"))) redecl2(void) { return 1; } |
| 19 |
|
| 20 |
int __attribute__((target_clones("sve+dotprod"))) redecl3(void); |
| 21 |
int redecl3(void); |
| 22 |
|
| 23 |
int __attribute__((target_clones("rng", "fp16fml+fp", "default"))) redecl4(void); |
| 24 |
// expected-error@+2 {{'target_clones' attribute does not match previous declaration}} |
| 25 |
// expected-note@-2 {{previous declaration is here}} |
| 26 |
int __attribute__((target_clones("dit", "bf16+dpb", "default"))) redecl4(void) { return 1; } |
| 27 |
|
| 28 |
int __attribute__((target_version("flagm2"))) redef2(void) { return 1; } |
| 29 |
// expected-error@+2 {{multiversioned function redeclarations require identical target attributes}} |
| 30 |
// expected-note@-2 {{previous declaration is here}} |
| 31 |
int __attribute__((target_clones("flagm2", "default"))) redef2(void) { return 1; } |
| 32 |
|
| 33 |
int __attribute__((target_clones("f32mm", "f64mm", "sha2+fp"))) redef3(void) { return 1; } |
| 34 |
// expected-error@+2 {{'target_clones' attribute does not match previous declaration}} |
| 35 |
// expected-note@-2 {{previous declaration is here}} |
| 36 |
int __attribute__((target_clones("f32mm", "sha2+fp", "f64mm"))) redef3(void) { return 1; } |
| 37 |
|
| 38 |
int __attribute__((target_clones("rdm+lse+rdm", "lse+rdm"))) dup1(void) { return 1; } |
| 39 |
// expected-warning@+1 {{version list contains duplicate entries}} |
| 40 |
int __attribute__((target_clones("rdm+lse+rdm", "rdm+lse+rdm"))) dup2(void) { return 2; } |
| 41 |
// expected-warning@+1 {{version list contains duplicate entries}} |
| 42 |
int __attribute__((target_clones("rcpc2+sve2-aes", "rcpc2+sve2-aes"))) dup3(void) { return 3; } |
| 43 |
// expected-warning@+1 {{version list contains duplicate entries}} |
| 44 |
void __attribute__((target_clones("sha3", "default", "default"))) dup4(void); |
| 45 |
// expected-warning@+2 {{version list contains duplicate entries}} |
| 46 |
// expected-warning@+1 {{version list contains duplicate entries}} |
| 47 |
int __attribute__((target_clones("fp", "fp", "crc+dotprod", "dotprod+crc"))) dup5(void) { return 5; } |
| 48 |
|
| 49 |
// expected-warning@+1 {{version list contains duplicate entries}} |
| 50 |
int __attribute__((target_clones("fp16+memtag", "memtag+fp16"))) dup6(void) { return 6; } |
| 51 |
|
| 52 |
// expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}} |
| 53 |
void __attribute__((target_clones(""))) empty_target_1(void); |
| 54 |
// expected-warning@+3 {{unsupported 'default' in the 'target_clones' attribute string;}} |
| 55 |
// expected-warning@+2 {{unsupported 'default' in the 'target_clones' attribute string;}} |
| 56 |
// expected-warning@+1 {{version list contains entries that don't impact code generation}} |
| 57 |
void __attribute__((target_clones("default+default"))) empty_target_2(void); |
| 58 |
// expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}} |
| 59 |
void __attribute__((target_clones("+sve2"))) |
| 60 |
empty_target_3(void); |
| 61 |
// expected-warning@+1 {{unsupported 'bs' in the 'target_clones' attribute string;}} |
| 62 |
void __attribute__((target_clones("sb+bs"))) |
| 63 |
empty_target_4(void); |
| 64 |
|
| 65 |
// expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}} |
| 66 |
void __attribute__((target_clones("default", ""))) |
| 67 |
empty_target_5(void); |
| 68 |
|
| 69 |
// expected-warning@+1 {{version list contains duplicate entries}} |
| 70 |
void __attribute__((target_clones("sve2-bitperm", "sve2-bitperm"))) |
| 71 |
dupe_normal(void); |
| 72 |
|
| 73 |
void __attribute__((target_clones("default"), target_clones("memtag+bti"))) dupe_normal2(void); |
| 74 |
|
| 75 |
int mv_after_use(void); |
| 76 |
int useage(void) { |
| 77 |
return mv_after_use(); |
| 78 |
} |
| 79 |
// expected-error@+1 {{function declaration cannot become a multiversioned function after first usage}} |
| 80 |
int __attribute__((target_clones("sve2-sha3+ssbs", "sm4"))) mv_after_use(void) { return 1; } |
| 81 |
// expected-error@+1 {{'main' cannot be a multiversioned function}} |
| 82 |
int __attribute__((target_clones("i8mm"))) main() { return 1; } |
| 83 |
|
| 84 |
int __attribute__((target_clones("aes + sve2 ; priority=100", "default"))) priority_whitespace(void) { return 0; } |
| 85 |
|
| 86 |
//expected-warning@+2 {{unsupported 'priority=10' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 87 |
//expected-warning@+1 {{version list contains entries that don't impact code generation}} |
| 88 |
int __attribute__((target_clones("priority=10;aes", "default"))) priority_before_features(void) { return 0; } |
| 89 |
|
| 90 |
//expected-warning@+1 {{version priority '0' is outside the allowed range [1-255]; ignoring priority}} |
| 91 |
int __attribute__((target_clones("aes;priority=0", "default"))) priority_out_of_range(void) { return 0; } |
| 92 |
|
| 93 |
//expected-warning@+1 {{priority of default version cannot be overridden; ignoring priority}} |
| 94 |
int __attribute__((target_clones("aes", "default;priority=10"))) priority_default_version(void) { return 0; } |