<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jan 4, 2014 at 3:14 PM, David Wiberg <span dir="ltr"><<a href="mailto:dwiberg@gmail.com" target="_blank">dwiberg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2014/1/4 Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>>:<br>
<div class="im">> Interesting.  Here's the libstdc++ code that uses __a:<br>
> <a href="http://gcc.gnu.org/onlinedocs/gcc-4.8.0/libstdc++/api/a01396_source.html#l00055" target="_blank">http://gcc.gnu.org/onlinedocs/gcc-4.8.0/libstdc++/api/a01396_source.html#l00055</a><br>
><br>
> Ted Kremenek added pragmas that silence warnings about this in October:<br>
> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?r1=192143&r2=192142&pathrev=192143" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?r1=192143&r2=192142&pathrev=192143</a><br>

><br>
> The only way I can think of to fix this with the type checking is to use a<br>
> helper like:<br>
><br>
> static inline always_inline,nodebug __m128i __check_type_m128i(__m128i __a)<br>
> { return __a; }<br>
> #define _mm_slli_si128(a, __sl2) \<br>
> (__m128i)__builtin_ia32_pslldqi128(__check_type_m128i(a), (count)*8)<br>
><br>
</div>Thanks for the suggestion. I tested it and it seems to work<br>
(check-clang and test-case in PR passes). There are quite a few macros<br>
in the lib\Header files which have potential for this kind of<br>
name-clash (>100). I think it's a good idea to fix them all but I<br>
would like some reassurance that this is the correct path before<br>
attempting this. Are there any more tests that I should perform? Where<br>
should these kind of helper functions be placed since they are needed<br>
in multiple intrinsic files?</blockquote><div><br></div><div>This approach has the downside that we're injecting a whole bunch of names into the global namespace, which is annoying.  We still have to hope the user doesn't shadow the function name.  It might be better to make the local variable name longer and more obscure.</div>
</div></div></div>