[llvm] r326840 - [X86] Fix a typo in Host.cpp that causes us to misidentify KNL, Silvermont, Goldmont and probably other CPUs for -march=native

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 14:54:13 PST 2018


Not with the way the code is currently structured. Everything is driven by
the results of the cpuid instruction. Which makes it dependent on the CPU
being executed on.

We should split as much of the code as we can into a function that takes
the cpuid data as input so we can unit test it. Or figure out some other
way to spoof the CPUID data for a unit test.

~Craig

On Tue, Mar 6, 2018 at 2:48 PM, Aaron Ballman via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> On Tue, Mar 6, 2018 at 5:45 PM, Craig Topper via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Author: ctopper
> > Date: Tue Mar  6 14:45:31 2018
> > New Revision: 326840
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=326840&view=rev
> > Log:
> > [X86] Fix a typo in Host.cpp that causes us to misidentify KNL,
> Silvermont, Goldmont and probably other CPUs for -march=native
> >
> > I think most of the Intel Core CPUs and recent AMD CPUs are unaffected.
> All the CPUs that have a "subtype" should work. The ones that were broken
> are the ones that are a "type" with no subtypes.
>
> Are there tests that can be added for this commit?
>
> ~Aaron
>
> >
> > Fixes PR36619.
> >
> > Modified:
> >     llvm/trunk/lib/Support/Host.cpp
> >
> > Modified: llvm/trunk/lib/Support/Host.cpp
> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
> Support/Host.cpp?rev=326840&r1=326839&r2=326840&view=diff
> > ============================================================
> ==================
> > --- llvm/trunk/lib/Support/Host.cpp (original)
> > +++ llvm/trunk/lib/Support/Host.cpp Tue Mar  6 14:45:31 2018
> > @@ -1009,7 +1009,7 @@ StringRef sys::getHostCPUName() {
> >  #include "llvm/Support/X86TargetParser.def"
> >
> >    // Now check types.
> > -#define X86_CPU_SUBTYPE(ARCHNAME, ENUM) \
> > +#define X86_CPU_TYPE(ARCHNAME, ENUM) \
> >    if (Type == X86::ENUM) \
> >      return ARCHNAME;
> >  #include "llvm/Support/X86TargetParser.def"
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180306/44f905e4/attachment.html>


More information about the llvm-commits mailing list