blob: 2e548cc701a0f79f8cccf44be36550499c6ca79a [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; }
8
Eric Christopher11acf732015-06-12 01:35:52 +00009int 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 Christopher64a247b2015-06-12 01:35:56 +000014// We ignore the tune attribute so walrus should be identical to baz and bar.
15// CHECK: walrus{{.*}} #0
Eric Christopher11acf732015-06-12 01:35:52 +000016// 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"