diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-16 18:17:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-16 18:17:55 +0000 |
commit | a02d183357424b007eb93170acf9577a4f1a34e1 (patch) | |
tree | 2bfb534d87cb0afa4f642e1131760b31e2e60d4e /www/compatibility.html | |
parent | ce78461303f45fecb3460d1c49c9b71f27ad19c3 (diff) | |
download | clang-a02d183357424b007eb93170acf9577a4f1a34e1.tar.gz |
add a compatibility note about vector builtins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'www/compatibility.html')
-rw-r--r-- | www/compatibility.html | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/www/compatibility.html b/www/compatibility.html index bc34a863f5..4196e880ec 100644 --- a/www/compatibility.html +++ b/www/compatibility.html @@ -32,6 +32,7 @@ <li><a href="#c">C compatibility</a> <ul> <li><a href="#inline">C99 inline functions</a></li> + <li><a href="#vector_builtins">"missing" vector __builtin functions</a></li> <li><a href="#lvalue-cast">Lvalue casts</a></li> <li><a href="#blocks-in-protected-scope">Jumps to within <tt>__block</tt> variable scope</a></li> </ul> @@ -114,6 +115,32 @@ Undefined symbols: be changed.</li> </ul> + +<!-- ======================================================================= --> +<h3 id="vector_builtins">"missing" vector __builtin functions</h3> +<!-- ======================================================================= --> + +<p>The Intel and AMD manuals document a number "<tt><*mmintrin.h></tt>" +header files, which define a standardized API for accessing vector operations +on X86 CPUs. These functions have names like <tt>_mm_xor_ps</tt> and +<tt>_mm256_addsub_pd</tt>. Compilers have leeway to implement these functions +however they want. Since Clang supports an excellent set of <a +href="../docs/LanguageExtensions.html#vectors">native vector operations</a>, +the Clang headers implement these interfaces in terms of the native vector +operations. +</p> + +<p>In contrast, GCC implements these functions mostly as a 1-to-1 mapping to +builtin function calls, like <tt>__builtin_ia32_paddw128</tt>. These builtin +functions are an internal implementation detail of GCC, and are not portable to +the Intel compiler, the Microsoft compiler, or Clang. If you get build errors +mentioning these, the fix is simple: switch to the *mmintrin.h functions.</p> + +<p>The same issue occurs for NEON and Altivec for the ARM and PowerPC +architectures respectively. For these, make sure to use the <arm_neon.h> +and <altivec.h> headers.</p> + + <!-- ======================================================================= --> <h3 id="lvalue-cast">Lvalue casts</h3> <!-- ======================================================================= --> |