title: How to enable intrinsics in compiler?
body: <p>Who can explain: how to enable intrinsics in c code?</p>
  
  <p>I would like to use <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cihidceh.html" rel="nofollow">special dsp instructions</a> in armv5TE</p>
  
  <p>Consider <code>qadd</code> instruction, it nicely works when i use assembler approach, like this: </p>
  
  <pre><code>inline int function_qadd(int a, int b) {
      __asm__ (
              "qadd %0, %1, %2" : "=r" (a) : "r" (a), "r" (b));
      return a;
  }
  </code></pre>
  
  <p>But when i tried to use <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/CJACGAFH.html" rel="nofollow">__qadd intrinsic</a> instead of asm like this:</p>
  
  <pre><code>int add_result = __qadd(5,10);
  LOGI("qadd='%d'", add_result);
  </code></pre>
  
  <p>i got error: </p>
  
  <blockquote>
    <p>error: undefined reference to '__qadd'</p>
  </blockquote>
  
  <p><strong>What i am doing wrong, how to enable intrinsics in c code?</strong></p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I have ndk <code>android-ndk-r8c</code> (windows version), it <a href="http://developer.android.com/tools/sdk/ndk/index.html" rel="nofollow">have GCC 4.6 as default</a>:</p>
  
  <blockquote>
    <p>The GCC 4.6 compiler is still the default,</p>
  </blockquote>
  
  <p>Besides i explicitly specify in android.mk</p>
  
  <pre><code>NDK_TOOLCHAIN_VERSION=4.6
  </code></pre>
  
  <p>My compiler flags is:</p>
  
  <pre><code>LOCAL_CFLAGS += -std=c99 -ffast-math -march=armv5te -mfpu=vfp -mfloat-abi=softfp 
  </code></pre>
  
  <p>Besides i check the asm code generated by gcc throught -S compiler flag, it generate qadd instruction:</p>
  
  <pre><code>qadd r3, r3, r2
  </code></pre>