<div dir="ltr">That was not intentional at all. I foolishly thought that sending everything about 15 to the true leg of this ternary operator would prevent needing a mask on each of the immediate uses in the shufflevector. I'll fix it right away. AVX2 and AVX512 are similarly broken.<div><br></div><div><div> ((char)(imm)&0xF0) ? _mm_setzero_si128() : \</div><div> (__m128i)__builtin_shufflevector( \</div><div> (__v16qi)_mm_setzero_si128(), \</div><div> (__v16qi)(__m128i)(a), \</div><div> 16 - (char)(imm), \</div><div> 17 - (char)(imm), \</div><div> 18 - (char)(imm), \</div><div> 19 - (char)(imm), \</div><div> 20 - (char)(imm), \</div><div> 21 - (char)(imm), \</div><div> 22 - (char)(imm), \</div><div> 23 - (char)(imm), \</div><div> 24 - (char)(imm), \</div><div> 25 - (char)(imm), \</div><div> 26 - (char)(imm), \</div><div> 27 - (char)(imm), \</div><div> 28 - (char)(imm), \</div><div> 29 - (char)(imm), \</div><div> 30 - (char)(imm), \</div><div> 31 - (char)(imm)); })</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 24, 2016 at 6:10 PM, Brooks Moses <span dir="ltr"><<a href="mailto:bmoses@google.com" target="_blank">bmoses@google.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">Craig et al -<div><br></div><div>We recently ran into a code bug that was revealed by the way that r272246 ("[X86] Handle AVX2 pslldqi and psrldqi intrinsics shufflevector creation directly in the header file instead of in CGBuiltin.cpp. Simplify the sse2 equivalents as well.") changed the behavior of the SSE2 _mm_slli_si128 and _mm_srli_si128 intrinsics.</div><div><br></div><div>Previously, these intrinsics worked correctly with all values of shift operands, and would produce a result of zero for any shift value outside of the [0-15] range.</div><div><br></div><div>With this change, any value of the shift operand outside of the range [0-16] -- note, that's 16, not 15 -- will cause a compilation error.</div><div><br></div><div>Now, I can see good arguments for why limiting the range to [0-16] would be a good idea; after all, it did reveal a code bug in our case. However, this behavior change wasn't mentioned in the change description, and I can also see good arguments for why one wouldn't want this limit -- so I figure it's a good idea to raise the question explicitly: Was this behavior change intentional? If not, is it nonetheless the desired behavior?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>- Brooks</div><div><br></div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div>
</div>