diff options
author | Vicente Olivert Riera <Vincent.Riera@imgtec.com> | 2015-09-21 11:59:02 +0100 |
---|---|---|
committer | Vicente Olivert Riera <Vincent.Riera@imgtec.com> | 2015-09-21 11:59:02 +0100 |
commit | 047376af8c47d45c78204112a7d1b873c93822bc (patch) | |
tree | 3f0b8e6070d8de9d40fb8cbaad1c08da358a496d /libFDK | |
parent | 2585f10da2c20ad639948d1af113f2cd591dd946 (diff) | |
download | fdk-aac-047376af8c47d45c78204112a7d1b873c93822bc.tar.gz fdk-aac-047376af8c47d45c78204112a7d1b873c93822bc.tar.bz2 fdk-aac-047376af8c47d45c78204112a7d1b873c93822bc.zip |
libFDK/include/mips/cplx_mul.h: use C code instead of ASM
Replace the assembler code by the equivalent in C. This way it will work
for every MIPS ISA. Now the check for __mips_isa_rev < 6 is no longer
necessary, so remove it.
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Diffstat (limited to 'libFDK')
-rw-r--r-- | libFDK/include/mips/cplx_mul.h | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/libFDK/include/mips/cplx_mul.h b/libFDK/include/mips/cplx_mul.h index c933911..e921d21 100644 --- a/libFDK/include/mips/cplx_mul.h +++ b/libFDK/include/mips/cplx_mul.h @@ -89,7 +89,7 @@ amm-info@iis.fraunhofer.de ******************************************************************************/ -#if defined(__GNUC__) && defined(__mips_isa_rev) && __mips_isa_rev < 6 +#if defined(__GNUC__) && defined(__mips__) //#define FUNCTION_cplxMultDiv2_32x16 @@ -107,24 +107,8 @@ inline void cplxMultDiv2( FIXP_DBL *c_Re, FIXP_DBL b_Re, FIXP_DBL b_Im) { - INT result; - - __asm__ ("mult %[a_Re], %[b_Re];\n" - "msub %[a_Im], %[b_Im];\n" - "mfhi %[result];\n" - : [result]"=r"(result) - : [a_Re]"d"(a_Re), [b_Re]"d"(b_Re), [a_Im]"d"(a_Im), [b_Im]"d"(b_Im) - : "lo"); - - *c_Re = result; - - __asm__ ("mult %[a_Re], %[b_Im];\n" - "madd %[a_Im], %[b_Re];\n" - "mfhi %[result];\n" - : [result]"=r"(result) - : [a_Re]"r"(a_Re), [b_Im]"r"(b_Im), [a_Im]"r"(a_Im), [b_Re]"r"(b_Re) - : "lo"); - *c_Im = result; + *c_Re = (((long long)a_Re * (long long)b_Re) - ((long long)a_Im * (long long)b_Im))>>32; + *c_Im = (((long long)a_Re * (long long)b_Im) + ((long long)a_Im * (long long)b_Re))>>32; } #endif @@ -136,25 +120,8 @@ inline void cplxMult( FIXP_DBL *c_Re, FIXP_DBL b_Re, FIXP_DBL b_Im) { - INT result; - - __asm__ ("mult %[a_Re], %[b_Re];\n" - "msub %[a_Im], %[b_Im];\n" - "mfhi %[result];\n" - //"extr_w %[result], 31;\n" - : [result]"=r"(result) - : [a_Re]"r"(a_Re), [b_Re]"r"(b_Re), [a_Im]"r"(a_Im), [b_Im]"r"(b_Im) - : "lo"); - *c_Re = result<<1; - - __asm__ ("mult %[a_Re], %[b_Im];\n" - "madd %[a_Im], %[b_Re];\n" - "mfhi %[result];\n" - //"extr_w %[result], 31;\n" - : [result]"=r"(result) - : [a_Re]"r"(a_Re), [b_Im]"r"(b_Im), [a_Im]"r"(a_Im), [b_Re]"r"(b_Re) - : "lo"); - *c_Im = result<<1; + *c_Re = ((((long long)a_Re * (long long)b_Re) - ((long long)a_Im * (long long)b_Im))>>32)<<1; + *c_Im = ((((long long)a_Re * (long long)b_Im) + ((long long)a_Im * (long long)b_Re))>>32)<<1; } #endif |