r239582 - Handle fpmath= in the target attribute.
Eric Christopher
echristo at gmail.com
Thu Jun 11 18:36:01 PDT 2015
Author: echristo
Date: Thu Jun 11 20:36:00 2015
New Revision: 239582
URL: http://llvm.org/viewvc/llvm-project?rev=239582&view=rev
Log:
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.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/test/CodeGen/attr-target.c
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=239582&r1=239581&r2=239582&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Thu Jun 11 20:36:00 2015
@@ -1515,6 +1515,11 @@ void CodeGenModule::ConstructAttributeLi
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
Modified: cfe/trunk/test/CodeGen/attr-target.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-target.c?rev=239582&r1=239581&r2=239582&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/attr-target.c (original)
+++ cfe/trunk/test/CodeGen/attr-target.c Thu Jun 11 20:36:00 2015
@@ -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"
More information about the cfe-commits
mailing list