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