• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu  -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -triple aarch64-linux-gnu  -fsyntax-only -verify %s
3 
4 #ifdef __x86_64__
5 
foo()6 int __attribute__((target("avx,sse4.2,arch=ivybridge"))) foo() { return 4; }
7 //expected-error@+1 {{'target' attribute takes one argument}}
bar()8 int __attribute__((target())) bar() { return 4; }
9 // no warning, tune is supported for x86
baz()10 int __attribute__((target("tune=sandybridge"))) baz() { return 4; }
11 //expected-warning@+1 {{unsupported 'fpmath=' in the 'target' attribute string; 'target' attribute ignored}}
walrus()12 int __attribute__((target("fpmath=387"))) walrus() { return 4; }
13 //expected-warning@+1 {{unknown architecture 'hiss' in the 'target' attribute string; 'target' attribute ignored}}
meow()14 int __attribute__((target("avx,sse4.2,arch=hiss"))) meow() {  return 4; }
15 //expected-warning@+1 {{unsupported 'woof' in the 'target' attribute string; 'target' attribute ignored}}
bark()16 int __attribute__((target("woof"))) bark() {  return 4; }
17 // no warning, same as saying 'nothing'.
turtle()18 int __attribute__((target("arch="))) turtle() { return 4; }
19 //expected-warning@+1 {{unknown architecture 'hiss' in the 'target' attribute string; 'target' attribute ignored}}
pine_tree()20 int __attribute__((target("arch=hiss,arch=woof"))) pine_tree() { return 4; }
21 //expected-warning@+1 {{duplicate 'arch=' in the 'target' attribute string; 'target' attribute ignored}}
oak_tree()22 int __attribute__((target("arch=ivybridge,arch=haswell"))) oak_tree() { return 4; }
23 //expected-warning@+1 {{unsupported 'branch-protection' in the 'target' attribute string; 'target' attribute ignored}}
birch_tree()24 int __attribute__((target("branch-protection=none"))) birch_tree() { return 5; }
25 //expected-warning@+1 {{unknown tune CPU 'hiss' in the 'target' attribute string; 'target' attribute ignored}}
apple_tree()26 int __attribute__((target("tune=hiss,tune=woof"))) apple_tree() { return 4; }
27 
28 #else
29 
30 // tune is not supported by other targets.
31 //expected-warning@+1 {{unsupported 'tune=' in the 'target' attribute string; 'target' attribute ignored}}
baz()32 int __attribute__((target("tune=hiss"))) baz() { return 4; }
33 
34 #endif
35