1 // RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify -fexceptions -fcxx-exceptions %s -std=c++14
2 void __attribute__((target_version("default"))) wrong_tv(void);
3 //expected-warning@+1 {{unsupported 'vmull' in the 'target_version' attribute string; 'target_version' attribute ignored}}
4 void __attribute__((target_version("vmull"))) wrong_tv(void);
6 void __attribute__((target_version("dotprod"))) no_def(void);
7 void __attribute__((target_version("rdm+fp"))) no_def(void);
8 void __attribute__((target_version("rcpc3"))) no_def(void);
10 // expected-error@+1 {{no matching function for call to 'no_def'}}
11 void foo(void) { no_def(); }
13 constexpr int __attribute__((target_version("sve2"))) diff_const(void) { return 1; }
14 //expected-error@+1 {{multiversioned function declaration has a different constexpr specification}}
15 int __attribute__((target_version("sve2-bitperm"))) diff_const(void);
17 int __attribute__((target_version("fp"))) diff_const1(void) { return 1; }
18 //expected-error@+1 {{multiversioned function declaration has a different constexpr specification}}
19 constexpr int __attribute__((target_version("sve2-aes"))) diff_const1(void);
21 static int __attribute__((target_version("sve2-sha3"))) diff_link(void) { return 1; }
22 //expected-error@+1 {{multiversioned function declaration has a different linkage}}
23 int __attribute__((target_version("dpb"))) diff_link(void);
25 int __attribute__((target_version("memtag"))) diff_link1(void) { return 1; }
26 //expected-error@+1 {{multiversioned function declaration has a different linkage}}
27 static int __attribute__((target_version("bti"))) diff_link1(void);
29 int __attribute__((target_version("flagm2"))) diff_link2(void) { return 1; }
30 extern int __attribute__((target_version("flagm"))) diff_link2(void);
33 static int __attribute__((target_version("memtag3"))) diff_link2(void) { return 2; }
34 int __attribute__((target_version("sve2-bitperm"))) diff_link2(void) { return 1; }
37 inline int __attribute__((target_version("sme"))) diff_inline(void) { return 1; }
38 //expected-error@+1 {{multiversioned function declaration has a different inline specification}}
39 int __attribute__((target_version("fp16"))) diff_inline(void) { return 2; }
41 inline int __attribute__((target_version("sme"))) diff_inline1(void) { return 1; }
42 int __attribute__((target_version("default"))) diff_inline1(void) { return 2; }
44 int __attribute__((target_version("fcma"))) diff_type1(void) { return 1; }
45 //expected-error@+1 {{multiversioned function declaration has a different return type}}
46 double __attribute__((target_version("rcpc"))) diff_type1(void);
48 auto __attribute__((target_version("rcpc2"))) diff_type2(void) -> int { return 1; }
49 //expected-error@+1 {{multiversioned function declaration has a different return type}}
50 auto __attribute__((target_version("sve-bf16"))) diff_type2(void) -> long { return (long)1; }
52 int __attribute__((target_version("fp16fml"))) diff_type3(void) noexcept(false) { return 1; }
53 //expected-error@+2 {{exception specification in declaration does not match previous declaration}}
54 //expected-note@-2 {{previous declaration is here}}
55 int __attribute__((target_version("sve2-sha3"))) diff_type3(void) noexcept(true) { return 2; }
57 template <typename T
> int __attribute__((target_version("default"))) temp(T
) { return 1; }
59 template <typename T
> int __attribute__((target_version("simd"))) temp1(T
) { return 1; }
60 // expected-error@+1 {{attribute 'target_version' multiversioned functions do not yet support function templates}}
61 template <typename T
> int __attribute__((target_version("sha3"))) temp1(T
) { return 2; }
64 int __attribute__((target_version("aes"))) extc(void) { return 1; }
66 //expected-error@+1 {{multiversioned function declaration has a different language linkage}}
67 int __attribute__((target_version("lse"))) extc(void) { return 1; }
69 auto __attribute__((target_version("default"))) ret1(void) { return 1; }
70 auto __attribute__((target_version("dpb"))) ret2(void) { return 1; }
71 auto __attribute__((target_version("dpb2"))) ret3(void) -> int { return 1; }
74 __attribute__((target_version("rng"))) Cls();
75 __attribute__((target_version("sve-i8mm"))) ~Cls();
77 Cls
&__attribute__((target_version("f32mm"))) operator=(const Cls
&) = default;
78 Cls
&__attribute__((target_version("ssbs"))) operator=(Cls
&&) = delete;
80 virtual void __attribute__((target_version("default"))) vfunc();
81 virtual void __attribute__((target_version("sm4"))) vfunc1();
84 __attribute__((target_version("sha3"))) void Decl();
87 // expected-error@+3 {{declaration conflicts with target of using declaration already in scope}}
88 // expected-note@-4 {{target of using declaration}}
89 // expected-note@-3 {{using declaration}}
90 __attribute__((target_version("jscvt"))) void Decl();
94 int __attribute__((target_version("bti"))) func(void);
95 int __attribute__((target_version("ssbs2"))) func(void);
97 int __attribute__((target_version("bti"))) Out::func(void) { return 1; }
98 int __attribute__((target_version("ssbs2"))) Out::func(void) { return 2; }
99 // expected-error@+3 {{out-of-line definition of 'func' does not match any declaration in 'Out'}}
100 // expected-note@-3 {{member declaration nearly matches}}
101 // expected-note@-3 {{member declaration nearly matches}}
102 int __attribute__((target_version("rng"))) Out::func(void) { return 3; }