<div dir="ltr">Hi I'm new to speex list but joined because I'm needing to port the Neon to ARM64.<div>On that function, saturate_32bit_to_16bit(), I noticed the ifdef's are wrong.</div><div>The first version is for normal arm 32 bit arm and should be used for arm32 and thumb2 but not thumb1.</div><div>The second version is 32 bit neon and should be #ifdef __ARM_NEON__</div><div>I've done a third version which is 64 bit neon. I'm working off an android version which is rc2 so I'll need to integrate, but here it is:</div><div><br></div><div><div>#if defined(__aarch64__)</div><div>static inline int32_t saturate_32bit_to_16bit(int32_t a) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>int32_t ret;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>asm volatile ("sqxtn h0, %s[a]\n"</div><div><!--
--><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> "sxtl v0.4s, v0.4h\n"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> "fmov %w[ret], s0\n"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> : [ret] "=&r" (ret)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> : [a] "w" (a)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> : "v0" );</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>return ret;</div><div>}</div><div>#elif defined(__ARM_NEON__)</div><div>static inline int32_t saturate_32bit_to_16bit(int32_t a) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>int32_t ret;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span><!--
-->asm volatile ("vmov.s32 d24[0], %[a]\n"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> "vqmovn.s32 d24, q12\n"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> "vmov.s16 %[ret], d24[0]\n"</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> : [ret] "=&r" (ret)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> : [a] "r" (a)</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span> : "q12", "d24", "d25" );</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>return ret;</div><div>}</div><div>#else</div><div>static inline int32_t saturate_32bit_to_16bit(int32_t a) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>return max<!--
-->(-32768, min(32767, a));</div><div>}</div><div>#endif</div></div><div><br></div><div>To test it I wrote a stand alone test and ran it via adb.</div><div>Anyone able to help with review/integration?</div><div>There are 4 functions in resample_neon.h thats just the first/easiest.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 28, 2015 at 11:28 AM, Evan JIANG <span dir="ltr"><<a href="mailto:firstfan@gmail.com" target="_blank">firstfan@gmail.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"><div><div><div><div><div><div>Hi all,<br></div> I build successfully with speex-1.2rc2. And with speexdsp 1.2rc3, I build with i386, X86_64, armv7 and armv7s all passed.<br></div> But when I build for ARM64 (for iPhone 6), it failed with:<br>/Applications/Xcode.app/<wbr>Contents/<!--
-->Developer/usr/bin/<wbr>make all-recursive<br>Making all in libspeexdsp<br> CC preprocess.lo<br> CC jitter.lo<br> CC mdf.lo<br> CC fftwrap.lo<br> CC filterbank.lo<br> CC resample.lo<br>In file included from resample.c:104:<br>./resample_neon.h:134:12: error: unknown register name 'q0' in asm<br> : "q0");<br> ^<br>./resample_neon.h:195:13: error: invalid output constraint '+l' in asm<br> [len] "+l" (len), [remainder] "+l" (remainder)<br> ^<br>2 errors generated.<br>make[2]: *** [resample.lo] Error 1<br>make[1]: *** [all-recursive] Error 1<br>make: *** [all] Error 2<br><br><br></div>As I googled out, I found it's said:<br><br><pre>arm64 has a totally different instruction set.
See: <a href="http://people.linaro.org/%7Erikuvoipio/aarch64-talk/" rel="nofollow" target="_blank">http://people.linaro.org/~<wbr>rikuvoipio/aarch64-talk/</a>
The NEON assembly code needs a rewrite.</pre><br><br></div>But I'm not familiar with ASM code. Could anyone help to fix that?<br><br></div>Best regards,<br></div>Evan JIANG<br></div>
<br>______________________________<wbr>_________________<br>
Speex-dev mailing list<br>
<a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><br>
<a href="http://lists.xiph.org/mailman/listinfo/speex-dev" rel="noreferrer" target="_blank">http://lists.xiph.org/mailman/<wbr>listinfo/speex-dev</a><br>
<br></blockquote></div><br></div>