]> granicus.if.org Git - clang/commitdiff
Handle fpmath= in the target attribute.
authorEric Christopher <echristo@gmail.com>
Fri, 12 Jun 2015 01:36:00 +0000 (01:36 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 12 Jun 2015 01:36:00 +0000 (01:36 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239582 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp
test/CodeGen/attr-target.c

index 9be7340626982ab354410473032c4cc3216587de..5d34e288923b626e5ad26dab3c4e2f065bf66a41 100644 (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
index e21f047ed0addd152ccbcae76a161fac8e62c998..8c0f335f857da41d7cbb34f9cff8b20b0e095fdc 100644 (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"