Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-linux-gnu -target-cpu x86-64 -emit-llvm %s -o - | FileCheck %s |
| 2 | |
| 3 | int baz(int a) { return 4; } |
| 4 | |
| 5 | int __attribute__((target("avx,sse4.2,arch=ivybridge"))) foo(int a) { return 4; } |
| 6 | |
Eric Christopher | 64a247b | 2015-06-12 01:35:56 +0000 | [diff] [blame^] | 7 | int __attribute__((target("tune=sandybridge"))) walrus(int a) { return 4; } |
| 8 | |
Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 9 | int bar(int a) { return baz(a) + foo(a); } |
| 10 | |
| 11 | // Check that we emit the additional subtarget and cpu features for foo and not for baz or bar. |
| 12 | // CHECK: baz{{.*}} #0 |
| 13 | // CHECK: foo{{.*}} #1 |
Eric Christopher | 64a247b | 2015-06-12 01:35:56 +0000 | [diff] [blame^] | 14 | // We ignore the tune attribute so walrus should be identical to baz and bar. |
| 15 | // CHECK: walrus{{.*}} #0 |
Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 16 | // CHECK: bar{{.*}} #0 |
| 17 | // CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2" |
| 18 | // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+sse,+sse2,+avx,+sse4.2" |