<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=gb2312"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><base href="x-msg://227/"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Times New Roman","serif";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin:0cm;
        margin-bottom:.0001pt;
        text-indent:21.0pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:宋体;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:621302512;
        mso-list-type:hybrid;
        mso-list-template-ids:-2146265994 648953068 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:18.0pt;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%2\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:42.0pt;
        text-indent:-21.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:63.0pt;
        text-indent:-21.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:84.0pt;
        text-indent:-21.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%5\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:105.0pt;
        text-indent:-21.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:126.0pt;
        text-indent:-21.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:147.0pt;
        text-indent:-21.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%8\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:168.0pt;
        text-indent:-21.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:189.0pt;
        text-indent:-21.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-CN link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>Is it OK to commit this patch?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>As it’s my first time to do something about LLVM, I need to be more careful.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>-Hao<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> llvm-commits-bounces@cs.uiuc.edu [mailto:llvm-commits-bounces@cs.uiuc.edu] <b>On Behalf Of </b>Hao Liu<br><b>Sent:</b> 2012</span><span style='font-size:10.0pt;font-family:宋体'>年</span><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>12</span><span style='font-size:10.0pt;font-family:宋体'>月</span><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>11</span><span style='font-size:10.0pt;font-family:宋体'>日</span><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> 10:15<br><b>To:</b> 'Evan Cheng'<br><b>Cc:</b> llvm-commits@cs.uiuc.edu<br><b>Subject:</b> Re: [llvm-commits] [PATCH]Implement getHostCPUFeatures for ARM Linux platform<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>Attached is the new reformatted patch.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>I need to descript why this patch for getHostCPUFeatures is needed and why can’t detect all the features:<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>1)<span style='font:7.0pt "Times New Roman"'>       </span></span></span><![endif]><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>A function getHostCPUName already exists in Host.cpp, it can detect CPU name. The getHostCPUFeatures is also defined in Host.cpp but it is default to do nothing.<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>2)<span style='font:7.0pt "Times New Roman"'>       </span></span></span><![endif]><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>It can’t detect all the features, as /proc/cpuinfo only defines 19 features, which can be found in arch/arm/kernel/setup.c of source code of Linux kernel. LLVM defines it own features for ARM in ARM.td. The features in Linux and features in ARM have differect names, so I map the former to the latter names.<o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:18.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2'><![if !supportLists]><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>3)<span style='font:7.0pt "Times New Roman"'>       </span></span></span><![endif]><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>Not all the 19 features in Linux have the corresponding features in LLVM, actually these features we don’t care about or have no use. So I only translate 7 features having corresponding features in LLVM.  As for v6,v7 and thumb2, they are not defined in /pro/cpuinfo, but we can know that information  from CPU name. But some features are optional for a CPU, such as NEON and VFP, it can’t get that information from CPU name, so getHostCPUFeatures is needed.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'>-Hao<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Evan Cheng [mailto:evan.cheng@apple.com] <br><b>Sent:</b> 2012</span><span style='font-size:10.0pt;font-family:宋体'>年</span><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>12</span><span style='font-size:10.0pt;font-family:宋体'>月</span><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>11</span><span style='font-size:10.0pt;font-family:宋体'>日</span><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> 3:02<br><b>To:</b> Hao Liu<br><b>Cc:</b> llvm-commits@cs.uiuc.edu<br><b>Subject:</b> Re: [llvm-commits] [PATCH]Implement getHostCPUFeatures for ARM Linux platform<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Nitpick:<o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US>+  if (Implementer == "0x41"){ // ARM Ltd.<o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US>Please add a space after ')'.<o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US>This is a welcome fix. We need auto-detection since some benchmarking efforts do not specify target cpus. However, I can't help but noticing all the features this patch doesn't detect. Is it possible to detect whether the cpu supports v6, v7, thumb2, etc.? Or better yet, is it possible to detect CPU name?<o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US>Evan<o:p></o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><div><p class=MsoNormal><span lang=EN-US>On Dec 9, 2012, at 6:44 PM, Hao Liu <<a href="mailto:Hao.Liu@arm.com">Hao.Liu@arm.com</a>> wrote:<o:p></o:p></span></p></div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US><o:p> </o:p></span></p><div><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>Hi,<o:p></o:p></span></p><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>Attached is a patch to define getHostCPUFeatures for ARM Linux platform in Host.cpp. Currently the CPU features have default values. The getHostCPUFeatures function do nothing and only return false.<o:p></o:p></span></p><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>The implementation is like getHostCPUName for ARM Linux platform in Host.cpp:<o:p></o:p></span></p><div style='margin-left:18.0pt'><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph;text-indent:-18.0pt'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>1)</span><span lang=EN-US style='font-size:7.0pt'>      <span class=apple-converted-space> </span></span><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>Read /proc/cpuinfo and get the ‘Features’ line.<o:p></o:p></span></p></div><div style='margin-left:18.0pt'><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph;text-indent:-18.0pt'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>2)</span><span lang=EN-US style='font-size:7.0pt'>      <span class=apple-converted-space> </span></span><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>For each feature which has corresponding feature in LLVM, translate the feature name in /proc/cpuinfo to LLVM feature key name in ARM.td .<o:p></o:p></span></p></div><div style='margin-left:18.0pt'><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph;text-indent:-18.0pt'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>3)</span><span lang=EN-US style='font-size:7.0pt'>      <span class=apple-converted-space> </span></span><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>Add all features to StringMap and set value to true.<o:p></o:p></span></p></div><div style='margin-left:18.0pt'><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph;text-indent:-18.0pt'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>4)</span><span lang=EN-US style='font-size:7.0pt'>      <span class=apple-converted-space> </span></span><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>If success, return true, otherwise return false.<o:p></o:p></span></p></div><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>Thanks,<o:p></o:p></span></p><p class=MsoNormal style='text-align:justify;text-justify:inter-ideograph'><span lang=EN-US style='font-size:10.5pt;font-family:"Calibri","sans-serif"'>-Hao<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'><ARMLinuxFeatures.patch>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu"><span style='color:purple'>llvm-commits@cs.uiuc.edu</span></a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits"><span style='color:purple'>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</span></a><o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></div></body></html>