Re: Cannot compile speexdsp 1.2rc3 on ARM64
Frank Barchard <[email protected]> Mon, 8 Aug 2016 17:29:52 -0700
| Newsgroups | gmane.comp.audio.compression.speex.devel |
|---|---|
| Message-ID | <CADdf1xUq2YecuCjHJHYRDu3HPcU5JBcDxWEzz9mk+sACQi66HA@mail.gmail.com> |
--===============8679032012170113606== Content-Type: multipart/alternative; boundary=001a113d4044a52906053998a120 --001a113d4044a52906053998a120 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit anyone know how to get the aarch64 fork pulled into the mainline speexdsp? The code is provided in the bug report https://github.com/xiph/ speexdsp/issues/7 On Fri, Jul 29, 2016 at 5:21 PM, Frank Barchard <[email protected]> wrote: > I've filed a bug for aarch64 > https://github.com/xiph/speexdsp/issues/7 > > and provided the port in a fork with a pull request. We need someone to > review/merge in the pull request? > It provides the source code, but my testing was under Android builds, so > there would be some configure changes needed to build it stand alone. > > On Tue, Apr 19, 2016 at 4:32 PM, Frank Barchard <[email protected]> > wrote: > >> Hi I'm new to speex list but joined because I'm needing to port the Neon >> to ARM64. >> On that function, saturate_32bit_to_16bit(), I noticed the ifdef's are >> wrong. >> The first version is for normal arm 32 bit arm and should be used for >> arm32 and thumb2 but not thumb1. >> The second version is 32 bit neon and should be #ifdef __ARM_NEON__ >> 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: >> >> #if defined(__aarch64__) >> static inline int32_t saturate_32bit_to_16bit(int32_t a) { >> int32_t ret; >> asm volatile ("sqxtn h0, %s[a]\n" >> "sxtl v0.4s, v0.4h\n" >> "fmov %w[ret], s0\n" >> : [ret] "=&r" (ret) >> : [a] "w" (a) >> : "v0" ); >> return ret; >> } >> #elif defined(__ARM_NEON__) >> static inline int32_t saturate_32bit_to_16bit(int32_t a) { >> int32_t ret; >> asm volatile ("vmov.s32 d24[0], %[a]\n" >> "vqmovn.s32 d24, q12\n" >> "vmov.s16 %[ret], d24[0]\n" >> : [ret] "=&r" (ret) >> : [a] "r" (a) >> : "q12", "d24", "d25" ); >> return ret; >> } >> #else >> static inline int32_t saturate_32bit_to_16bit(int32_t a) { >> return max(-32768, min(32767, a)); >> } >> #endif >> >> To test it I wrote a stand alone test and ran it via adb. >> Anyone able to help with review/integration? >> There are 4 functions in resample_neon.h thats just the first/easiest. >> >> >> >> On Sat, Mar 28, 2015 at 11:28 AM, Evan JIANG <[email protected]> wrote: >> >>> Hi all, >>> I build successfully with speex-1.2rc2. And with speexdsp 1.2rc3, I >>> build with i386, X86_64, armv7 and armv7s all passed. >>> But when I build for ARM64 (for iPhone 6), it failed with: >>> /Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive >>> Making all in libspeexdsp >>> CC preprocess.lo >>> CC jitter.lo >>> CC mdf.lo >>> CC fftwrap.lo >>> CC filterbank.lo >>> CC resample.lo >>> In file included from resample.c:104: >>> ./resample_neon.h:134:12: error: unknown register name 'q0' in asm >>> : "q0"); >>> ^ >>> ./resample_neon.h:195:13: error: invalid output constraint '+l' in asm >>> [len] "+l" (len), [remainder] "+l" (remainder) >>> ^ >>> 2 errors generated. >>> make[2]: *** [resample.lo] Error 1 >>> make[1]: *** [all-recursive] Error 1 >>> make: *** [all] Error 2 >>> >>> >>> As I googled out, I found it's said: >>> >>> arm64 has a totally different instruction set. >>> >>> See: http://people.linaro.org/~rikuvoipio/aarch64-talk/ >>> >>> The NEON assembly code needs a rewrite. >>> >>> >>> >>> But I'm not familiar with ASM code. Could anyone help to fix that? >>> >>> Best regards, >>> Evan JIANG >>> >>> _______________________________________________ >>> Speex-dev mailing list >>> [email protected] >>> http://lists.xiph.org/mailman/listinfo/speex-dev >>> >>> >> > --001a113d4044a52906053998a120 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit <div dir="ltr">anyone know how to get the aarch64 fork pulled into the mainline speexdsp?<div>The code is provided in the bug report <a href="https://github.com/xiph/speexdsp/issues/7" target="_blank" style="font-size:12.8px">https://github.com/xiph/<wbr>speexdsp/issues/7</a></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 29, 2016 at 5:21 PM, Frank Barchard <span dir="ltr"><<a href="mailto:[email protected]" target="_blank">[email protected]</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">I've filed a bug for aarch64<div><a href="https://github.com/xiph/speexdsp/issues/7" target="_blank">https://github.com/xiph/<wbr>speexdsp/issues/7</a><b r></div><div><br></div><div>and provided the port in a fork with a pull request. We need someone to review/merge in the pull request?</div><div><!-- -->It provides the source code, but my testing was under Android builds, so there would be some configure changes needed to build it stand alone.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 19, 2016 at 4:32 PM, Frank Barchard <span dir="ltr"><<a href="mailto:[email protected]" target="_blank">[email protected]</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">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_<wbr>t a) {</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>int32_t ret;</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>asm volatile ("sqxtn h0, %s[a]\n"</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>    "sxtl  v0.4s, v0.4h\n"</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-A pple-tab-span" style="white-space:pre-wrap"> </span>    "fmov %w[ret], s0\n"</div><div><!-- --><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>    : [ret] "=&r" (ret)</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>    : [a] "w" (a)</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>    : "v0" );</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>return ret;</div><div>}</div><div>#elif defined(__ARM_NEON__)</div><div>static inline int32_t saturate_32bit_to_16bit(int32_<wbr>t a) {</div><div><span class="m_1887038434184733674m_-3490218015663917 727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>int32_t ret;</div><div><!-- --><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>asm volatile ("vmov.s32 d24[0], %[a]\n"</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>    "vqmovn.s32 d24, q12\n"</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>    "vmov.s16 %[ret], d24[0]\n"</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>    : [ret] "=&r" (ret)</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </ span>    : [a] "r" (a)</div><div><!-- --><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>    : "q12", "d24", "d25" );</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </span>return ret;</div><div>}</div><div>#else</div><div>static inline int32_t saturate_32bit_to_16bit(int32_<wbr>t a) {</div><div><span class="m_1887038434184733674m_-3490218015663917727gmail-Apple-tab-span" style="white-space:pre-wrap"> </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_n eon.h thats just the first/easiest.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><!-- --><div class="m_1887038434184733674h5">On Sat, Mar 28, 2015 at 11:28 AM, Evan JIANG <span dir="ltr"><<a href="mailto:[email protected]" target="_blank">[email protected]</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_1887038434184733674h5"><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/Conten<wbr>ts/Developer/usr/bin/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/~riku<wbr>voipio/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></div></div>______________________________<wbr>_________________<br> Speex-dev mailing list<br> <a href="mailto:[email protected]" target="_blank">[email protected]</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> </blockquote></div><br></div> </div></div></blockquote></div><br></div> --001a113d4044a52906053998a120-- --===============8679032012170113606== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KU3BlZXgtZGV2 IG1haWxpbmcgbGlzdApTcGVleC1kZXZAeGlwaC5vcmcKaHR0cDovL2xpc3RzLnhpcGgub3JnL21h aWxtYW4vbGlzdGluZm8vc3BlZXgtZGV2Cg== --===============8679032012170113606==--