<div dir="ltr">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.<div><br></div><div>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.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Tue, Mar 6, 2018 at 2:48 PM, Aaron Ballman via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Mar 6, 2018 at 5:45 PM, Craig Topper via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: ctopper<br>
> Date: Tue Mar  6 14:45:31 2018<br>
> New Revision: 326840<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=326840&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=326840&view=rev</a><br>
> Log:<br>
> [X86] Fix a typo in Host.cpp that causes us to misidentify KNL, Silvermont, Goldmont and probably other CPUs for -march=native<br>
><br>
> 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.<br>
<br>
</span>Are there tests that can be added for this commit?<br>
<br>
~Aaron<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Fixes PR36619.<br>
><br>
> Modified:<br>
>     llvm/trunk/lib/Support/Host.<wbr>cpp<br>
><br>
> Modified: llvm/trunk/lib/Support/Host.<wbr>cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Host.cpp?rev=326840&r1=326839&r2=326840&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Support/Host.cpp?rev=326840&<wbr>r1=326839&r2=326840&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- llvm/trunk/lib/Support/Host.<wbr>cpp (original)<br>
> +++ llvm/trunk/lib/Support/Host.<wbr>cpp Tue Mar  6 14:45:31 2018<br>
> @@ -1009,7 +1009,7 @@ StringRef sys::getHostCPUName() {<br>
>  #include "llvm/Support/X86TargetParser.<wbr>def"<br>
><br>
>    // Now check types.<br>
> -#define X86_CPU_SUBTYPE(ARCHNAME, ENUM) \<br>
> +#define X86_CPU_TYPE(ARCHNAME, ENUM) \<br>
>    if (Type == X86::ENUM) \<br>
>      return ARCHNAME;<br>
>  #include "llvm/Support/X86TargetParser.<wbr>def"<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>