<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=""><div class="">I suspect that this is because the mask in your example is the result of a variable shift, which (a) has it’s own performance and flags hazards pre-SHLX and (b) requires additional µops to do with TEST.  I expect that ICC is putting a dummy TEST or XOR ahead of the BT to break the false flags dependency, as well.</div><div class=""><br class=""></div><div class="">If the mask were constant, I expect ICC would generate TEST instead (but I don’t have it handy to check).</div><div class=""><br class=""></div><div class="">– Steve</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 23, 2015, at 11:32 AM, Sanjay Patel <<a href="mailto:spatel@rotateright.com" class="">spatel@rotateright.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">If 'bt' is a perf sin, icc doesn't seem to know it:<br class=""><br class="">$ icc -v <br class="">icc version 15.0.1 (gcc version 4.9.0 compatibility)<br class=""><br class="">$ cat bt.c<br class="">unsigned long long IsBitSetB_64(unsigned long long val, int index) { return (val & (1ULL<<index)) != 0ULL; } <br class="">unsigned int IsBitSetB_32(unsigned int val, int index) { return (val & (1U<<index)) != 0U; } <br class=""><br class="">$ icc -O3 -S bt.c -o - | grep bt<br class="">    .file "bt.c"<br class="">        btq       %rsi, %rdi<br class="">        btl       %esi, %edi<br class=""><br class=""></div>Does anyone at Intel have guidance for us?<br class=""><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jan 22, 2015 at 4:34 PM, Eric Christopher <span dir="ltr" class=""><<a href="mailto:echristo@gmail.com" target="_blank" class="">echristo@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class=""><br class=""><div class="gmail_quote"><div class=""><div class="h5">On Thu Jan 22 2015 at 3:32:53 PM Chris Sears <<a href="mailto:chris.sears@gmail.com" target="_blank" class="">chris.sears@gmail.com</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_extra">The status quo is:</div><div class="gmail_extra"><br class=""></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px" class=""><div class="gmail_extra">a) 40b REX+BT instruction for the 64b case</div><div class="gmail_extra">b) 48b TEST for the 32b case</div><div class="gmail_extra">c) unless it's small TEST</div></blockquote><br class=""><div class="">You are currently paying a 16b penalty for TEST vs BT in the 32b case.</div><div class="">That may be worth testing the -Os flag.</div></div></blockquote><div class=""><br class=""></div></div></div><div class="">You'll want -Oz here, Os isn't supposed to affect the runtime as much as this is going to.</div><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class="">-eric </div></font></span></div>
<br class="">_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" target="_blank" class="">http://llvm.cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:LLVMdev@cs.uiuc.edu" class="">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" class="">http://llvm.cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br class=""></div></blockquote></div><br class=""></body></html>