<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 16, 2010, at 10:33 AM, Alexandre Colucci wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>gcc 4.2 supports a bunch of X86 built-in functions (for example SSE vector instructions) that appear to not be known by clang:</div><div><a href="http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/X86-Built_002din-Functions.html">http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/X86-Built_002din-Functions.html</a></div><div><br></div><div>Is it a known incompatibility with gcc? Is there a plan to implement these built-in functions in clang? Or clang has some built-in replacements? Or did I simply miss something?</div><div>Here is a sample code that does not build with clang on 10.6 but compile with gcc 4.2:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(117, 73, 44); ">#include <span style="color: #cb2722"><stdio.h></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span style="color: #b718a2">int</span> main (<span style="color: #b718a2">int</span> argc, <span style="color: #b718a2">const</span> <span style="color: #b718a2">char</span> * argv[])</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">{</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "> <span style="color: #b718a2">typedef</span> <span style="color: #b718a2">short</span> _SSE_VecS16 <span style="color: #b718a2">__attribute__</span> ((__vector_size__ (<span style="color: #3b06d7">16</span>)));</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "> <br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "> <span style="color: #b718a2">register</span> _SSE_VecS16 b;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "> <span style="color: #b718a2">register</span> _SSE_VecS16 c;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "> __builtin_ia32_paddw128(b, c);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "> <br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "> <span style="color: #b718a2">return</span> <span style="color: #3b06d7">0</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">}</div></div></div></blockquote></div><br><div>IIRC, Clang intentionally doesn't have any built-ins for operations which are naturally modeled by operators. Either use the official SSE intrinsics, or use operators. Each built-in has a maintenance overhead, and such redundant ones aren't worth it, when b + c (or b += c?) does the same thing.</div><div><br></div><div>Sebastian</div></body></html>