1 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify %s
3 void __attribute__((target_clones("fp16+sve2-aes", "sb+sve2-sha3+rcpc3+mops", "rdma"))) no_def(void);
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);
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);
13 int __attribute__((target_clones("frintts", "simd+fp", "default"))) redecl(void) { return 1; }
15 int __attribute__((target_clones("jscvt+fcma", "rcpc", "default"))) redecl2(void);
16 int __attribute__((target_clones("jscvt+fcma", "rcpc"))) redecl2(void) { return 1; }
18 int __attribute__((target_clones("sve+dotprod"))) redecl3(void);
21 int __attribute__((target_clones("rng", "fp16fml+fp", "default"))) redecl4(void);
22 // expected-error@+2 {{'target_clones' attribute does not match previous declaration}}
23 // expected-note@-2 {{previous declaration is here}}
24 int __attribute__((target_clones("dit", "bf16+dpb", "default"))) redecl4(void) { return 1; }
26 int __attribute__((target_version("flagm2"))) redef2(void) { return 1; }
27 // expected-error@+2 {{multiversioned function redeclarations require identical target attributes}}
28 // expected-note@-2 {{previous declaration is here}}
29 int __attribute__((target_clones("flagm2", "default"))) redef2(void) { return 1; }
31 int __attribute__((target_clones("f32mm", "f64mm", "sha2+fp"))) redef3(void) { return 1; }
32 // expected-error@+2 {{'target_clones' attribute does not match previous declaration}}
33 // expected-note@-2 {{previous declaration is here}}
34 int __attribute__((target_clones("f32mm", "sha2+fp", "f64mm"))) redef3(void) { return 1; }
36 int __attribute__((target_clones("rdm+lse+rdm", "lse+rdm"))) dup1(void) { return 1; }
37 // expected-warning@+1 {{version list contains duplicate entries}}
38 int __attribute__((target_clones("rdm+lse+rdm", "rdm+lse+rdm"))) dup2(void) { return 2; }
39 // expected-warning@+1 {{version list contains duplicate entries}}
40 int __attribute__((target_clones("rcpc2+sve2-aes", "rcpc2+sve2-aes"))) dup3(void) { return 3; }
41 // expected-warning@+1 {{version list contains duplicate entries}}
42 void __attribute__((target_clones("sha3", "default", "default"))) dup4(void);
43 // expected-warning@+2 {{version list contains duplicate entries}}
44 // expected-warning@+1 {{version list contains duplicate entries}}
45 int __attribute__((target_clones("fp", "fp", "crc+dotprod", "dotprod+crc"))) dup5(void) { return 5; }
47 // expected-warning@+1 {{version list contains duplicate entries}}
48 int __attribute__((target_clones("fp16+memtag", "memtag+fp16"))) dup6(void) { return 6; }
50 // expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}}
51 void __attribute__((target_clones(""))) empty_target_1(void);
52 // expected-warning@+3 {{unsupported 'default' in the 'target_clones' attribute string;}}
53 // expected-warning@+2 {{unsupported 'default' in the 'target_clones' attribute string;}}
54 // expected-warning@+1 {{version list contains entries that don't impact code generation}}
55 void __attribute__((target_clones("default+default"))) empty_target_2(void);
56 // expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}}
57 void __attribute__((target_clones("+sve2")))
59 // expected-warning@+1 {{unsupported 'bs' in the 'target_clones' attribute string;}}
60 void __attribute__((target_clones("sb+bs")))
63 // expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}}
64 void __attribute__((target_clones("default", "")))
67 // expected-warning@+1 {{version list contains duplicate entries}}
68 void __attribute__((target_clones("sve2-bitperm", "sve2-bitperm")))
71 void __attribute__((target_clones("default"), target_clones("memtag+bti"))) dupe_normal2(void);
73 int mv_after_use(void);
75 return mv_after_use();
77 // expected-error@+1 {{function declaration cannot become a multiversioned function after first usage}}
78 int __attribute__((target_clones("sve2-sha3+ssbs", "sm4"))) mv_after_use(void) { return 1; }
79 // expected-error@+1 {{'main' cannot be a multiversioned function}}
80 int __attribute__((target_clones("i8mm"))) main() { return 1; }