diff options
author | kma@webrtc.org <kma@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-03-01 23:01:14 +0000 |
---|---|---|
committer | kma@webrtc.org <kma@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-03-01 23:01:14 +0000 |
commit | ea67fe04e215ca35f8435d3e0041c64dd705799a (patch) | |
tree | 1e78ddd5037e3f8d35596b289880b9d604d49c1b /common_audio/signal_processing/complex_fft.c | |
parent | b563e5e8b34fd7f0c6c02fa4176e9be83c2bf795 (diff) | |
download | webrtc-ea67fe04e215ca35f8435d3e0041c64dd705799a.tar.gz |
Refactored inline assembly code in complex_fft.c, by combining the individual __asm lines into a single block, to avoid potential register usage problems when building with different tools.
Review URL: https://webrtc-codereview.appspot.com/1153004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@3592 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'common_audio/signal_processing/complex_fft.c')
-rw-r--r-- | common_audio/signal_processing/complex_fft.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/common_audio/signal_processing/complex_fft.c b/common_audio/signal_processing/complex_fft.c index 3f06ab33..947ceb89 100644 --- a/common_audio/signal_processing/complex_fft.c +++ b/common_audio/signal_processing/complex_fft.c @@ -234,9 +234,9 @@ int WebRtcSpl_ComplexFFT(WebRtc_Word16 frfi[], int stages, int mode) wi = -kSinTable1024[j]; #ifdef WEBRTC_ARCH_ARM_V7 - WebRtc_Word32 wri; - WebRtc_Word32 frfi_r; - __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) : + WebRtc_Word32 wri = 0; + WebRtc_Word32 frfi_r = 0; + __asm __volatile("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) : "r"((WebRtc_Word32)wr), "r"((WebRtc_Word32)wi)); #endif @@ -245,12 +245,18 @@ int WebRtcSpl_ComplexFFT(WebRtc_Word16 frfi[], int stages, int mode) j = i + l; #ifdef WEBRTC_ARCH_ARM_V7 - __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) : - "r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1])); - __asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) : - "r"(wri), "r"(frfi_r), "r"(CFFTRND)); - __asm__("smladx %0, %1, %2, %3" : "=r"(ti32) : - "r"(wri), "r"(frfi_r), "r"(CFFTRND)); + __asm __volatile( + "pkhbt %[frfi_r], %[frfi_even], %[frfi_odd], lsl #16\n\t" + "smlsd %[tr32], %[wri], %[frfi_r], %[cfftrnd]\n\t" + "smladx %[ti32], %[wri], %[frfi_r], %[cfftrnd]\n\t" + :[frfi_r]"+r"(frfi_r), + [tr32]"=r"(tr32), + [ti32]"=r"(ti32) + :[frfi_even]"r"((WebRtc_Word32)frfi[2*j]), + [frfi_odd]"r"((WebRtc_Word32)frfi[2*j +1]), + [wri]"r"(wri), + [cfftrnd]"r"(CFFTRND) + ); #else tr32 = WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j]) @@ -375,9 +381,9 @@ int WebRtcSpl_ComplexIFFT(WebRtc_Word16 frfi[], int stages, int mode) wi = kSinTable1024[j]; #ifdef WEBRTC_ARCH_ARM_V7 - WebRtc_Word32 wri; - WebRtc_Word32 frfi_r; - __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) : + WebRtc_Word32 wri = 0; + WebRtc_Word32 frfi_r = 0; + __asm __volatile("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) : "r"((WebRtc_Word32)wr), "r"((WebRtc_Word32)wi)); #endif @@ -386,12 +392,18 @@ int WebRtcSpl_ComplexIFFT(WebRtc_Word16 frfi[], int stages, int mode) j = i + l; #ifdef WEBRTC_ARCH_ARM_V7 - __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) : - "r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1])); - __asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) : - "r"(wri), "r"(frfi_r), "r"(CIFFTRND)); - __asm__("smladx %0, %1, %2, %3" : "=r"(ti32) : - "r"(wri), "r"(frfi_r), "r"(CIFFTRND)); + __asm __volatile( + "pkhbt %[frfi_r], %[frfi_even], %[frfi_odd], lsl #16\n\t" + "smlsd %[tr32], %[wri], %[frfi_r], %[cifftrnd]\n\t" + "smladx %[ti32], %[wri], %[frfi_r], %[cifftrnd]\n\t" + :[frfi_r]"+r"(frfi_r), + [tr32]"=r"(tr32), + [ti32]"=r"(ti32) + :[frfi_even]"r"((WebRtc_Word32)frfi[2*j]), + [frfi_odd]"r"((WebRtc_Word32)frfi[2*j +1]), + [wri]"r"(wri), + [cifftrnd]"r"(CIFFTRND) + ); #else tr32 = WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j]) |