Re: Cannot compile speexdsp 1.2rc3 on ARM64
Frank Barchard <[email protected]> Tue, 19 Apr 2016 16:32:56 -0700
| Newsgroups | gmane.comp.audio.compression.speex.devel |
|---|---|
| Message-ID | <CADdf1xWMBKuh0FKrhTqGNxqGRt_5mC6Mf4C8=U8WtCCpr0Dusw@mail.gmail.com> |
--===============0799413932389870731==
Content-Type: multipart/alternative; boundary=089e01228a44a158d30530dee502
--089e01228a44a158d30530dee502
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
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 arm=
32
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] "=3D&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] "=3D&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
>
>
--089e01228a44a158d30530dee502
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"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_t=
o_16bit(),=C2=A0I 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 thu=
mb2 but not thumb1.</div><div>The second version is 32 bit neon and shoul=
d be #ifdef __ARM_NEON__</div><div>I've done a third version which is=
64 bit neon. =C2=A0 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_32b=
it_to_16bit(int32_t a) {</div><div><span class=3D"gmail-Apple-tab-span" s=
tyle=3D"white-space:pre"> </span>int32_t ret;</div><div><span class=3D"gm=
ail-Apple-tab-span" style=3D"white-space:pre"> </span>asm volatile ("=
;sqxtn h0, %s[a]\n"</div><div><!--
--><span class=3D"gmail-Apple-tab-span" style=3D"white-space:pre"> </spa=
n> =C2=A0 =C2=A0 =C2=A0"sxtl =C2=A0v0.4s, v0.4h\n"</div><div><s=
pan class=3D"gmail-Apple-tab-span" style=3D"white-space:pre"> </span> =C2=
=A0 =C2=A0 =C2=A0"fmov %w[ret], s0\n"</div><div><span class=3D"=
gmail-Apple-tab-span" style=3D"white-space:pre"> </span> =C2=A0 =C2=A0 =C2=
=A0: [ret] "=3D&r" (ret)</div><div><span class=3D"gmail-App=
le-tab-span" style=3D"white-space:pre"> </span> =C2=A0 =C2=A0 =C2=A0: [a=
] "w" (a)</div><div><span class=3D"gmail-Apple-tab-span" style=3D=
"white-space:pre"> </span> =C2=A0 =C2=A0 =C2=A0: "v0" );</div>=
<div><span class=3D"gmail-Apple-tab-span" style=3D"white-space:pre"> </sp=
an>return ret;</div><div>}</div><div>#elif defined(__ARM_NEON__)</div><di=
v>static inline int32_t saturate_32bit_to_16bit(int32_t a) {</div><div><s=
pan class=3D"gmail-Apple-tab-span" style=3D"white-space:pre"> </span>int3=
2_t ret;</div><div><span class=3D"gmail-Apple-tab-span" style=3D"white-sp=
ace:pre"> </span><!--
-->asm volatile ("vmov.s32 d24[0], %[a]\n"</div><div><span clas=
s=3D"gmail-Apple-tab-span" style=3D"white-space:pre"> </span> =C2=A0 =C2=
=A0 =C2=A0"vqmovn.s32 d24, q12\n"</div><div><span class=3D"gmai=
l-Apple-tab-span" style=3D"white-space:pre"> </span> =C2=A0 =C2=A0 =C2=A0=
"vmov.s16 %[ret], d24[0]\n"</div><div><span class=3D"gmail-Appl=
e-tab-span" style=3D"white-space:pre"> </span> =C2=A0 =C2=A0 =C2=A0: [re=
t] "=3D&r" (ret)</div><div><span class=3D"gmail-Apple-tab-s=
pan" style=3D"white-space:pre"> </span> =C2=A0 =C2=A0 =C2=A0: [a] "=
r" (a)</div><div><span class=3D"gmail-Apple-tab-span" style=3D"white=
-space:pre"> </span> =C2=A0 =C2=A0 =C2=A0: "q12", "d24&qu=
ot;, "d25" );</div><div><span class=3D"gmail-Apple-tab-span" st=
yle=3D"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=3D"gmail-Apple-tab-span" style=3D"white-space:pre"> </sp=
an>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 ar=
e 4 functions in resample_neon.h thats just the first/easiest.</div><div>=
<br></div><div><br></div></div><div class=3D"gmail_extra"><br><div class=3D=
"gmail_quote">On Sat, Mar 28, 2015 at 11:28 AM, Evan JIANG <span dir=3D"l=
tr"><<a href=3D"mailto:[email protected]" target=3D"_blank">firstfan@=
gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr"><div><div><div><div><div><div>Hi all,<br></div>=C2=A0=C2=A0=C2=
=A0 I build successfully with speex-1.2rc2. And with speexdsp 1.2rc3, I b=
uild with i386, X86_64, armv7 and armv7s all passed.<br></div>=C2=A0=C2=A0=
But when I build for ARM64 (for iPhone 6), it failed with:<br>/Applicati=
ons/Xcode.app/<wbr>Contents/<!--
-->Developer/usr/bin/<wbr>make=C2=A0 all-recursive<br>Making all in libsp=
eexdsp<br>=C2=A0 CC=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 preprocess.lo<br>=
=C2=A0 CC=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 jitter.lo<br>=C2=A0 CC=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mdf.lo<br>=C2=A0 CC=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 fftwrap.lo<br>=C2=A0 CC=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
filterbank.lo<br>=C2=A0 CC=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 resample.l=
o<br>In file included from resample.c:104:<br>./resample_neon.h:134:12: e=
rror: unknown register name 'q0' in asm<br>=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 : "q0");<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^<br>./resample_neon.h:195:13: error: i=
nvalid output constraint '+l' in asm<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 [len] "+l" (len), [remainder] "+l" (rema=
inder)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 ^<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=3D"http://people.linaro.org/%7Erikuvoipio/aarch64-talk/" rel=
=3D"nofollow" target=3D"_blank">http://people.linaro.org/~<wbr>rikuvoipio=
/aarch64-talk/</a>
The NEON assembly code needs a rewrite.</pre><br><br></div>But I'm no=
t familiar with ASM code. Could anyone help to fix that?<br><br></div>Bes=
t regards,<br></div>Evan JIANG<br></div>
<br>______________________________<wbr>_________________<br>
Speex-dev mailing list<br>
<a href=3D"mailto:[email protected]">[email protected]</a><br>
<a href=3D"http://lists.xiph.org/mailman/listinfo/speex-dev" rel=3D"noref=
errer" target=3D"_blank">http://lists.xiph.org/mailman/<wbr>listinfo/spee=
x-dev</a><br>
<br></blockquote></div><br></div>
--089e01228a44a158d30530dee502--
--===============0799413932389870731==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KU3BlZXgtZGV2
IG1haWxpbmcgbGlzdApTcGVleC1kZXZAeGlwaC5vcmcKaHR0cDovL2xpc3RzLnhpcGgub3JnL21h
aWxtYW4vbGlzdGluZm8vc3BlZXgtZGV2Cg==
--===============0799413932389870731==--