<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Thanks!<br class=""><div><blockquote type="cite" class=""><div class="">On Jul 5, 2016, at 1:34 PM, Balaram Makam <<a href="mailto:bmakam@codeaurora.org" class="">bmakam@codeaurora.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: 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 style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Hi Quentin,<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">I have reverted it in r274573.<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Thanks,<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Balaram<o:p class=""></o:p></span></div><div class=""><div style="border-style: solid none none; border-top-color: rgb(225, 225, 225); border-top-width: 1pt; padding: 3pt 0in 0in;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><b class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">From:</span></b><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""><span class="Apple-converted-space"> </span><a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a> [<a href="mailto:qcolombet@apple.com" class="">mailto:qcolombet@apple.com</a>]<span class="Apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Tuesday, July 05, 2016 3:24 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Balaram Makam <<a href="mailto:bmakam@codeaurora.org" class="">bmakam@codeaurora.org</a>><br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [llvm] r259387 - AArch64: Implement missed conditional compare sequences.<o:p class=""></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi Balaram,<o:p class=""></o:p></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Thanks for the update.<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On Jul 5, 2016, at 5:01 AM, Balaram Makam <<a href="mailto:bmakam@codeaurora.org" style="color: purple; text-decoration: underline;" class="">bmakam@codeaurora.org</a>> wrote:<o:p class=""></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Hi Quentin,</span><o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Sorry for late reply, I was on vacation last week. I haven’t got any further with this because it is low priority to us. If you think it is blocking your work, I can revert this change and work on moving this to performDAGCombine later.</span><o:p class=""></o:p></div></div></div></blockquote><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">If that works for you, that would be great!<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Right now, it is reverted in our branch but if we can avoid to diverge, that would be super nice!<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Thanks,<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">-Quentin<o:p class=""></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class=""><br class=""><o:p class=""></o:p></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Thanks,</span><o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Balaram</span><o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div><div class=""><div style="border-style: solid none none; border-top-color: rgb(225, 225, 225); border-top-width: 1pt; padding: 3pt 0in 0in;" class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><b class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">From:</span></b><span class="apple-converted-space"><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""><a href="mailto:qcolombet@apple.com" style="color: purple; text-decoration: underline;" class="">qcolombet@apple.com</a><span class="Apple-converted-space"> </span>[<a href="mailto:qcolombet@apple.com" style="color: purple; text-decoration: underline;" class="">mailto:qcolombet@apple.com</a>]<span class="apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="apple-converted-space"> </span>Wednesday, June 29, 2016 9:26 PM<br class=""><b class="">To:</b><span class="apple-converted-space"> </span>Quentin Colombet <<a href="mailto:qcolombet@apple.com" style="color: purple; text-decoration: underline;" class="">qcolombet@apple.com</a>><br class=""><b class="">Cc:</b><span class="apple-converted-space"> </span>Balaram Makam <<a href="mailto:bmakam@codeaurora.org" style="color: purple; text-decoration: underline;" class="">bmakam@codeaurora.org</a>>;<span class="Apple-converted-space"> </span><a href="mailto:llvm-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class="">llvm-commits@lists.llvm.org</a><br class=""><b class="">Subject:</b><span class="apple-converted-space"> </span>Re: [llvm] r259387 - AArch64: Implement missed conditional compare sequences.</span><o:p class=""></o:p></div></div></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi Balaram,<o:p class=""></o:p></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Any update on that front?<o:p class=""></o:p></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Thanks,<o:p class=""></o:p></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">-Quentin<o:p class=""></o:p></div></div><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On Jun 9, 2016, at 9:58 AM, Quentin Colombet via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">llvm-commits@lists.llvm.org</span></a>> wrote:<o:p class=""></o:p></div></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div><div class=""><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><br class="">On Jun 9, 2016, at 9:19 AM, Balaram Makam <<a href="mailto:bmakam@codeaurora.org" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">bmakam@codeaurora.org</span></a>> wrote:</span><o:p class=""></o:p></div></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""> </span><o:p class=""></o:p></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">The transformation that helps my case is applicable during LegalizeDAG. It will try to construct a ccmp sequence when it sees And i32/i64, Or i32/i64 with setcc leafs. If the result is feedback into condition input of a node like BRCOND or CSEL it will pessimize the codegen. Since LegalizeDAG works in reverse topological order, the only way my transformation is applicable is when we previously had a zext i1->i32 or if we failed to construct ccmp sequence at SELECT_CC nodes because<span class="apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: 'Segoe UI', sans-serif; background-color: white; background-position: initial initial; background-repeat: initial initial;" class="">isConjunctionDisjunctionTree<span class="apple-converted-space"> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">was not satisfied. If I want to move the transform to PerformDAGCombine and still keep using the utilities<span class="apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: 'Segoe UI', sans-serif; background-color: white; background-position: initial initial; background-repeat: initial initial;" class="">isConjunctionDisjunctionTree<span class="apple-converted-space"> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">and</span><span class="apple-converted-space"><span style="font-size: 10pt; font-family: 'Segoe UI', sans-serif; background-color: white; background-position: initial initial; background-repeat: initial initial;" class=""> </span></span><span style="font-size: 10pt; font-family: 'Segoe UI', sans-serif; background-color: white; background-position: initial initial; background-repeat: initial initial;" class="">emitConditionalComparison<span class="apple-converted-space"> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">I will have to do before LegalizeOps phase, but since LowerSELECT_CC is not yet called I will have to additionally check if the result of AND/OR is feedback into BRCOND or CSEL and bail out conservatively. This will miss some opportunities where we would have transformed if it failed to construct a ccmp sequence at SELECT_CC nodes. If we want to catch all the opportunities, we need to do the transform afterLegalizeVectorOps phase, but now the setcc and cmp nodes are all lowered into AArch64 specific DAG nodes and the utilities<span class="apple-converted-space"> </span></span><span style="font-size: 10pt; font-family: 'Segoe UI', sans-serif; background-color: white; background-position: initial initial; background-repeat: initial initial;" class="">isConjunctionDisjunctionTree<span class="apple-converted-space"> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">and</span><span style="font-size: 10pt; font-family: 'Segoe UI', sans-serif; background-color: white; background-position: initial initial; background-repeat: initial initial;" class="">emitConditionalComparison<span class="apple-converted-space"> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">will fail to match the pattern. So I don’t see an easy way to do this without a lot of refactoring.</span><o:p class=""></o:p></div></div></div></div></blockquote><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""> </span><o:p class=""></o:p></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">Refactoring the utility functions seems the way to go. You may also catch more cases, if those AArch64 specific nodes can be introduced by other transformations.</span><o:p class=""></o:p></div></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><br class=""><br class=""><br class=""></span><o:p class=""></o:p></div></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">-Balaram  </span><o:p class=""></o:p></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div></div><div class=""><div style="border-style: solid none none; border-top-color: rgb(225, 225, 225); border-top-width: 1pt; padding: 3pt 0in 0in;" class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><b class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">From:</span></b><span class="apple-converted-space"><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""><a href="mailto:qcolombet@apple.com" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">qcolombet@apple.com</span></a><span class="apple-converted-space"> </span>[<a href="mailto:qcolombet@apple.com" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">mailto:qcolombet@apple.com</span></a>]<span class="apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="apple-converted-space"> </span>Wednesday, June 08, 2016 6:32 PM<br class=""><b class="">To:</b><span class="apple-converted-space"> </span>Balaram Makam <<a href="mailto:bmakam@codeaurora.org" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">bmakam@codeaurora.org</span></a>><br class=""><b class="">Cc:</b><span class="apple-converted-space"> </span><a href="mailto:llvm-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">llvm-commits@lists.llvm.org</span></a><br class=""><b class="">Subject:</b><span class="apple-converted-space"> </span>Re: [llvm] r259387 - AArch64: Implement missed conditional compare sequences.</span><o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi Balaram,<o:p class=""></o:p></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On Jun 8, 2016, at 2:10 PM, Balaram Makam <<a href="mailto:bmakam@codeaurora.org" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">bmakam@codeaurora.org</span></a>> wrote:<o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Hi Quentin,</span><o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">I don’t see an easy way to achieve the same combine in PerformDAGCombine because it depends on the utilities emitConditionalComparison and isConjunctionDisjunctionTree that will now fail to match the AArch64 specific DAG nodes.</span><o:p class=""></o:p></div></div></div></div></div></blockquote><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">I am not sure I get why this is a problem. You should be able to use those within PerformDAGCombine, shouldn’t you?<o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class=""><br class=""><br class=""><br class=""><o:p class=""></o:p></div></div></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Is there any other way we could do the custom lowering with just the isLegal part of the check?</span><o:p class=""></o:p></div></div></div></div></div></blockquote><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">No, there is not at legalization time.<o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">When does the combine, that help in your case, apply?<o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Cheers,<o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">-Quentin<br class=""><br class=""><br class=""><br class=""><o:p class=""></o:p></div></div></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Regards,</span><o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Balaram</span><o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div></div></div><div class=""><div style="border-style: solid none none; border-top-color: rgb(225, 225, 225); border-top-width: 1pt; padding: 3pt 0in 0in;" class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><b class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">From:</span></b><span class="apple-converted-space"><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">Quentin Colombet [</span><a href="mailto:qcolombet@apple.com" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: purple;" class="">mailto:qcolombet@apple.com</span></a><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">]<span class="apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="apple-converted-space"> </span>Monday, June 06, 2016 7:34 PM<br class=""><b class="">To:</b><span class="apple-converted-space"> </span>Balaram Makam <</span><a href="mailto:bmakam@codeaurora.org" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: purple;" class="">bmakam@codeaurora.org</span></a><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">><br class=""><b class="">Cc:</b><span class="apple-converted-space"> </span></span><a href="mailto:llvm-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: purple;" class="">llvm-commits@lists.llvm.org</span></a><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""><br class=""><b class="">Subject:</b><span class="apple-converted-space"> </span>Re: [llvm] r259387 - AArch64: Implement missed conditional compare sequences.</span><o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi Balaram,<o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On Jun 6, 2016, at 2:43 PM, Balaram Makam <<a href="mailto:bmakam@codeaurora.org" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">bmakam@codeaurora.org</span></a>> wrote:<o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Hi Quentin,</span><o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">I will take another look at this. I believe the problem is seen only on the internal branch. Do you have a test case to reproduce the issue?</span><o:p class=""></o:p></div></div></div></div></div></div></blockquote><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Unfortunately, no, I do not have a test case for you.<o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Basically, this patch generates illegal code after legalization, and the problem is only the fact that we use Custom here to check legality.<o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">You should be able to achieve the same combine in the AArch64 backend with just the isLegal part of the check.<o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">There are a bunch of hooks during the lowering of SDAG and I am pretty sure you could find another way to do your custom lowering (I know I’ve already been in that situation :)). The "perform dag combine” that I mentioned should be one of them, but you have others.<o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Cheers,<o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">-Quentin<o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class=""><br class=""><br class=""><br class=""><br class=""><o:p class=""></o:p></div></div></div></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Thanks,</span><o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Balaram</span><o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span><o:p class=""></o:p></div></div></div></div></div><div class=""><div style="border-style: solid none none; border-top-color: rgb(225, 225, 225); border-top-width: 1pt; padding: 3pt 0in 0in;" class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><b class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">From:</span></b><span class="apple-converted-space"><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""> </span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">Quentin Colombet [</span><a href="mailto:qcolombet@apple.com" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: purple;" class="">mailto:qcolombet@apple.com</span></a><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">]<span class="apple-converted-space"> </span><br class=""><b class="">Sent:</b><span class="apple-converted-space"> </span>Monday, June 06, 2016 5:30 PM<br class=""><b class="">To:</b><span class="apple-converted-space"> </span>Balaram Makam <</span><a href="mailto:bmakam@codeaurora.org" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: purple;" class="">bmakam@codeaurora.org</span></a><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class="">><br class=""><b class="">Cc:</b><span class="apple-converted-space"> </span></span><a href="mailto:llvm-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: purple;" class="">llvm-commits@lists.llvm.org</span></a><span style="font-size: 11pt; font-family: Calibri, sans-serif;" class=""><br class=""><b class="">Subject:</b><span class="apple-converted-space"> </span>Re: [llvm] r259387 - AArch64: Implement missed conditional compare sequences.</span><o:p class=""></o:p></div></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Hi Balaram,<o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Sorry for the late reply, but I am seeing this commit is causing problem internally.<o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On Feb 1, 2016, at 11:13 AM, Balaram Makam via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">llvm-commits@lists.llvm.org</span></a>> wrote:<o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Author: bmakam<br class="">Date: Mon Feb  1 13:13:07 2016<br class="">New Revision: 259387<br class=""><br class="">URL:<span class="apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=259387&view=rev" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">http://llvm.org/viewvc/llvm-project?rev=259387&view=rev</span></a><br class="">Log:<br class="">AArch64: Implement missed conditional compare sequences.<br class=""><br class="">Summary:<br class="">This is an extension to the existing implementation of r242436 which<br class="">restricts to only select inputs. This version fixes missed opportunities<br class="">in pr26084 by attempting to lower conditional compare sequences of<br class="">and/or trees with setcc leafs. This will additionaly handle the case<br class="">when a tree with select input is not a conjunction-disjunction tree<br class="">but some of the sub trees are conjunction-disjunction trees.<br class=""><br class="">Reviewers: jmolloy, t.p.northover, mcrosier, MatzeB<br class=""><br class="">Subscribers: mcrosier, llvm-commits, junbuml, haicheng, mssimpso, gberry<br class=""><br class="">Differential Revision:<span class="apple-converted-space"> </span><a href="http://reviews.llvm.org/D16291" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">http://reviews.llvm.org/D16291</span></a><br class=""><br class="">Modified:<br class="">   llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br class="">   llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp<br class="">   llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h<br class="">   llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br class="">URL:<span class="apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=259387&r1=259386&r2=259387&view=diff" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=259387&r1=259386&r2=259387&view=diff</span></a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Feb  1 13:13:07 2016<br class="">@@ -1721,7 +1721,7 @@ SDValue DAGCombiner::visitADD(SDNode *N)<br class="">    return SDValue(N, 0);<br class=""><br class="">  // fold (a+b) -> (a|b) iff a and b share no bits.<br class="">-  if ((!LegalOperations || TLI.isOperationLegal(ISD::OR, VT)) &&<br class="">+  if ((!LegalOperations || TLI.isOperationLegalOrCustom(ISD::OR, VT)) &&<o:p class=""></o:p></div></div></div></div></div></div></div></blockquote><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">This is wrong. Custom does not imply that the operation is Legal!<o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">You said in the review that without custom, one of the lit test case was failing. I believe you can fix that by making the Custom lowering as part of the combine process (<span style="font-size: 8.5pt;" class="">PerformDAGCombine</span>.)<o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Anyhow, this line is generally not correct.<o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Cheers,<o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">-Quentin<o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""> <o:p class=""></o:p></div></div></div></div></div></div><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><o:p class=""></o:p></div></div></div></div></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="" type="cite"><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">      VT.isInteger() && !VT.isVector() && DAG.haveNoCommonBitsSet(N0, N1))<br class="">    return DAG.getNode(ISD::OR, SDLoc(N), VT, N0, N1);<br class=""><br class="">@@ -6363,7 +6363,7 @@ SDValue DAGCombiner::visitZERO_EXTEND(SD<br class="">      isa<LoadSDNode>(N0.getOperand(0)) &&<br class="">      N0.getOperand(1).getOpcode() == ISD::Constant &&<br class="">      TLI.isLoadExtLegal(ISD::ZEXTLOAD, VT, N0.getValueType()) &&<br class="">-      (!LegalOperations && TLI.isOperationLegal(N0.getOpcode(), VT))) {<br class="">+      (!LegalOperations && TLI.isOperationLegalOrCustom(N0.getOpcode(), VT))) {<br class="">    LoadSDNode *LN0 = cast<LoadSDNode>(N0.getOperand(0));<br class="">    if (LN0->getExtensionType() != ISD::SEXTLOAD && LN0->isUnindexed()) {<br class="">      bool DoXform = true;<br class=""><br class="">Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp<br class="">URL:<span class="apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=259387&r1=259386&r2=259387&view=diff" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=259387&r1=259386&r2=259387&view=diff</span></a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)<br class="">+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Mon Feb  1 13:13:07 2016<br class="">@@ -144,6 +144,16 @@ AArch64TargetLowering::AArch64TargetLowe<br class="">  setOperationAction(ISD::XOR, MVT::i32, Custom);<br class="">  setOperationAction(ISD::XOR, MVT::i64, Custom);<br class=""><br class="">+  // Custom lowering hooks are needed for OR<br class="">+  // to fold it into CCMP.<br class="">+  setOperationAction(ISD::OR, MVT::i32, Custom);<br class="">+  setOperationAction(ISD::OR, MVT::i64, Custom);<br class="">+<br class="">+  // Custom lowering hooks are needed for AND<br class="">+  // to fold it into CCMP.<br class="">+  setOperationAction(ISD::AND, MVT::i32, Custom);<br class="">+  setOperationAction(ISD::AND, MVT::i64, Custom);<br class="">+<br class="">  // Virtually no operation on f128 is legal, but LLVM can't expand them when<br class="">  // there's a valid register class, so we need custom operations in most cases.<br class="">  setOperationAction(ISD::FABS, MVT::f128, Expand);<br class="">@@ -1597,6 +1607,27 @@ static SDValue getAArch64Cmp(SDValue LHS<br class="">  return Cmp;<br class="">}<br class=""><br class="">+// Attempt to form conditional compare sequences for and/or trees<br class="">+// with setcc leafs.<br class="">+static SDValue tryLowerToAArch64Cmp(SDValue Op, SelectionDAG &DAG) {<br class="">+  SDValue LHS = Op.getOperand(0);<br class="">+  SDValue RHS = Op.getOperand(1);<br class="">+  if ((LHS.getOpcode() != ISD::SETCC) || (RHS.getOpcode() != ISD::SETCC))<br class="">+    return Op;<br class="">+<br class="">+  bool CanNegate;<br class="">+  if (!isConjunctionDisjunctionTree(Op, CanNegate))<br class="">+    return SDValue();<br class="">+<br class="">+  EVT VT = Op.getValueType();<br class="">+  SDLoc DL(Op);<br class="">+  SDValue TVal = DAG.getConstant(1, DL, VT);<br class="">+  SDValue FVal = DAG.getConstant(0, DL, VT);<br class="">+  SDValue CCVal;<br class="">+  SDValue Cmp = getAArch64Cmp(Op, FVal, ISD::SETEQ, CCVal, DAG, DL);<br class="">+  return DAG.getNode(AArch64ISD::CSEL, DL, VT, FVal, TVal, CCVal, Cmp);<br class="">+}<br class="">+<br class="">static std::pair<SDValue, SDValue><br class="">getAArch64XALUOOp(AArch64CC::CondCode &CC, SDValue Op, SelectionDAG &DAG) {<br class="">  assert((Op.getValueType() == MVT::i32 || Op.getValueType() == MVT::i64) &&<br class="">@@ -1718,6 +1749,18 @@ SDValue AArch64TargetLowering::LowerF128<br class="">  return makeLibCall(DAG, Call, MVT::f128, Ops, false, SDLoc(Op)).first;<br class="">}<br class=""><br class="">+SDValue AArch64TargetLowering::LowerAND(SDValue Op, SelectionDAG &DAG) const {<br class="">+  if (Op.getValueType().isVector())<br class="">+    return LowerVectorAND(Op, DAG);<br class="">+  return tryLowerToAArch64Cmp(Op, DAG);<br class="">+}<br class="">+<br class="">+SDValue AArch64TargetLowering::LowerOR(SDValue Op, SelectionDAG &DAG) const {<br class="">+  if (Op.getValueType().isVector())<br class="">+    return LowerVectorOR(Op, DAG);<br class="">+  return tryLowerToAArch64Cmp(Op, DAG);<br class="">+}<br class="">+<br class="">static SDValue LowerXOR(SDValue Op, SelectionDAG &DAG) {<br class="">  SDValue Sel = Op.getOperand(0);<br class="">  SDValue Other = Op.getOperand(1);<br class="">@@ -2372,9 +2415,9 @@ SDValue AArch64TargetLowering::LowerOper<br class="">  case ISD::FCOPYSIGN:<br class="">    return LowerFCOPYSIGN(Op, DAG);<br class="">  case ISD::AND:<br class="">-    return LowerVectorAND(Op, DAG);<br class="">+    return LowerAND(Op, DAG);<br class="">  case ISD::OR:<br class="">-    return LowerVectorOR(Op, DAG);<br class="">+    return LowerOR(Op, DAG);<br class="">  case ISD::XOR:<br class="">    return LowerXOR(Op, DAG);<br class="">  case ISD::PREFETCH:<br class=""><br class="">Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h<br class="">URL:<span class="apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h?rev=259387&r1=259386&r2=259387&view=diff" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h?rev=259387&r1=259386&r2=259387&view=diff</span></a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h (original)<br class="">+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.h Mon Feb  1 13:13:07 2016<br class="">@@ -488,6 +488,8 @@ private:<br class="">  SDValue LowerCTPOP(SDValue Op, SelectionDAG &DAG) const;<br class="">  SDValue LowerF128Call(SDValue Op, SelectionDAG &DAG,<br class="">                        RTLIB::Libcall Call) const;<br class="">+  SDValue LowerAND(SDValue Op, SelectionDAG &DAG) const;<br class="">+  SDValue LowerOR(SDValue Op, SelectionDAG &DAG) const;<br class="">  SDValue LowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;<br class="">  SDValue LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const;<br class="">  SDValue LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const;<br class=""><br class="">Modified: llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll<br class="">URL:<span class="apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll?rev=259387&r1=259386&r2=259387&view=diff" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll?rev=259387&r1=259386&r2=259387&view=diff</span></a><br class="">==============================================================================<br class="">--- llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll (original)<br class="">+++ llvm/trunk/test/CodeGen/AArch64/arm64-ccmp.ll Mon Feb  1 13:13:07 2016<br class="">@@ -371,21 +371,76 @@ define i32 @select_andor(i32 %v1, i32 %v<br class="">  ret i32 %sel<br class="">}<br class=""><br class="">-; CHECK-LABEL: select_noccmp1<br class="">-define i64 @select_noccmp1(i64 %v1, i64 %v2, i64 %v3, i64 %r) {<br class="">-; CHECK: cmp x0, #0<br class="">-; CHECK-NEXT: cset [[REG0:w[0-9]+]], lt<br class="">-; CHECK-NEXT: cmp x0, #13<br class="">-; CHECK-NOT: ccmp<br class="">+; CHECK-LABEL: single_noselect<br class="">+define i32 @single_noselect(i32 %A, i32 %B) #0 {<br class="">+; CHECK: cmp w1, #1<br class="">+; CHECK-NEXT: ccmp w0, #1, #8, ge<br class="">+; CHECK-NEXT: cset w0, lt<br class="">+; CHECK-NEXT: ret<br class="">+  %notlhs = icmp slt i32 %A, 1<br class="">+  %notrhs = icmp slt i32 %B, 1<br class="">+  %lnot = or i1 %notlhs, %notrhs<br class="">+  %conv = zext i1 %lnot to i32<br class="">+  ret i32 %conv<br class="">+}<br class="">+<br class="">+; CHECK-LABEL: single_and_ext<br class="">+define i32 @single_and_ext(i32 %A, i32 %B, i32 %C) #0 {<br class="">+; CHECK: cmp w1, #2<br class="">+; CHECK-NEXT: ccmp w0, #4, #0, lt<br class="">+; CHECK-NEXT: cinc w0, w2, lt<br class="">+; CHECK-NEXT: ret<br class="">+  %cmp = icmp slt i32 %A, 4<br class="">+  %cmp1 = icmp slt i32 %B, 2<br class="">+  %and1 = and i1 %cmp, %cmp1<br class="">+  %conv = zext i1 %and1 to i32<br class="">+  %add = add nsw i32 %conv, %C<br class="">+  ret i32 %add<br class="">+}<br class="">+<br class="">+; CHECK-LABEL: single_noselect_phi<br class="">+define i32 @single_noselect_phi(i32 %A, i32 %B, i32 %C) #0 {<br class="">+; CHECK: cmp w1, #0<br class="">+; CHECK-NEXT: ccmp w0, #0, #4, gt<br class="">; CHECK-NEXT: cset [[REG1:w[0-9]+]], gt<br class="">-; CHECK-NEXT: cmp x2, #2<br class="">+; CHECK-NEXT: cmp w1, #2<br class="">+; CHECK-NEXT: ccmp w0, #4, #8, ge<br class="">; CHECK-NEXT: cset [[REG2:w[0-9]+]], lt<br class="">+; CHECK-NEXT: cmp w2, #0<br class="">+; CHECK-NEXT: csel w0, [[REG1]], [[REG2]], eq<br class="">+; CHECK-NEXT: ret<br class="">+entry:<br class="">+  %tobool = icmp eq i32 %C, 0<br class="">+  br i1 %tobool, label %if.else, label %if.then<br class="">+<br class="">+if.then:                                          ; preds = %entry<br class="">+  %cmp = icmp slt i32 %A, 4<br class="">+  %cmp1 = icmp slt i32 %B, 2<br class="">+  %0 = or i1 %cmp, %cmp1<br class="">+  br label %if.end<br class="">+<br class="">+if.else:                                          ; preds = %entry<br class="">+  %cmp2 = icmp sgt i32 %A, 0<br class="">+  %cmp3 = icmp sgt i32 %B, 0<br class="">+  %1 = and i1 %cmp2, %cmp3<br class="">+  br label %if.end<br class="">+<br class="">+if.end:                                           ; preds = %if.else, %if.then<br class="">+  %<a href="http://b.0.in/" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">b.0.in</span></a><span class="apple-converted-space"> </span>= phi i1 [ %0, %if.then ], [ %1, %if.else ]<br class="">+  %conv = zext i1 %<a href="http://b.0.in/" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">b.0.in</span></a><span class="apple-converted-space"> </span>to i32<br class="">+  ret i32 %conv<br class="">+}<br class="">+<br class="">+; CHECK-LABEL: select_noccmp1<br class="">+define i64 @select_noccmp1(i64 %v1, i64 %v2, i64 %v3, i64 %r) {<br class="">+; CHECK: cmp x0, #13<br class="">+; CHECK-NEXT: ccmp x0, #0, #0, gt<br class="">+; CHECK-NEXT: cset [[REG1:w[0-9]+]], lt<br class="">; CHECK-NEXT: cmp x2, #4<br class="">-; CHECK-NEXT: cset [[REG3:w[0-9]+]], gt<br class="">-; CHECK-NEXT: and [[REG4:w[0-9]+]], [[REG0]], [[REG1]]<br class="">-; CHECK-NEXT: and [[REG5:w[0-9]+]], [[REG2]], [[REG3]]<br class="">-; CHECK-NEXT: orr [[REG6:w[0-9]+]], [[REG4]], [[REG5]]<br class="">-; CHECK-NEXT: cmp [[REG6]], #0<br class="">+; CHECK-NEXT: ccmp x2, #2, #0, gt<br class="">+; CHECK-NEXT: cset [[REG2:w[0-9]+]], lt<br class="">+; CHECK-NEXT: orr [[REG3:w[0-9]+]], [[REG1]], [[REG2]]<br class="">+; CHECK-NEXT: cmp [[REG3]], #0<br class="">; CHECK-NEXT: csel x0, xzr, x3, ne<br class="">; CHECK-NEXT: ret<br class="">  %c0 = icmp slt i64 %v1, 0<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">llvm-commits@lists.llvm.org</span></a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" style="color: purple; text-decoration: underline;" class=""><span style="color: purple;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</span></a><o:p class=""></o:p></div></div></div></div></div></div></div></blockquote></div></div></blockquote></div></div></blockquote></div></div></div></blockquote></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""></span><a href="mailto:llvm-commits@lists.llvm.org" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: purple;" class="">llvm-commits@lists.llvm.org</span></a><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><br class=""></span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif; color: purple;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</span></a></div></div></div></blockquote></div></div></div></blockquote></div></div></div></div></blockquote></div><br class=""></body></html>