blob: 520327cf0e2480edb9e01079e399b29a8a34b82a [file] [log] [blame]
Eric Christopher11acf732015-06-12 01:35:52 +00001// RUN: %clang_cc1 -triple x86_64-linux-gnu -target-cpu x86-64 -emit-llvm %s -o - | FileCheck %s
2
3int baz(int a) { return 4; }
4
5int __attribute__((target("avx,sse4.2,arch=ivybridge"))) foo(int a) { return 4; }
6
Eric Christopher64a247b2015-06-12 01:35:56 +00007int __attribute__((target("tune=sandybridge"))) walrus(int a) { return 4; }
Eric Christopher249e3762015-06-12 01:36:00 +00008int __attribute__((target("fpmath=387"))) koala(int a) { return 4; }
Eric Christopher64a247b2015-06-12 01:35:56 +00009
Eric Christopher4dfe0752015-06-12 01:35:58 +000010int __attribute__((target("mno-sse2"))) echidna(int a) { return 4; }
11
Eric Christopher298ac302015-07-01 00:08:32 +000012int __attribute__((target("sse4"))) panda(int a) { return 4; }
13
Eric Christopher11acf732015-06-12 01:35:52 +000014int bar(int a) { return baz(a) + foo(a); }
15
16// Check that we emit the additional subtarget and cpu features for foo and not for baz or bar.
17// CHECK: baz{{.*}} #0
18// CHECK: foo{{.*}} #1
Eric Christopher64a247b2015-06-12 01:35:56 +000019// We ignore the tune attribute so walrus should be identical to baz and bar.
20// CHECK: walrus{{.*}} #0
Eric Christopher249e3762015-06-12 01:36:00 +000021// We're currently ignoring the fpmath attribute so koala should be identical to baz and bar.
22// CHECK: koala{{.*}} #0
Eric Christopher4dfe0752015-06-12 01:35:58 +000023// CHECK: echidna{{.*}} #2
Eric Christopher11acf732015-06-12 01:35:52 +000024// CHECK: bar{{.*}} #0
25// CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2"
Eric Christopher2249b812015-07-01 00:08:29 +000026// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+sse4.2,+ssse3,+sse3,+sse,+sse2,+sse4.1,+avx"
27// 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"
Eric Christopher298ac302015-07-01 00:08:32 +000028// CHECK: #3 = {{.*}}"target-cpu"="x86-64" "target-features"="+ssse3,+sse3,+sse,+sse2,+sse4.1,+sse4.2"