Handle fpmath= in the target attribute.

Right now we're ignoring the fpmath attribute since there's no
backend support for a feature like this and to do so would require
checking the validity of the strings and doing general subtarget
feature parsing of valid and invalid features with the target
attribute feature.

llvm-svn: 239582
This commit is contained in:
Eric Christopher 2015-06-12 01:36:00 +00:00
parent 4dfe075f93
commit 249e3762e5
2 changed files with 8 additions and 0 deletions

View File

@ -1515,6 +1515,11 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
else if (Feature.startswith("tune="))
// We don't support cpu tuning this way currently.
;
else if (Feature.startswith("fpmath="))
// TODO: Support the fpmath option this way. It will require checking
// overall feature validity for the function with the rest of the
// attributes on the function.
;
else if (Feature.startswith("mno-"))
Features.push_back("-" + Feature.split("-").second.str());
else

View File

@ -5,6 +5,7 @@ int baz(int a) { return 4; }
int __attribute__((target("avx,sse4.2,arch=ivybridge"))) foo(int a) { return 4; }
int __attribute__((target("tune=sandybridge"))) walrus(int a) { return 4; }
int __attribute__((target("fpmath=387"))) koala(int a) { return 4; }
int __attribute__((target("mno-sse2"))) echidna(int a) { return 4; }
@ -15,6 +16,8 @@ int bar(int a) { return baz(a) + foo(a); }
// CHECK: foo{{.*}} #1
// We ignore the tune attribute so walrus should be identical to baz and bar.
// CHECK: walrus{{.*}} #0
// We're currently ignoring the fpmath attribute so koala should be identical to baz and bar.
// CHECK: koala{{.*}} #0
// CHECK: echidna{{.*}} #2
// CHECK: bar{{.*}} #0
// CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2"