Home | History | Annotate | Download | only in libspeex
      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 
     12    - Redistributions of source code must retain the above copyright
     13    notice, this list of conditions and the following disclaimer.
     14 
     15    - Redistributions in binary form must reproduce the above copyright
     16    notice, this list of conditions and the following disclaimer in the
     17    documentation and/or other materials provided with the distribution.
     18 
     19    - Neither the name of the Xiph.org Foundation nor the names of its
     20    contributors may be used to endorse or promote products derived from
     21    this software without specific prior written permission.
     22 
     23    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     24    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     25    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     26    A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
     27    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     28    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     29    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     30    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     31    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     32    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     33    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     34 */
     35 
     36 #define OVERRIDE_SPEEX_MOVE
     37 void *speex_move (void *dest, void *src, int n)
     38 {
     39    __asm__ __volatile__
     40          (
     41          "L0 = 0;\n\t"
     42          "I0 = %0;\n\t"
     43          "R0 = [I0++];\n\t"
     44          "LOOP move%= LC0 = %2;\n\t"
     45          "LOOP_BEGIN move%=;\n\t"
     46             "[%1++] = R0 || R0 = [I0++];\n\t"
     47          "LOOP_END move%=;\n\t"
     48          "[%1++] = R0;\n\t"
     49    : "=a" (src), "=a" (dest)
     50    : "a" ((n>>2)-1), "0" (src), "1" (dest)
     51    : "R0", "I0", "L0", "memory"
     52          );
     53    return dest;
     54 }
     55