From: Eric Christopher Date: Fri, 12 Jun 2015 01:36:00 +0000 (+0000) Subject: Handle fpmath= in the target attribute. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=158341402be687642a28e88536c59aa1ef58ac74;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239582 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 9be7340626..5d34e28892 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -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 diff --git a/test/CodeGen/attr-target.c b/test/CodeGen/attr-target.c index e21f047ed0..8c0f335f85 100644 --- a/test/CodeGen/attr-target.c +++ b/test/CodeGen/attr-target.c @@ -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"