<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:x="urn:schemas-microsoft-com:office:excel" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" 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 14 (filtered medium)"><style><!--
/* Font Definitions */
@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:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>It works, thanks a lot!<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><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Vector_extract / vector_insert have a comment that says they are deprecated. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I think this should be updated to say that they can be used when the result’s type is larger than the element type.<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><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Craig Topper [mailto:craig.topper@gmail.com] <br><b>Sent:</b> Thursday, November 28, 2019 6:42 PM<br><b>To:</b> Sebastien Le Duc<br><b>Cc:</b> llvm-dev<br><b>Subject:</b> Re: [llvm-dev] Question on pattern matching extractelt<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal>I think it’s disallowed by the SDTypeProfile in TargetSelectionDAG.td. You can use vector_extract instead of extractelt which is what some other targets like WebAssembly are doing for this issue. It's type profile is more relaxed on this.<o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Thu, Nov 28, 2019 at 8:51 AM Sebastien Le Duc via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><div><div><div><div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>Hi,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>I have an issue with pattern matching.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>I have the following SelectionDAG:<o:p></o:p></span></p></div><div><pre style='mso-margin-top-alt:3.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;font-variant-caps:normal;text-decoration-style:initial;text-decoration-color:initial;box-sizing:inherit;word-spacing:0px'><span style='font-family:Consolas;color:black'>t13: i32 = extract_vector_elt t2, Constant:i64<1><br><br>That I am trying to match with the following pattern:<o:p></o:p></span></pre></div><pre style='mso-margin-top-alt:3.0pt;margin-right:0in;margin-bottom:3.0pt;margin-left:0in;box-sizing:inherit;font-variant-ligatures:none;white-space:pre-wrap;border-radius:4px;font-variant-caps:normal;text-decoration-style:initial;text-decoration-color:initial;word-spacing:0px'><span style='font-size:9.0pt;font-family:Consolas;color:#1D1C1D'>def : Pat<(extractelt (v4i16 SingleReg:$v), 1), (SRADd1 SingleReg :$v, (i64 16))>;<o:p></o:p></span></pre></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>But for some reason the pattern does not match.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>It seems to be  due to the fact extract_vector_elt's result type is i32 (because i16 is not a legal type on our processor), but according to the comment in ISDOpcodes.h, it is allowed for EXTRACT_VECTOR_ELT to have a result type larger than the element type of the vector, so I would expect to be able to match such pattern.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>I tried specifying the result type in the pattern:<o:p></o:p></span></p></div><div><pre style='mso-margin-top-alt:3.0pt;margin-right:0in;margin-bottom:3.0pt;margin-left:0in;font-variant-caps:normal;text-decoration-style:initial;text-decoration-color:initial;box-sizing:inherit;font-variant-ligatures:none;white-space:pre-wrap;border-radius:4px;word-spacing:0px'><span style='font-size:9.0pt;font-family:Consolas;color:#1D1C1D'>def : Pat<(i32 (extractelt (v4i16 SingleReg:$v), 1)), (SRADd1 SingleReg :$v, (i64 16))>;<o:p></o:p></span></pre><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p></div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'>But in that case I get a tblgen error:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Arial","sans-serif";color:black'><o:p> </o:p></span></p></div><div><div style='margin-left:48.0pt;margin-right:15.0pt;box-sizing:inherit;min-width:1px;font-variant-ligatures:common-ligatures;font-variant-caps:normal;text-align:start;text-decoration-style:initial;text-decoration-color:initial;word-spacing:0px'><div><div><div><div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'>possible type contradiction in the pattern below (use -print-records with llvm-tblgen to see all expanded records).<br>anonymous_1188: (extractelt:{ *:[] } SingleReg:{ *:[] }:$v, 0:{ *:[i64] })<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'>Is there anyway to match such pattern? <o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'>Thanks in advacne!<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'>regards,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'>Sebastien<o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'><o:p> </o:p></span></p></div></div></div></div><div><p class=MsoNormal><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#1D1C1D'><o:p> </o:p></span></p></div></div></div></div><p class=MsoNormal>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p></o:p></p></blockquote></div></div></div></body></html>