<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=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
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
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.sewq36ksgrnqs73
        {mso-style-name:sewq36ksgrnqs73;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.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:799957587;
        mso-list-type:hybrid;
        mso-list-template-ids:-1214880770 44585902 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
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 bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Please open a bugzilla ticket and attach your testcase. It will allow us to debug and fix the problem.<o:p></o:p></span></a></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo1">
<![if !supportLists]><span style="font-family:"Calibri",sans-serif;color:#2F5496"><span style="mso-list:Ignore">-<span style="font:7.0pt "Times New Roman"">         
</span></span></span><![endif]><span dir="LTR"></span><b><i><span style="color:#2F5496"> Elena<o:p></o:p></span></i></b></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:36.0pt"><a name="_____replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">
 JinGu [mailto:jingu@codeplay.com] <br>
<b>Sent:</b> Saturday, September 16, 2017 00:38<br>
<b>To:</b> Demikhovsky, Elena <elena.demikhovsky@intel.com>; daniel_l_sanders@apple.com <daniel_l_sanders@apple.com>; Jon Chesterfield <jonathanchesterfield@gmail.com><br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: Question about 'DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT'<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<p style="margin-left:36.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Hi Elena,</span><o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Thanks for your response.<br>
<br>
The store is ok but the extending load generates assertion after the store because MemVT is i8 and VT is i1 on following line.</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt">
<span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#222222"><br>
assert(MemVT.getScalarType().bitsLT(VT.getScalarType()) && "Should only be an extending load, not truncating!")<br>
<br>
so I think we need to use non-extending load for element size less than 8bit on "DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT" like this roughly.</span><span style="font-family:"Arial",sans-serif;color:#222222"><o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#222222">if (N->getOperand(0).getValueType().getVectorElementType().getSizeInBits() < 8) {<br>
  return DAG.getLoad(N->getValueType(0), dl, Store, StackPtr, MachinePointerInfo());<br>
} else {<br>
   return DAG.getExtLoad(ISD::EXTLOAD, dl, N->getValueType(0), Store, StackPtr, MachinePointerInfo(), EltVT);<br>
}</span><span style="font-family:"Arial",sans-serif;color:#222222"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Arial",sans-serif;color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#222222">How do you think about it?</span><span style="font-family:"Arial",sans-serif;color:#222222"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Arial",sans-serif;color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#222222">Thanks,</span><span style="font-family:"Arial",sans-serif;color:#222222"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#222222">JinGu Kang</span><span style="font-family:"Arial",sans-serif;color:#222222"><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:36.0pt">On 15/09/2017 18:42, Demikhovsky, Elena wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre style="margin-left:36.0pt">extends the elements to 8bit and stores them on stack.<o:p></o:p></pre>
</blockquote>
<pre style="margin-left:36.0pt">Store is responsible for zero-extend. This is the policy...<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">-  Elena<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">-----Original Message-----<o:p></o:p></pre>
<pre style="margin-left:36.0pt">From: <a href="mailto:jingu@codeplay.com">jingu@codeplay.com</a> [<a href="mailto:jingu@codeplay.com">mailto:jingu@codeplay.com</a>] <o:p></o:p></pre>
<pre style="margin-left:36.0pt">Sent: Friday, September 15, 2017 17:45<o:p></o:p></pre>
<pre style="margin-left:36.0pt">To: <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>; Demikhovsky, Elena <a href="mailto:elena.demikhovsky@intel.com"><elena.demikhovsky@intel.com></a>; <a href="mailto:daniel_l_sanders@apple.com">daniel_l_sanders@apple.com</a><o:p></o:p></pre>
<pre style="margin-left:36.0pt">Subject: Re: Question about 'DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT'<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">Can someone give the comment about it please?<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">Thanks,<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">JinGu Kang<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">On 14/09/17 12:05, <a href="mailto:jingu@codeplay.com">jingu@codeplay.com</a> wrote:<o:p></o:p></pre>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre style="margin-left:36.0pt">Hi All,<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">I have a question about splitting 'EXTRACT_VECTOR_ELT' with 'v2i1'. I <o:p></o:p></pre>
<pre style="margin-left:36.0pt">have a llvm IR code snippet as following:<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">llvm IR code snippet:<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">for.body:                                         ; preds = %entry, <o:p></o:p></pre>
<pre style="margin-left:36.0pt">%for.cond<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  %i.022 = phi i32 [ 0, %entry ], [ %inc, %for.cond ]<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  %0 = icmp ne <2 x i32> %vecinit1, <i32 0, i32 -23><o:p></o:p></pre>
<pre style="margin-left:36.0pt">  %1 = extractelement <2 x i1> %0, i32 %i.022<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  %vecext4 = extractelement <2 x i32> %vecinit1, i32 %i.022<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  %vecext5 = extractelement <2 x i32> <i32 0, i32 -23>, i32 %i.022<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  %cmp6 = icmp ne i32 %vecext4, %vecext5<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  %cmp7 = xor i1 %1, %cmp6<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">...<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">and the SelectionDAG before TypeLegalizer is like this.<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">  t0: ch = EntryToken<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  t2: i32,ch = CopyFromReg t0, Register:i32 %vreg0<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  t3: ch = ValueType:i32<o:p></o:p></pre>
<pre style="margin-left:36.0pt">      t5: i32,ch = CopyFromReg t2:1, Register:i32 %vreg1<o:p></o:p></pre>
<pre style="margin-left:36.0pt">    t7: i32 = AssertZext t5, ValueType:ch:i1<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  t8: v2i32 = BUILD_VECTOR t2, t7<o:p></o:p></pre>
<pre style="margin-left:36.0pt">  t11: v2i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<-23><o:p></o:p></pre>
<pre style="margin-left:36.0pt">  t15: i32,ch = CopyFromReg t0, Register:i32 %vreg2<o:p></o:p></pre>
<pre style="margin-left:36.0pt">          t22: i32 = add t15, Constant:i32<1><o:p></o:p></pre>
<pre style="margin-left:36.0pt">        t24: ch = CopyToReg t0, Register:i32 %vreg3, t22<o:p></o:p></pre>
<pre style="margin-left:36.0pt">        t27: ch = CopyToReg t0, Register:i32 %vreg8, Constant:i32<-1><o:p></o:p></pre>
<pre style="margin-left:36.0pt">      t31: ch = TokenFactor t24, t27<o:p></o:p></pre>
<pre style="margin-left:36.0pt">            t13: v2i1 = setcc t8, t11, setne:ch<o:p></o:p></pre>
<pre style="margin-left:36.0pt">          t16: i1 = extract_vector_elt t13, t15<o:p></o:p></pre>
<pre style="margin-left:36.0pt">            t17: i32 = extract_vector_elt t8, t15<o:p></o:p></pre>
<pre style="margin-left:36.0pt">            t18: i32 = extract_vector_elt t11, t15<o:p></o:p></pre>
<pre style="margin-left:36.0pt">          t19: i1 = setcc t17, t18, setne:ch<o:p></o:p></pre>
<pre style="margin-left:36.0pt">        t20: i1 = xor t16, t19<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">...<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">I have not added any vector register class so 'DAGTypeLegalizer' tries <o:p></o:p></pre>
<pre style="margin-left:36.0pt">to split the "t16: i1 = extract_vector_elt t13, t15" because  t13's <o:p></o:p></pre>
<pre style="margin-left:36.0pt">result type is 'v2i1'. If the size of vector element is less than <o:p></o:p></pre>
<pre style="margin-left:36.0pt">8bit, 'DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT()' function <o:p></o:p></pre>
<pre style="margin-left:36.0pt">extends the elements to 8bit and stores them on stack. Finally, the <o:p></o:p></pre>
<pre style="margin-left:36.0pt">function generates 'ExtLoad' to load specific element. But if the <o:p></o:p></pre>
<pre style="margin-left:36.0pt">element's size is less than 8bit, I think it could be wrong. It looks <o:p></o:p></pre>
<pre style="margin-left:36.0pt">it needs just 'Load' or "Load and Truncate" to match the result type <o:p></o:p></pre>
<pre style="margin-left:36.0pt">of 'EXTRACT_VECTOR_ELT'. How do you think about it? If I missed <o:p></o:p></pre>
<pre style="margin-left:36.0pt">something, please let me know.<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">Thanks,<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">JinGu Kang<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
</blockquote>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">---------------------------------------------------------------------<o:p></o:p></pre>
<pre style="margin-left:36.0pt">Intel Israel (74) Limited<o:p></o:p></pre>
<pre style="margin-left:36.0pt"><o:p> </o:p></pre>
<pre style="margin-left:36.0pt">This e-mail and any attachments may contain confidential material for<o:p></o:p></pre>
<pre style="margin-left:36.0pt">the sole use of the intended recipient(s). Any review or distribution<o:p></o:p></pre>
<pre style="margin-left:36.0pt">by others is strictly prohibited. If you are not the intended<o:p></o:p></pre>
<pre style="margin-left:36.0pt">recipient, please contact the sender and delete all copies.<o:p></o:p></pre>
</blockquote>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
</div>
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited</p>

<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></body>
</html>