1 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify %s
3 void __attribute__((target_clones("fp16+sve2-aes", "sb+sve2-sha3+rcpc3"))) 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);
7 // expected-warning@+1 {{version list contains entries that don't impact code generation}}
8 void __attribute__((target_clones("ssbs+ls64"))) warn2(void);
10 // expected-error@+2 {{'target_clones' and 'target_version' attributes are not compatible}}
11 // expected-note@+1 {{conflicting attribute is here}}
12 void __attribute__((target_version("sve-bf16"), target_clones("sme+memtag"))) not_compat(void);
15 int __attribute__((target_clones("frintts", "simd+fp", "default"))) redecl(void) { return 1; }
17 int __attribute__((target_clones("jscvt+fcma", "rcpc", "default"))) redecl2(void);
18 int __attribute__((target_clones("jscvt+fcma", "rcpc"))) redecl2(void) { return 1; }
20 int __attribute__((target_clones("sve+dotprod"))) redecl3(void);
23 int __attribute__((target_clones("rng", "fp16fml+fp", "default"))) redecl4(void);
24 // expected-error@+3 {{'target_clones' attribute does not match previous declaration}}
25 // expected-note@-2 {{previous declaration is here}}
26 // expected-warning@+1 {{version list contains entries that don't impact code generation}}
27 int __attribute__((target_clones("dgh+memtag+rpres+ls64_v", "ebf16+dpb+sha1", "default"))) redecl4(void) { return 1; }
29 int __attribute__((target_version("flagm2"))) redef2(void) { return 1; }
30 // expected-error@+2 {{multiversioning attributes cannot be combined}}
31 // expected-note@-2 {{previous declaration is here}}
32 int __attribute__((target_clones("flagm2", "default"))) redef2(void) { return 1; }
34 int __attribute__((target_clones("f32mm", "f64mm", "sha1+fp"))) redef3(void) { return 1; }
35 // expected-error@+2 {{'target_clones' attribute does not match previous declaration}}
36 // expected-note@-2 {{previous declaration is here}}
37 int __attribute__((target_clones("f32mm", "sha1+fp", "f64mm"))) redef3(void) { return 1; }
39 int __attribute__((target_clones("rdm+lse+rdm", "lse+rdm"))) dup1(void) { return 1; }
40 // expected-warning@+1 {{version list contains duplicate entries}}
41 int __attribute__((target_clones("rdm+lse+rdm", "rdm+lse+rdm"))) dup2(void) { return 2; }
42 // expected-warning@+1 {{version list contains duplicate entries}}
43 int __attribute__((target_clones("rcpc2+sve2-pmull128", "rcpc2+sve2-pmull128"))) dup3(void) { return 3; }
44 // expected-warning@+1 {{version list contains duplicate entries}}
45 void __attribute__((target_clones("sha3", "default", "default"))) dup4(void);
46 // expected-warning@+2 {{version list contains duplicate entries}}
47 // expected-warning@+1 {{version list contains duplicate entries}}
48 int __attribute__((target_clones("fp", "fp", "crc+dotprod", "dotprod+crc"))) dup5(void) { return 5; }
50 // expected-warning@+1 {{version list contains duplicate entries}}
51 int __attribute__((target_clones("fp16+memtag", "memtag+fp16"))) dup6(void) { return 6; }
52 int __attribute__((target_clones("simd+ssbs2", "simd+dpb2"))) dup7(void) { return 7; }
54 // expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}}
55 void __attribute__((target_clones(""))) empty_target_1(void);
56 // expected-warning@+3 {{unsupported 'default' in the 'target_clones' attribute string;}}
57 // expected-warning@+2 {{unsupported 'default' in the 'target_clones' attribute string;}}
58 // expected-warning@+1 {{version list contains entries that don't impact code generation}}
59 void __attribute__((target_clones("default+default"))) empty_target_2(void);
60 // expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}}
61 void __attribute__((target_clones("+sve2")))
63 // expected-warning@+1 {{unsupported 'bs' in the 'target_clones' attribute string;}}
64 void __attribute__((target_clones("sb+bs")))
67 // expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string;}}
68 void __attribute__((target_clones("default", "")))
71 // expected-warning@+1 {{version list contains duplicate entries}}
72 void __attribute__((target_clones("sve2-bitperm", "sve2-bitperm")))
75 void __attribute__((target_clones("default"), target_clones("memtag3+bti"))) dupe_normal2(void);
77 int mv_after_use(void);
79 return mv_after_use();
81 // expected-error@+1 {{function declaration cannot become a multiversioned function after first usage}}
82 int __attribute__((target_clones("sve2-sha3+ssbs2", "sm4"))) mv_after_use(void) { return 1; }
83 // expected-error@+1 {{'main' cannot be a multiversioned function}}
84 int __attribute__((target_clones("sve-i8mm"))) main() { return 1; }