[Speex-dev] Cannot compile speexdsp 1.2rc3 on ARM64

Frank Barchard fbarchard at google.com
Tue Apr 19 23:32:56 UTC 2016

Hi I'm new to speex list but joined because I'm needing to port the Neon to
On that function, saturate_32bit_to_16bit(), I noticed the ifdef's are
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;
static inline int32_t saturate_32bit_to_16bit(int32_t a) {
return max(-32768, min(32767, a));

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 <firstfan at gmail.com> 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
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xiph.org/pipermail/speex-dev/attachments/20160419/95370331/attachment.html>

More information about the Speex-dev mailing list