misc_bfin.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Copyright (C) 2005 Analog Devices */
  2. /**
  3. @file misc_bfin.h
  4. @author Jean-Marc Valin
  5. @brief Various compatibility routines for Speex (Blackfin version)
  6. */
  7. /*
  8. Redistribution and use in source and binary forms, with or without
  9. modification, are permitted provided that the following conditions
  10. are met:
  11. - Redistributions of source code must retain the above copyright
  12. notice, this list of conditions and the following disclaimer.
  13. - Redistributions in binary form must reproduce the above copyright
  14. notice, this list of conditions and the following disclaimer in the
  15. documentation and/or other materials provided with the distribution.
  16. - Neither the name of the Xiph.org Foundation nor the names of its
  17. contributors may be used to endorse or promote products derived from
  18. this software without specific prior written permission.
  19. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
  23. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  24. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  25. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  26. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  27. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  28. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. #include "bfin.h"
  32. #define OVERRIDE_SPEEX_MOVE
  33. void *speex_move (void *dest, void *src, int n)
  34. {
  35. __asm__ __volatile__
  36. (
  37. "L0 = 0;\n\t"
  38. "I0 = %0;\n\t"
  39. "R0 = [I0++];\n\t"
  40. "LOOP move%= LC0 = %2;\n\t"
  41. "LOOP_BEGIN move%=;\n\t"
  42. "[%1++] = R0 || R0 = [I0++];\n\t"
  43. "LOOP_END move%=;\n\t"
  44. "[%1++] = R0;\n\t"
  45. : "=a" (src), "=a" (dest)
  46. : "a" ((n>>2)-1), "0" (src), "1" (dest)
  47. : "R0", "I0", "L0", "memory" BFIN_HWLOOP0_REGS
  48. );
  49. return dest;
  50. }