<div dir="ltr"><br><br><div class="gmail_quote">On Fri, Mar 27, 2015 at 9:48 AM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Mar 25, 2015 at 3:09 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: echristo<br>
Date: Wed Mar 25 17:09:26 2015<br>
New Revision: 233223<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=233223&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=233223&view=rev</a><br>
Log:<br>
Make the msse4/mno-sse4 flags aliases of the maximum sse values<br>
they enable/disable.<br>
<br>
This fixes two things:<br>
<br>
a) sse4 isn't actually a target feature, don't treat it as one.<br>
b) we weren't correctly disabling sse4.1 when we'd pass -mno-sse4<br>
after enabling it, thus passing preprocessor directives and<br>
(soon) passing the function attribute as well when we shouldn't.<br></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br>Where's the logic to treat -msse4.2 as also disabling sse4.1? Currently passing -msse4 -mno-sse4 produces:<br><br>"-target-feature" "+sse4.2" "-target-feature" "-sse4.1"<br><br>Is that the right thing, or would I end up getting sse4.2 behavior still?<br> </div></div></div></div></blockquote><div><br></div><div>Sadly it's the right thing and one of the things that the test makes sure about. The followup comment that Rafael asked for explains it in more detail.</div><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Modified:<br>
cfe/trunk/include/clang/Driver/Options.td<br>
cfe/trunk/lib/Basic/Targets.cpp<br>
cfe/trunk/test/Driver/x86_features.c<br>
cfe/trunk/test/Preprocessor/x86_target_features.c<br>
<br>
Modified: cfe/trunk/include/clang/Driver/Options.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=233223&r1=233222&r2=233223&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=233223&r1=233222&r2=233223&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Driver/Options.td (original)<br>
+++ cfe/trunk/include/clang/Driver/Options.td Wed Mar 25 17:09:26 2015<br>
@@ -1185,9 +1185,9 @@ def mno_stackrealign : Flag<["-"], "mno-<br>
def mno_sse2 : Flag<["-"], "mno-sse2">, Group<m_x86_Features_Group>;<br>
def mno_sse3 : Flag<["-"], "mno-sse3">, Group<m_x86_Features_Group>;<br>
def mno_sse4a : Flag<["-"], "mno-sse4a">, Group<m_x86_Features_Group>;<br>
-def mno_sse4 : Flag<["-"], "mno-sse4">, Group<m_x86_Features_Group>;<br>
def mno_sse4_1 : Flag<["-"], "mno-sse4.1">, Group<m_x86_Features_Group>;<br>
def mno_sse4_2 : Flag<["-"], "mno-sse4.2">, Group<m_x86_Features_Group>;<br>
+def mno_sse4 : Flag<["-"], "mno-sse4">, Alias<mno_sse4_1>;<br>
def mno_sse : Flag<["-"], "mno-sse">, Group<m_x86_Features_Group>;<br>
def mno_ssse3 : Flag<["-"], "mno-ssse3">, Group<m_x86_Features_Group>;<br>
def mno_aes : Flag<["-"], "mno-aes">, Group<m_x86_Features_Group>;<br>
@@ -1310,9 +1310,9 @@ def mimplicit_float : Flag<["-"], "mimpl<br>
def msse2 : Flag<["-"], "msse2">, Group<m_x86_Features_Group>;<br>
def msse3 : Flag<["-"], "msse3">, Group<m_x86_Features_Group>;<br>
def msse4a : Flag<["-"], "msse4a">, Group<m_x86_Features_Group>;<br>
-def msse4 : Flag<["-"], "msse4">, Group<m_x86_Features_Group>;<br>
def msse4_1 : Flag<["-"], "msse4.1">, Group<m_x86_Features_Group>;<br>
def msse4_2 : Flag<["-"], "msse4.2">, Group<m_x86_Features_Group>;<br>
+def msse4 : Flag<["-"], "msse4">, Alias<msse4_2>;<br>
def msse : Flag<["-"], "msse">, Group<m_x86_Features_Group>;<br>
def mssse3 : Flag<["-"], "mssse3">, Group<m_x86_Features_Group>;<br>
def maes : Flag<["-"], "maes">, Group<m_x86_Features_Group>;<br>
<br>
Modified: cfe/trunk/lib/Basic/Targets.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=233223&r1=233222&r2=233223&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=233223&r1=233222&r2=233223&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Basic/Targets.cpp (original)<br>
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Mar 25 17:09:26 2015<br>
@@ -2580,11 +2580,6 @@ void X86TargetInfo::setXOPLevel(llvm::St<br>
<br>
void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,<br>
StringRef Name, bool Enabled) {<br>
- // FIXME: This *really* should not be here. We need some way of translating<br>
- // options into llvm subtarget features.<br>
- if (Name == "sse4")<br>
- Name = "sse4.2";<br>
-<br>
Features[Name] = Enabled;<br>
<br>
if (Name == "mmx") {<br>
<br>
Modified: cfe/trunk/test/Driver/x86_features.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/x86_features.c?rev=233223&r1=233222&r2=233223&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/x86_features.c?rev=233223&r1=233222&r2=233223&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Driver/x86_features.c (original)<br>
+++ cfe/trunk/test/Driver/x86_features.c Wed Mar 25 17:09:26 2015<br>
@@ -1,5 +1,5 @@<br>
// RUN: %clang -target i386-unknown-unknown -### -S %s -msse -msse4 -mno-sse -mno-mmx -msse 2>&1 | FileCheck %s<br>
-// CHECK: "pentium4" "-target-feature" "+sse4" "-target-feature" "-mmx" "-target-feature" "+sse"<br>
+// CHECK: "pentium4" "-target-feature" "+sse4.2" "-target-feature" "-mmx" "-target-feature" "+sse"<br>
// Note that we filter out all but the last -m(no)sse.<br>
<br>
// Test that we don't produce an error with -mieee-fp.<br>
<br>
Modified: cfe/trunk/test/Preprocessor/x86_target_features.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/x86_target_features.c?rev=233223&r1=233222&r2=233223&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/x86_target_features.c?rev=233223&r1=233222&r2=233223&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Preprocessor/x86_target_features.c (original)<br>
+++ cfe/trunk/test/Preprocessor/x86_target_features.c Wed Mar 25 17:09:26 2015<br>
@@ -9,6 +9,10 @@<br>
// SSE4: #define __SSE__ 1<br>
// SSE4: #define __SSSE3__ 1<br>
<br>
+// RUN: %clang -target i386-unknown-unknown -march=core2 -msse4.1 -mno-sse4 -x c -E -dM -o - %s | FileCheck --check-prefix=NOSSE4 %s<br>
+<br>
+// NOSSE4-NOT: #define __SSE4_1__ 1<br>
+<br>
// RUN: %clang -target i386-unknown-unknown -march=core2 -msse4 -mno-sse2 -x c -E -dM -o - %s | FileCheck --check-prefix=SSE %s<br>
<br>
// SSE-NOT: #define __SSE2_MATH__ 1<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div></blockquote></div></div>