<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Right. Only X86, SystemZ and PPC do anything like this in the backend. I agree this should be opt-in for targets. That would be via implementing code in getHostCPUName().<div><br></div><div><div><br></div><div>-Jim<br><div><br></div><div><br><div><div>On Apr 9, 2014, at 2:01 PM, Robinson, Paul <<a href="mailto:Paul_Robinson@playstation.sony.com">Paul_Robinson@playstation.sony.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div bgcolor="white" lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">We’ve seen similar problems, a test passes for one person but not another, because of having different desktop models.  Having that stop would be kind of nice.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I guess currently every target must have some generic/default and only a few do the auto-detect thing?  Probably don’t want to make it mandatory to support –mcpu=native but refactoring the existing targets that do that seems fine.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">--paulr<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="border-style: none none none solid; border-left-color: blue; border-left-width: 1.5pt; padding: 0in 0in 0in 4pt;"><div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; color: windowtext;">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif; color: windowtext;"><span class="Apple-converted-space"> </span><a href="mailto:llvmdev-bounces@cs.uiuc.edu" style="color: purple; text-decoration: underline;">llvmdev-bounces@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>[<a href="mailto:llvmdev-bounces@cs.uiuc.edu" style="color: purple; text-decoration: underline;">mailto:llvmdev-bounces@cs.uiuc.edu</a>]<span class="Apple-converted-space"> </span><b>On Behalf Of<span class="Apple-converted-space"> </span></b>Philip Reames<br><b>Sent:</b><span class="Apple-converted-space"> </span>Wednesday, April 09, 2014 1:00 PM<br><b>To:</b><span class="Apple-converted-space"> </span>Jim Grosbach; LLVM Developers Mailing List<br><b>Subject:</b><span class="Apple-converted-space"> </span>Re: [LLVMdev] Proposal: Move host CPU auto-detection out of the TargetMachine<o:p></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', serif;">I support the general direction of this change.  I haven't reviewed the actual code changes.<br><br>Philip<o:p></o:p></p><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">On 04/07/2014 05:59 PM, Jim Grosbach wrote:<o:p></o:p></div></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';">All,<o:p></o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';">Currently the X86 backend does CPU auto-detection and subtarget feature detection when the TargetMachine is created if no explicit CPU was specified. It's counterintuitive for low level tools like ‘llc’ to do this, as it means the same .ll file compiled on heterogenous machines generates different results from the same ‘llc’ command line. It is still useful to be able to opt-in to such behavior to, for example, replicate clang’s behavior when -mcpu=native is supplied to clang. My thought is to do something similar here and teach ‘llc’ to recognize -mcpu=native and probe the host CPU if that is given. The subtarget features will then be filled in according to the feature string for that CPU. This (a) changes the auto-detection from opt-out to opt-in and (b) moves the logic out of the core target backend and into the tools drivers.<o:p></o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';">Attached are draft patches that do this for X86. Similar but smaller cleanups can also be done for SystemZ and PowerPC if it’s agreed this is a good idea.<o:p></o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';">-Jim<o:p></o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></pre><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><br><br><br><o:p></o:p></div><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';">_______________________________________________<o:p></o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';">LLVM Developers mailing list<o:p></o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><a href="mailto:LLVMdev@cs.uiuc.edu" style="color: purple; text-decoration: underline;">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" style="color: purple; text-decoration: underline;">http://llvm.cs.uiuc.edu</a><o:p></o:p></pre><pre style="margin: 0in 0in 0.0001pt; font-size: 10pt; font-family: 'Courier New';"><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" style="color: purple; text-decoration: underline;">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><o:p></o:p></pre></blockquote><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div></div></div></blockquote></div><br></div></div></div></body></html>