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 | 3751bce | 2015-08-27 20:05:48 +0000 | [diff] [blame^] | 10 | int __attribute__((target("no-sse2"))) echidna(int a) { return 4; } |
Eric Christopher | 4dfe075 | 2015-06-12 01:35:58 +0000 | [diff] [blame] | 11 | |
Eric Christopher | 298ac30 | 2015-07-01 00:08:32 +0000 | [diff] [blame] | 12 | int __attribute__((target("sse4"))) panda(int a) { return 4; } |
| 13 | |
Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 14 | int bar(int a) { return baz(a) + foo(a); } |
| 15 | |
Eric Christopher | af4d608 | 2015-07-06 23:51:59 +0000 | [diff] [blame] | 16 | int __attribute__((target("avx, sse4.2, arch= ivybridge"))) qux(int a) { return 4; } |
Eric Christopher | 3751bce | 2015-08-27 20:05:48 +0000 | [diff] [blame^] | 17 | int __attribute__((target("no-aes, arch=ivybridge"))) qax(int a) { return 4; } |
Eric Christopher | af4d608 | 2015-07-06 23:51:59 +0000 | [diff] [blame] | 18 | |
Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 19 | // Check that we emit the additional subtarget and cpu features for foo and not for baz or bar. |
| 20 | // CHECK: baz{{.*}} #0 |
| 21 | // CHECK: foo{{.*}} #1 |
Eric Christopher | 64a247b | 2015-06-12 01:35:56 +0000 | [diff] [blame] | 22 | // We ignore the tune attribute so walrus should be identical to baz and bar. |
| 23 | // CHECK: walrus{{.*}} #0 |
Eric Christopher | 249e376 | 2015-06-12 01:36:00 +0000 | [diff] [blame] | 24 | // We're currently ignoring the fpmath attribute so koala should be identical to baz and bar. |
| 25 | // CHECK: koala{{.*}} #0 |
Eric Christopher | 4dfe075 | 2015-06-12 01:35:58 +0000 | [diff] [blame] | 26 | // CHECK: echidna{{.*}} #2 |
Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 27 | // CHECK: bar{{.*}} #0 |
Eric Christopher | af4d608 | 2015-07-06 23:51:59 +0000 | [diff] [blame] | 28 | // CHECK: qux{{.*}} #1 |
Eric Christopher | 3a98b3c | 2015-08-27 19:59:34 +0000 | [diff] [blame] | 29 | // CHECK: qax{{.*}} #4 |
Eric Christopher | 11acf73 | 2015-06-12 01:35:52 +0000 | [diff] [blame] | 30 | // CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2" |
Eric Christopher | 3a98b3c | 2015-08-27 19:59:34 +0000 | [diff] [blame] | 31 | // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+aes,+avx,+cx16,+f16c,+fsgsbase,+pclmul,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3" |
Eric Christopher | 2374a7c | 2015-07-01 01:07:12 +0000 | [diff] [blame] | 32 | // CHECK: #2 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop" |
| 33 | // CHECK: #3 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3" |
Eric Christopher | 3a98b3c | 2015-08-27 19:59:34 +0000 | [diff] [blame] | 34 | // CHECK: #4 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cx16,+f16c,+fsgsbase,+pclmul,+rdrnd,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,-aes" |