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; } |
Eric Christopher | 249e376 | 2015-06-12 01:36:00 +0000 | [diff] [blame] | 8 | int __attribute__((target("fpmath=387"))) koala(int a) { return 4; } |
Eric Christopher | 64a247b | 2015-06-12 01:35:56 +0000 | [diff] [blame] | 9 | |
Eric Christopher | 4dfe075 | 2015-06-12 01:35:58 +0000 | [diff] [blame] | 10 | int __attribute__((target("mno-sse2"))) echidna(int a) { return 4; } |
| 11 | |
Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 12 | int bar(int a) { return baz(a) + foo(a); } |
| 13 | |
| 14 | // Check that we emit the additional subtarget and cpu features for foo and not for baz or bar. |
| 15 | // CHECK: baz{{.*}} #0 |
| 16 | // CHECK: foo{{.*}} #1 |
Eric Christopher | 64a247b | 2015-06-12 01:35:56 +0000 | [diff] [blame] | 17 | // We ignore the tune attribute so walrus should be identical to baz and bar. |
| 18 | // CHECK: walrus{{.*}} #0 |
Eric Christopher | 249e376 | 2015-06-12 01:36:00 +0000 | [diff] [blame] | 19 | // We're currently ignoring the fpmath attribute so koala should be identical to baz and bar. |
| 20 | // CHECK: koala{{.*}} #0 |
Eric Christopher | 4dfe075 | 2015-06-12 01:35:58 +0000 | [diff] [blame] | 21 | // CHECK: echidna{{.*}} #2 |
Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 22 | // CHECK: bar{{.*}} #0 |
| 23 | // CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2" |
Eric Christopher | 2249b81 | 2015-07-01 00:08:29 +0000 | [diff] [blame^] | 24 | // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+sse4.2,+ssse3,+sse3,+sse,+sse2,+sse4.1,+avx" |
| 25 | // CHECK: #2 = {{.*}}"target-cpu"="x86-64" "target-features"="-sse4a,-sse3,-avx2,-avx512bw,-avx512er,-avx512dq,-avx512pf,-fma4,-avx512vl,+sse,-pclmul,-avx512cd,-avx,-f16c,-ssse3,-avx512f,-fma,-xop,-aes,-sha,-sse2,-sse4.1,-sse4.2" |