| 1 |
// RUN: %clang_cc1 -triple riscv64-linux-gnu -fsyntax-only -verify -fexceptions -fcxx-exceptions %s -std=c++14 |
| 2 |
|
| 3 |
// expected-warning@+1 {{unsupported 'mcpu=sifive-u74' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 4 |
void __attribute__((target_clones("default", "mcpu=sifive-u74"))) mcpu() {} |
| 5 |
|
| 6 |
// expected-warning@+1 {{unsupported 'mtune=sifive-u74' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 7 |
void __attribute__((target_clones("default", "mtune=sifive-u74"))) mtune() {} |
| 8 |
|
| 9 |
// expected-warning@+1 {{version list contains duplicate entries}} |
| 10 |
void __attribute__((target_clones("default", "arch=+c", "arch=+c"))) dupVersion() {} |
| 11 |
|
| 12 |
// expected-warning@+1 {{version list contains duplicate entries}} |
| 13 |
void __attribute__((target_clones(" default", "default "))) dupDefault() {} |
| 14 |
|
| 15 |
// expected-warning@+1 {{unsupported '' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 16 |
void __attribute__((target_clones("default", ""))) emptyVersion() {} |
| 17 |
|
| 18 |
// expected-error@+1 {{'target_clones' multiversioning requires a default target}} |
| 19 |
void __attribute__((target_clones("arch=+c"))) withoutDefault() {} |
| 20 |
|
| 21 |
// expected-warning@+1 {{unsupported '+c' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 22 |
void __attribute__((target_clones("default", "+c"))) invaildVersion() {} |
| 23 |
|
| 24 |
// expected-warning@+1 {{unsupported 'arch=rv64g' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 25 |
void __attribute__((target_clones("default", "arch=rv64g"))) fullArchString() {} |
| 26 |
|
| 27 |
// expected-warning@+1 {{unsupported 'arch=+zicsr' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 28 |
void __attribute__((target_clones("default", "arch=+zicsr"))) UnsupportBitMaskExt() {} |
| 29 |
|
| 30 |
// expected-warning@+1 {{unsupported 'arch=+c;priority=NotADigit' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 31 |
void __attribute__((target_clones("default", "arch=+c;priority=NotADigit"))) UnsupportPriority() {} |
| 32 |
|
| 33 |
// expected-warning@+1 {{unsupported 'default;priority=2' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 34 |
void __attribute__((target_clones("default;priority=2", "arch=+c"))) UnsupportDefaultPriority() {} |
| 35 |
|
| 36 |
// expected-warning@+1 {{unsupported 'priority=2;default' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 37 |
void __attribute__((target_clones("priority=2;default", "arch=+c"))) UnsupportDefaultPriority2() {} |
| 38 |
|
| 39 |
// expected-warning@+1 {{unsupported 'arch=+c;priority=-1' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 40 |
void __attribute__((target_clones("default", "arch=+c;priority=-1"))) UnsupportNegativePriority() {} |
| 41 |
|
| 42 |
// expected-warning@+1 {{unsupported 'arch=+c,zbb' in the 'target_clones' attribute string; 'target_clones' attribute ignored}} |
| 43 |
void __attribute__((target_clones("default", "arch=+c,zbb"))) WithoutAddSign() {} |
| 44 |
|
| 45 |
|
| 46 |
void lambda() { |
| 47 |
// expected-error@+1 {{attribute 'target_clones' multiversioned functions do not yet support lambdas}} |
| 48 |
auto x = []() __attribute__((target_clones("default"))){}; |
| 49 |
x(); |
| 50 |
// expected-error@+1 {{attribute 'target_clones' multiversioned functions do not yet support lambdas}} |
| 51 |
auto y = []() __attribute__((target_clones("arch=+v", "default"))){}; |
| 52 |
y(); |
| 53 |
} |
| 54 |
|
| 55 |
namespace GH173684 { |
| 56 |
// expected-error@+1 {{'target_clones' multiversioning requires a default target}} |
| 57 |
void __attribute__((target_clones())) withoutDefault() {} |
| 58 |
// expected-error@+1 {{'target_clones' multiversioning requires a default target}} |
| 59 |
void __attribute__((target_clones)) withoutDefault2() {} |
| 60 |
} |