<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 30, 2014 at 4:04 PM, Serge Pavlov <span dir="ltr"><<a href="mailto:sepavloff@gmail.com" target="_blank">sepavloff@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Pete, Quentin,<div><br></div><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div>In the specific example here for the constant 0, i’d have expected to see xor used to create the 0.  Any idea why that didn’t happen?  That would improve the code size which Quentin mentioned is a plus for this.</div></div></blockquote><div><br></div></span><div>This pass can be modified to load zero in this way. Probably it is better to improve instruction selector properly as loading zero in such way might be useful not only for caching immediates in register.</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Also, i’ve sometimes seen neighboring 0’s being written of different sizes.  Would it be possible (perhaps in a future patch), to turn</div><div><br></div><div>movq 0, 0x0(%rsi)</div>movl 0, 0x8(%rsi)<div><br></div><div>in to</div><div><br></div><div>xor %rax, %rax</div><div>movq %rax, 0x0(%rsi)</div><div>movl %eax, 0x8(%rsi)</div><div><br></div></div></blockquote><div><br></div></span><div>Yes, subregisters are taken into account. For instance instructions:</div><div><br></div><div>movw 0x5555, 0x0(%rsi)</div><div>movw 0x5555, 0x4(%rsi)</div><div><div>movb 0x55, 0x8(%rsi)</div></div><div><br></div><div>are transformed into:</div><div><br></div><div>movw 0x5555, %ax</div><div><div>movw %ax, 0x0(%rsi)</div><div>movw %ax, 0x4(%rsi)</div><div>movb %al, 0x8(%rsi)</div></div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><div><div><div><blockquote type="cite"><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">The constant hoisting pass does this kind of things. Should we try to teach it to handle this kind of cases?</span></div></blockquote></div></div></div></div></div></div></div></blockquote></span><div>That would be interesting. However this pass is x86 specific and can use processor features (subregister structure, loading 64-bit value with 32-bit move). Can theses features be used by constant hoisting? </div><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><div><div><div><blockquote type="cite"><div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Moreover, this may be beneficial for code size, but I guess it is generally not beneficial for performances. Therefore, I believe this should be done for functions with the Os or Oz attributes only.</span></div></blockquote></div></div></div></div></div></div></div></blockquote></span><div>Just curious, why? Moves from register must be faster than move from memory. Both gcc and icc use moves from register when compiling with optimization.  </div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div></div></div></blockquote><div>What about the side effects in register pressure? <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="HOEnZb"><font color="#888888"><div></div><div>--Serge </div></font></span></div></div></div>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>