This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Fast RTS C not inlining addsp_i() However, does inline mpysp_i()

Other Parts Discussed in Thread: CCSTUDIO

`A Riddle Wrapped in a Mystery Inside an Enigma'

Can you solve this mystery?

PROBLEM
addspy_i will *not* inline.
mpysp_i will inline.

CONFIGURATION
CCStudio 3.3
fastRTS_c62xc64x_1_42_Windows_Setup.exe
IDE 598.0.393
BIOS 5.41.10.36
CODEGEN v7.2


For a small test project mpysp_i() and addsp_i() inline successfully.
For our  application, mpysp_i() always inlines, but addsp_i() never inlines.
I know that inlining is only a "suggestion"
 to TI's clever compiler developers. The compiler is are never obliged to do  it.
 However, there appears no rhyme or reason why mpysp_i() inlines in this application and addsp_i() never does.
Removing application code down to a small test both  mpysp_i() and addsp_i()  inline just fine.
I have tried many, many, workarounds to no avail.
For example,
 Breaking up code into small files.
  Making new .h copy of addsp_i() with different names.
 Tinkering with all the compiler/assembler flags -g -Ox, ...
 Putting all the macros on one line, removing spaces, removing line coninuations, ...
 I removed most of the code and can get two addsp_i()'s to inline, but I have about 8 in this code.
 It just seems that the compiler just does not like to inline addsp_i() on this particular application.
 I have read the Wikis.
 I have searched E2E.
 I have searched the internet.
 I have review all manuals, Prog. Guide, Compiler, ....
 
My list of possible explanations is down to:
  compiler bug.
  compiler limit that is hard coded in the compiler. Some limit that addsp_i() reaches, but mpysp_i() does not.
What do you think?
 


  • Please take one source file where you would like addsp_i to inline, but it doesn't.  Preprocess it as described here.  Then post that .pp file, along with the options you use to build it.  That should tell us what is going on.

    Thanks and regards,

    -George

  • Thanks for looking into this for me.

    As suggested I have attached the .pp and .pjt

    Andrew

    Attached

    ====

    .pp

    ===

    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      Sample application demonstrating "C" fast RTS function usage.       */
    /*                                                                          */
    /*                                                                          */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */


    /*****************************************************************************/
    /* STDIO.H v7.2.7                                                            */
    /*                                                                           */
    /* Copyright (c) 1993-2011 Texas Instruments Incorporated                    */
    /* http://www.ti.com/                                                        */
    /*                                                                           */
    /*  Redistribution and  use in source  and binary forms, with  or without    */
    /*  modification,  are permitted provided  that the  following conditions    */
    /*  are met:                                                                 */
    /*                                                                           */
    /*     Redistributions  of source  code must  retain the  above copyright    */
    /*     notice, this list of conditions and the following disclaimer.         */
    /*                                                                           */
    /*     Redistributions in binary form  must reproduce the above copyright    */
    /*     notice, this  list of conditions  and the following  disclaimer in    */
    /*     the  documentation  and/or   other  materials  provided  with  the    */
    /*     distribution.                                                         */
    /*                                                                           */
    /*     Neither the  name of Texas Instruments Incorporated  nor the names    */
    /*     of its  contributors may  be used to  endorse or  promote products    */
    /*     derived  from   this  software  without   specific  prior  written    */
    /*     permission.                                                           */
    /*                                                                           */
    /*  THIS SOFTWARE  IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS    */
    /*  "AS IS"  AND ANY  EXPRESS OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT    */
    /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    */
    /*  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT    */
    /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,    */
    /*  SPECIAL,  EXEMPLARY,  OR CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT  NOT    */
    /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,    */
    /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    */
    /*  THEORY OF  LIABILITY, WHETHER IN CONTRACT, STRICT  LIABILITY, OR TORT    */
    /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE    */
    /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     */
    /*                                                                           */
    /*****************************************************************************/

    /*****************************************************************************/
    /* linkage.h   v7.2.7                                                        */
    /*                                                                           */
    /* Copyright (c) 1998-2011 Texas Instruments Incorporated                    */
    /* http://www.ti.com/                                                        */
    /*                                                                           */
    /*  Redistribution and  use in source  and binary forms, with  or without    */
    /*  modification,  are permitted provided  that the  following conditions    */
    /*  are met:                                                                 */
    /*                                                                           */
    /*     Redistributions  of source  code must  retain the  above copyright    */
    /*     notice, this list of conditions and the following disclaimer.         */
    /*                                                                           */
    /*     Redistributions in binary form  must reproduce the above copyright    */
    /*     notice, this  list of conditions  and the following  disclaimer in    */
    /*     the  documentation  and/or   other  materials  provided  with  the    */
    /*     distribution.                                                         */
    /*                                                                           */
    /*     Neither the  name of Texas Instruments Incorporated  nor the names    */
    /*     of its  contributors may  be used to  endorse or  promote products    */
    /*     derived  from   this  software  without   specific  prior  written    */
    /*     permission.                                                           */
    /*                                                                           */
    /*  THIS SOFTWARE  IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS    */
    /*  "AS IS"  AND ANY  EXPRESS OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT    */
    /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    */
    /*  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT    */
    /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,    */
    /*  SPECIAL,  EXEMPLARY,  OR CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT  NOT    */
    /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,    */
    /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    */
    /*  THEORY OF  LIABILITY, WHETHER IN CONTRACT, STRICT  LIABILITY, OR TORT    */
    /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE    */
    /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     */
    /*                                                                           */
    /*****************************************************************************/


    /*--------------------------------------------------------------------------*/
    /* Define _CODE_ACCESS ==> how to call RTS functions                        */
    /*--------------------------------------------------------------------------*/

    /*--------------------------------------------------------------------------*/
    /* Define _DATA_ACCESS ==> how to access RTS global or static data          */
    /*--------------------------------------------------------------------------*/
    /*--------------------------------------------------------------------------*/
    /* Define _DATA_ACCESS_NEAR ==> some C6000 RTS data must always be near     */
    /*--------------------------------------------------------------------------*/

    /*--------------------------------------------------------------------------*/
    /* Define _IDECL ==> how inline functions are declared                      */
    /*--------------------------------------------------------------------------*/

    /*****************************************************************************/
    /* stdarg.h   v7.2.7                                                         */
    /*                                                                           */
    /* Copyright (c) 1993-2011 Texas Instruments Incorporated                    */
    /* http://www.ti.com/                                                        */
    /*                                                                           */
    /*  Redistribution and  use in source  and binary forms, with  or without    */
    /*  modification,  are permitted provided  that the  following conditions    */
    /*  are met:                                                                 */
    /*                                                                           */
    /*     Redistributions  of source  code must  retain the  above copyright    */
    /*     notice, this list of conditions and the following disclaimer.         */
    /*                                                                           */
    /*     Redistributions in binary form  must reproduce the above copyright    */
    /*     notice, this  list of conditions  and the following  disclaimer in    */
    /*     the  documentation  and/or   other  materials  provided  with  the    */
    /*     distribution.                                                         */
    /*                                                                           */
    /*     Neither the  name of Texas Instruments Incorporated  nor the names    */
    /*     of its  contributors may  be used to  endorse or  promote products    */
    /*     derived  from   this  software  without   specific  prior  written    */
    /*     permission.                                                           */
    /*                                                                           */
    /*  THIS SOFTWARE  IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS    */
    /*  "AS IS"  AND ANY  EXPRESS OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT    */
    /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    */
    /*  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT    */
    /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,    */
    /*  SPECIAL,  EXEMPLARY,  OR CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT  NOT    */
    /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,    */
    /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    */
    /*  THEORY OF  LIABILITY, WHETHER IN CONTRACT, STRICT  LIABILITY, OR TORT    */
    /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE    */
    /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     */
    /*                                                                           */
    /*****************************************************************************/



       typedef char *va_list;


    /*****************************************************************************/
    /* VA_END - Reclaim resources used by varargs handling.                      */
    /*                                                                           */
    /* No action needed                                                          */
    /*****************************************************************************/


    /*****************************************************************************/
    /* VA_START - Set up the va_list pointer.                     */
    /*****************************************************************************/



    /*---------------------------------------------------------------------------*/
    /* COFF ABI convention:                                                      */
    /* - va_list is kept aligned to 4 bytes.                     */
    /* - va_list pointer points one word beyond the start of the last argument.  */
    /*---------------------------------------------------------------------------*/



    /*****************************************************************************/
    /* VA_ARG - Return the next argument, adjust va_list pointer             */
    /*                                                                           */
    /* Some arguments passed by value are turned into pass-by-reference by         */
    /* making a temporary object and passing a pointer to this temporary.  For   */
    /* such an argument (indicated by __va_argref(_type)) the actual argument    */
    /* passed is a pointer, so it must be dealt with specially.             */
    /*                                                                           */
    /* When an argument is larger than the maximum alignment (8 bytes for double */
    /* or long long), we only align to 8 bytes.                     */
    /*****************************************************************************/

    /*---------------------------------------------------------------------------*/
    /* What happens on every va_arg(_ap, _type) call is:                 */
    /* 1) Align the value of _ap (the va_list pointer) appropriately for _type   */
    /*    (the requested type).                             */
    /* 2) Increment _ap appropriately for _type.                     */
    /* 3) Return the value desired by dereferencing _ap.                 */
    /*---------------------------------------------------------------------------*/


    /*---------------------------------------------------------------------------*/
    /* The big- and little-endian variants are different only because we are     */
    /* trying to support the case of the user asking for "char" or "short",         */
    /* which is actually undefined behavior (See ISO/IEC 9899:1999 7.15.1.1),    */
    /* but we are trying to be friendly.                         */
    /*---------------------------------------------------------------------------*/






    /*---------------------------------------------------------------------------*/
    /* Attributes are only available in relaxed ANSI mode.                       */
    /*---------------------------------------------------------------------------*/



    /****************************************************************************/
    /* TYPES THAT ANSI REQUIRES TO BE DEFINED                                   */
    /****************************************************************************/
    typedef unsigned size_t;

    typedef struct {
          int fd;                    /* File descriptor */
          unsigned char* buf;        /* Pointer to start of buffer */
          unsigned char* pos;        /* Position in buffer */
          unsigned char* bufend;     /* Pointer to end of buffer */
          unsigned char* buff_stop;  /* Pointer to last read char in buffer */
          unsigned int   flags;      /* File status flags (see below) */
    } FILE;

    typedef int fpos_t;

    /****************************************************************************/
    /* DEVICE AND STREAM RELATED MACROS                                         */
    /****************************************************************************/
    /****************************************************************************/
    /* MACROS THAT DEFINE AND USE FILE STATUS FLAGS                             */
    /****************************************************************************/



    /****************************************************************************/
    /* MACROS THAT ANSI REQUIRES TO BE DEFINED                                  */
    /****************************************************************************/









    /******** END OF ANSI MACROS ************************************************/


    /****************************************************************************/
    /* DEVICE AND STREAM RELATED DATA STRUCTURES AND MACROS                     */
    /****************************************************************************/

    extern far FILE _ftable[10];
    extern far char _tmpnams[10][16];

    /****************************************************************************/
    /*   FUNCTION DEFINITIONS  - ANSI                                           */
    /****************************************************************************/
    /****************************************************************************/
    /* OPERATIONS ON FILES                                                      */
    /****************************************************************************/
    extern far int     remove(const char *_file);
    extern far int     rename(const char *_old, const char *_new);
    extern far FILE   *tmpfile(void);
    extern far char   *tmpnam(char *_s);

    /****************************************************************************/
    /* FILE ACCESS FUNCTIONS                                                    */
    /****************************************************************************/
    extern far int     fclose(FILE *_fp);
    extern far FILE   *fopen(const char *_fname, const char *_mode);
    extern far FILE   *freopen(const char *_fname, const char *_mode,
                            register FILE *_fp);
    extern far void    setbuf(register FILE *_fp, char *_buf);
    extern far int     setvbuf(register FILE *_fp, register char *_buf,
                            register int _type, register size_t _size);
    extern far int     fflush(register FILE *_fp);

    /****************************************************************************/
    /* FORMATTED INPUT/OUTPUT FUNCTIONS                                         */
    /****************************************************************************/
    extern far int fprintf(FILE *_fp, const char *_format, ...)
                   ;
    extern far int fscanf(FILE *_fp, const char *_fmt, ...)
                   ;
    extern far int printf(const char *_format, ...)
                   ;
    extern far int scanf(const char *_fmt, ...)
                   ;
    extern far int sprintf(char *_string, const char *_format, ...)
                   ;
    extern far int snprintf(char *_string, size_t _n,
                     const char *_format, ...)
                   ;
    extern far int sscanf(const char *_str, const char *_fmt, ...)
                   ;
    extern far int vfprintf(FILE *_fp, const char *_format, va_list _ap)
                   ;
    extern far int vprintf(const char *_format, va_list _ap)
                   ;
    extern far int vsprintf(char *_string, const char *_format,
                     va_list _ap)
                   ;
    extern far int vsnprintf(char *_string, size_t _n,
                      const char *_format, va_list _ap)
                   ;

    /****************************************************************************/
    /* CHARACTER INPUT/OUTPUT FUNCTIONS                                         */
    /****************************************************************************/
    extern far int     fgetc(register FILE *_fp);
    extern far char   *fgets(char *_ptr, register int _size,
                      register FILE *_fp);
    extern far int     fputc(int _c, register FILE *_fp);
    extern far int     fputs(const char *_ptr, register FILE *_fp);
    extern far int     getc(FILE *_p);
    extern far int     getchar(void);
    extern far char   *gets(char *_ptr);
    extern far int     putc(int _x, FILE *_fp);
    extern far int     putchar(int _x);
    extern far int     puts(const char *_ptr);
    extern far int     ungetc(int _c, register FILE *_fp);

    /****************************************************************************/
    /* DIRECT INPUT/OUTPUT FUNCTIONS                                            */
    /****************************************************************************/
    extern far size_t  fread(void *_ptr, size_t _size, size_t _count,
                      FILE *_fp);
    extern far size_t  fwrite(const void *_ptr, size_t _size,
                       size_t _count, register FILE *_fp);

    /****************************************************************************/
    /* FILE POSITIONING FUNCTIONS                                               */
    /****************************************************************************/
    extern far int     fgetpos(FILE *_fp, fpos_t *_pos);
    extern far int     fseek(register FILE *_fp, long _offset,
                      int _ptrname);
    extern far int     fsetpos(FILE *_fp, const fpos_t *_pos);
    extern far long    ftell(FILE *_fp);
    extern far void    rewind(register FILE *_fp);

    /****************************************************************************/
    /* ERROR-HANDLING FUNCTIONS                                                 */
    /****************************************************************************/
    extern far void    clearerr(FILE *_fp);
    extern far int     feof(FILE *_fp);
    extern far int     ferror(FILE *_fp);
    extern far void    perror(const char *_s);









    /* Contains the include files of the inline C functions */



    /*****************************************************************************/
    /* limits.h   v7.2.7                                                         */
    /*                                                                           */
    /* Copyright (c) 1993-2011 Texas Instruments Incorporated                    */
    /* http://www.ti.com/                                                        */
    /*                                                                           */
    /*  Redistribution and  use in source  and binary forms, with  or without    */
    /*  modification,  are permitted provided  that the  following conditions    */
    /*  are met:                                                                 */
    /*                                                                           */
    /*     Redistributions  of source  code must  retain the  above copyright    */
    /*     notice, this list of conditions and the following disclaimer.         */
    /*                                                                           */
    /*     Redistributions in binary form  must reproduce the above copyright    */
    /*     notice, this  list of conditions  and the following  disclaimer in    */
    /*     the  documentation  and/or   other  materials  provided  with  the    */
    /*     distribution.                                                         */
    /*                                                                           */
    /*     Neither the  name of Texas Instruments Incorporated  nor the names    */
    /*     of its  contributors may  be used to  endorse or  promote products    */
    /*     derived  from   this  software  without   specific  prior  written    */
    /*     permission.                                                           */
    /*                                                                           */
    /*  THIS SOFTWARE  IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS    */
    /*  "AS IS"  AND ANY  EXPRESS OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT    */
    /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    */
    /*  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT    */
    /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,    */
    /*  SPECIAL,  EXEMPLARY,  OR CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT  NOT    */
    /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,    */
    /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    */
    /*  THEORY OF  LIABILITY, WHETHER IN CONTRACT, STRICT  LIABILITY, OR TORT    */
    /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE    */
    /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     */
    /*                                                                           */
    /*****************************************************************************/

    /*****************************************************************************/
    /* TMS320C6X machine limits                                                  */
    /*****************************************************************************/


     






    /*****************************************************************************/
    /*  ERRNO.H  v7.2.7                                                          */
    /*                                                                           */
    /* Copyright (c) 1995-2011 Texas Instruments Incorporated                    */
    /* http://www.ti.com/                                                        */
    /*                                                                           */
    /*  Redistribution and  use in source  and binary forms, with  or without    */
    /*  modification,  are permitted provided  that the  following conditions    */
    /*  are met:                                                                 */
    /*                                                                           */
    /*     Redistributions  of source  code must  retain the  above copyright    */
    /*     notice, this list of conditions and the following disclaimer.         */
    /*                                                                           */
    /*     Redistributions in binary form  must reproduce the above copyright    */
    /*     notice, this  list of conditions  and the following  disclaimer in    */
    /*     the  documentation  and/or   other  materials  provided  with  the    */
    /*     distribution.                                                         */
    /*                                                                           */
    /*     Neither the  name of Texas Instruments Incorporated  nor the names    */
    /*     of its  contributors may  be used to  endorse or  promote products    */
    /*     derived  from   this  software  without   specific  prior  written    */
    /*     permission.                                                           */
    /*                                                                           */
    /*  THIS SOFTWARE  IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS    */
    /*  "AS IS"  AND ANY  EXPRESS OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT    */
    /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR    */
    /*  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT    */
    /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,    */
    /*  SPECIAL,  EXEMPLARY,  OR CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT  NOT    */
    /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,    */
    /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY    */
    /*  THEORY OF  LIABILITY, WHETHER IN CONTRACT, STRICT  LIABILITY, OR TORT    */
    /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE    */
    /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     */
    /*                                                                           */
    /*****************************************************************************/






    extern far int errno;

    /*---------------------------------------------------------------------------*/
    /* Change #defines for CLIB ABI conformance.                                 */
    /*---------------------------------------------------------------------------*/







    /****************************************************************************/
    /*  c60_32.h         v4.20                                                  */
    /*  Copyright (c) 1997-2001  Texas Instruments Incorporated                 */
    /****************************************************************************/
     
    /* This source automatically generated on Wed Aug  2 15:54:33 CDT 2000 */
     













    unsigned _lmbd (unsigned, unsigned);



    /****************************************************************************/
    /*  formi32.h        v4.20                                                 */
    /*  Copyright (c) 1997-2001  Texas Instruments Incorporated                 */
    /****************************************************************************/
     
    /* This source automatically generated on Wed Aug  2 15:54:34 CDT 2000 */
     












    /* usually (-EMIN<EMAX) ? RADIX**(EMIN-1) : 1/MOST_POS */













    /****************************************************************************/
    /*  syntfi.h         v4.20                                                  */
    /*  Copyright (c) 1997-2001  Texas Instruments Incorporated                 */
    /****************************************************************************/
     
    /* This source automatically generated on Wed Aug  2 15:52:55 CDT 2000 */
     





    /****************************************************************************/
    /*  numconst.h       v4.20                                                 */
    /*  Copyright (c) 1997-2001  Texas Instruments Incorporated                 */
    /****************************************************************************/
     
    /* This source automatically generated on Wed Aug  2 15:55:36 CDT 2000 */
     



























    /*#ifdef MPYF3(dst,left,right)
        #error "Int Mutliply"
    #endif*/











     

























    /****************************************************************************/
    /*  ieeef.h          v4.20                                                 */
    /*  Copyright (c) 1997-2001  Texas Instruments Incorporated                 */
    /****************************************************************************/
     
    /* This source automatically generated on Wed Aug  2 15:54:34 CDT 2000 */
     

    /****************************************************************************/
    /*  access.h         v7.2.7                                                 */
    /*                                                                          */
    /* Copyright (c) 1997-2011 Texas Instruments Incorporated                   */
    /* http://www.ti.com/                                                       */
    /*                                                                          */
    /*  Redistribution and  use in source  and binary forms, with  or without   */
    /*  modification,  are permitted provided  that the  following conditions   */
    /*  are met:                                                                */
    /*                                                                          */
    /*     Redistributions  of source  code must  retain the  above copyright   */
    /*     notice, this list of conditions and the following disclaimer.        */
    /*                                                                          */
    /*     Redistributions in binary form  must reproduce the above copyright   */
    /*     notice, this  list of conditions  and the following  disclaimer in   */
    /*     the  documentation  and/or   other  materials  provided  with  the   */
    /*     distribution.                                                        */
    /*                                                                          */
    /*     Neither the  name of Texas Instruments Incorporated  nor the names   */
    /*     of its  contributors may  be used to  endorse or  promote products   */
    /*     derived  from   this  software  without   specific  prior  written   */
    /*     permission.                                                          */
    /*                                                                          */
    /*  THIS SOFTWARE  IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS   */
    /*  "AS IS"  AND ANY  EXPRESS OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT   */
    /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR   */
    /*  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT   */
    /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   */
    /*  SPECIAL,  EXEMPLARY,  OR CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT  NOT   */
    /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   */
    /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   */
    /*  THEORY OF  LIABILITY, WHETHER IN CONTRACT, STRICT  LIABILITY, OR TORT   */
    /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   */
    /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    */
    /*                                                                          */
    /****************************************************************************/






    extern far float _absf(float x);
    extern far float _negf(float x);

    extern far float _addf(float left, float right);
    extern far float _subf(float left, float right);
    extern far float _mpyf(float left, float right);
    extern far float _divf(float left, float right);

    extern far int _cmpf(float left,
                     float right); /* <0 if LT, 0 if EQ, >0 if GT     */
                                   /* no correct result if NaN source */

    extern far int _eqlf(float left, float right);
    extern far int _neqf(float left, float right);
    extern far int _leqf(float left, float right);
    extern far int _geqf(float left, float right);
    extern far int _lssf(float left, float right);
    extern far int _gtrf(float left, float right);


    /* char <-> float */
    extern far float         _fltcf(  signed char x);
    extern far float         _fltbf(unsigned char x);
    extern far   signed char _fixfc(float x);
    extern far unsigned char _fixfb(float x);

    /* short <-> float */
    extern far float          _fltsif(         short x);
    extern far float          _fltusf(unsigned short x);
    extern far short          _fixfsi(float x);
    extern far unsigned short _fixfus(float x);

    /* int <-> float */
    extern far float    _fltif(int      x);
    extern far float    _fltuf(unsigned x);
    extern far int      _fixfi(float x);
    extern far unsigned _fixfu(float x);

    /* long <-> float */
    extern far float         _fltlif(         long x);
    extern far float         _fltulf(unsigned long x);
    extern far long          _fixfli(float x);
    extern far unsigned long _fixful(float x);

    /****************************************************************************/
    /*  UNACCESS.H v7.2.7                                                       */
    /*                                                                          */
    /* Copyright (c) 2000-2011 Texas Instruments Incorporated                   */
    /* http://www.ti.com/                                                       */
    /*                                                                          */
    /*  Redistribution and  use in source  and binary forms, with  or without   */
    /*  modification,  are permitted provided  that the  following conditions   */
    /*  are met:                                                                */
    /*                                                                          */
    /*     Redistributions  of source  code must  retain the  above copyright   */
    /*     notice, this list of conditions and the following disclaimer.        */
    /*                                                                          */
    /*     Redistributions in binary form  must reproduce the above copyright   */
    /*     notice, this  list of conditions  and the following  disclaimer in   */
    /*     the  documentation  and/or   other  materials  provided  with  the   */
    /*     distribution.                                                        */
    /*                                                                          */
    /*     Neither the  name of Texas Instruments Incorporated  nor the names   */
    /*     of its  contributors may  be used to  endorse or  promote products   */
    /*     derived  from   this  software  without   specific  prior  written   */
    /*     permission.                                                          */
    /*                                                                          */
    /*  THIS SOFTWARE  IS PROVIDED BY THE COPYRIGHT  HOLDERS AND CONTRIBUTORS   */
    /*  "AS IS"  AND ANY  EXPRESS OR IMPLIED  WARRANTIES, INCLUDING,  BUT NOT   */
    /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR   */
    /*  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT   */
    /*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   */
    /*  SPECIAL,  EXEMPLARY,  OR CONSEQUENTIAL  DAMAGES  (INCLUDING, BUT  NOT   */
    /*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   */
    /*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   */
    /*  THEORY OF  LIABILITY, WHETHER IN CONTRACT, STRICT  LIABILITY, OR TORT   */
    /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   */
    /*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    */
    /*                                                                          */
    /****************************************************************************/
    /* unaccess.h: Empty by default */



    /* Contains the macros used in the inline C functions                       */














    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      addsp -- Single Precision Floating Point Addition                   */
    /*                                                                          */
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      float addsp_i                                                       */
    /*      (                                                                   */
    /*        float left,   // Argument 1   //                                  */
    /*        float right   // Argument 2   //                                  */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the single precision addition of two            */
    /*      32-bit single precision inputs. Underflow returns zero,             */
    /*      overflow return + or - infinity and they are under the DEBUG        */
    /*                                                                          */
    /*    Single precision binury floating point number format is 32 bit number */
    /*    BIT 31 = SIGN, BIT 30 - 23 = EXPONENT and BIT 22 - 0 = MANTISSA       */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */





    static inline float addsp_i(float left, float right)

    {


        int  lft , rgt, rgt1, lft1; /* int register versions of left,right REAL params   */
        int  lfrc, rfrc, temp_res, temp_exp, res; /* fraction of left/dest operand and right operand   */
        int  lexp, rexp, pexp; /* exponent of left/dest operand and right operand   */
        int  sign = 0;   /* sign bit of the result */
        int lfrc_1, rfrc_1, flag_zero; /*tempreroy registers, flag to check for zero operand */
        int temp_res_1, temp_exp_1, temp_res_2, temp_exp_2; /*temporary results */

       /*------------------------------------------------------------------------*/
       /* Transfer the left,right bits to lft,rgt.                               */
       /* REALasINT may force left and right to memory if dumb compiler.         */
       /* This is OK since they won't be needed again except for unusual cases.  */
       /* lft,rgt will hopefully wind up in integer registers.                   */
       /*------------------------------------------------------------------------*/

           (lft)=(unsigned)_ftoi(left);
        (rgt)=(unsigned)_ftoi(right);
        
        /*------------------------------------------------------------------------*/
        /* Unpack fraction and exponent, ignoring signs for now.                  */
        /* Reinsert hidden bit or re-normalize fraction as appropriate.           */
        /*------------------------------------------------------------------------*/
        lfrc = lft & ~(((unsigned)1)<<(32-1));
        rfrc = rgt & ~(((unsigned)1)<<(32-1));
        
        flag_zero = lfrc | rfrc;   /*if both operands = 0, set the zero flag*/
        
        lexp = lfrc >> (23 % 32);    /*extract the exponent*/
        lfrc_1 = (lfrc & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)); /*insert hidden bit*/

        rexp = rfrc >> (23 % 32);   /*extract the exponent*/
        rfrc_1 = (rfrc & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)); /*insert hidden bit*/

        if ((lft1 = lft) < 0)
            lfrc_1 = (~lfrc_1 + 1) * 2; /* make 2's complement */
        if (lft1 >= 0)
            lfrc_1 = lfrc_1 * 2;  /*left shift by 1*/
        
        if ((rgt1 = rgt) < 0)
            rfrc_1 = (~rfrc_1 + 1) * 2;  /* make 2's complement */
        if (rgt1 >= 0)
            rfrc_1 = rfrc_1 * 2;    /*left shift by 1*/

        /*------------------------------------------------------------------------*/
        /* Shift fractions to align radix point and add.                          */
        /* Result has one rounding bit.                                           */
        /*------------------------------------------------------------------------*/
        pexp = lexp - rexp;
        if (pexp >= 0) {  /* |left| >= |right| */
            temp_res = lfrc_1 + (rfrc_1 >> pexp);
            temp_exp = lexp;
        }
        else {   /* |left| <  |right| */    
            temp_res = rfrc_1 + (lfrc_1 >> -pexp);
            temp_exp = rexp;
        }
        /*addition result stored in temp_res and temp_exp*/
        
        if (temp_res < 0) { /* back to sign-magnitude */
            temp_res_1 = ~temp_res+1;  /*2's complement of the result*/
            sign = (int )(((unsigned)1)<<(32-1));  /*SIGN bit is set*/
        }
        else
            temp_res_1 = temp_res;  /*Keep the result as it is and SIGN=0 */
        temp_exp_1 = temp_exp;

        /*------------------------------------------------------------------------*/
        /* Round and normalize the result                                         */
        /*------------------------------------------------------------------------*/
        
        if (temp_res_1 < (((int)1)<< (23 % 32))*2) {
            do {int tmp= _lmbd(1, temp_res_1)-32+ (23%32)+2; temp_res_1 <<= tmp; temp_exp_1 -= tmp;} while (0);
        }
        else {
            temp_res_1 += 1;             /* biased rounding */
            if (temp_res_1 >= ((((int)1)<< (23 % 32)) * 4)) {
                temp_res_1 = ((temp_res_1 -1) >> 1) + 1;
                temp_exp_1 += 1;
            }    
        }
        temp_res_2 = temp_res_1;
        temp_exp_2 = temp_exp_1;
        /*------------------------------------------------------------------------*/
        /* Check for overflow and underflow                                       */
        /*------------------------------------------------------------------------*/

        /*TO enable the check, Run in DEBUG mode, or define DEBUG macro*/

        /*------------------------------------------------------------------------*/
        /* Assemble result and return                                             */
        /*------------------------------------------------------------------------*/
        res = ((temp_res_2>>1)& ((((int)1)<< (23 % 32))-1)) + (((int )temp_exp_2) << (23 % 32)) +sign;

        
        if(rfrc == 0)  /* right operand is zero, so result = left */
            return left;
        
        if(lfrc == 0)  /* left operands is zero, so result = right */
            return right;
        
        if(flag_zero == 0)  /* both operands are zero, so result = 0 */
            res = 0;
        
        
        
        return _itof((unsigned)(res));

    }


    /* ======================================================================== */
    /*  End of file: addsp_i.h                                                  */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */

    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      subsp -- Single Precision Floating Point Subtraction                */
    /*                                                                          */
    /*                                                                          */   
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      float subsp_i                                                       */
    /*      (                                                                   */
    /*        float left,   // Argument 1   //                                  */
    /*        float right   // Argument 2   //                                  */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the single precision subtraction of two         */
    /*      32-bit single precision inputs. Underflow returns zero,             */
    /*      overflow return + or - infinity, they are placed in the DEBUG macro */
    /*                                                                          */    
    /*    Single precision binury floating point number format is 32 bit number */
    /*    BIT 31 = SIGN, BIT 30 - 23 = EXPONENT and BIT 22 - 0 = MANTISSA       */
    /*                                                                          */
    /*  Subtraction is performed by taking the 2's complement of the right      */
    /*               operand and performing Addition                            */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */



    static inline float subsp_i(float left, float right)
    {

        int  lft , rgt, rgt1, lft1 ; /* int register versions of left,right REAL params   */
        int  lfrc, rfrc, temp_res, temp_exp, res; /* fraction of left/dest operand and right operand   */
        int  lexp, rexp, pexp; /* exponent of left/dest operand and right operand   */
        int  sign = 0, rgt_sign; /* sign of the result and sign of the right operand */
        int lfrc_1, rfrc_1, flag_zero; /* zero flag */
        int temp_res_1, temp_exp_1, temp_res_2, temp_exp_2;

       /*------------------------------------------------------------------------*/
       /* Transfer the left,right bits to lft,rgt.                               */
       /* REALasINT may force left and right to memory if dumb compiler.         */
       /* This is OK since they won't be needed again except for unusual cases.  */
       /* lft,rgt will hopefully wind up in integer registers.                   */
       /*------------------------------------------------------------------------*/

           (lft)=(unsigned)_ftoi(left);
        (rgt)=(unsigned)_ftoi(right);

        /*------------------------------------------------------------------------*/
        /* Unpack fraction and exponent, ignoring signs for now.                  */
        /* Reinsert hidden bit or re-normalize fraction as appropriate.           */
        /*------------------------------------------------------------------------*/
        lfrc = lft & ~(((unsigned)1)<<(32-1));
        rfrc = rgt & ~(((unsigned)1)<<(32-1));
        flag_zero = lfrc | rfrc;
        rgt_sign = (rgt >> (32 - 1));    /* take 2's complement of the right operand */
        rgt1 = ((~rgt_sign) << (32 - 1)) | rfrc ;

        lexp = lfrc >> (23 % 32); /* Extract the exponent */
        lfrc_1 = (lfrc & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)); /*insert hidden bit*/

        rexp = rfrc >> (23 % 32);  /* Extract the exponent */
        rfrc_1 = (rfrc & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)); /*insert hidden bit*/

        if ((lft1 = lft) < 0)
            lfrc_1 = (~lfrc_1 + 1) * 2; /* make 2's complement */
        if (lft1 >= 0)
            lfrc_1 = lfrc_1 * 2;   /* Shift left by 1 */
        
        if (rgt1 < 0)
            rfrc_1 = (~rfrc_1 + 1) * 2;  /* make 2's complement */
        if (rgt1 >= 0)
            rfrc_1 = rfrc_1 * 2;   /* Shift left by 1 */

        /*------------------------------------------------------------------------*/
        /* Shift fractions to align radix point and add.                          */
        /* Result has one rounding bit.                                           */
        /*------------------------------------------------------------------------*/
        pexp = lexp - rexp;
        if (pexp >= 0) {  /* |left| >= |right| */
            temp_res = lfrc_1 + (rfrc_1 >> pexp);
            temp_exp = lexp;
        }
        else {/* |left| <  |right| */    
            temp_res = rfrc_1 + (lfrc_1 >> -pexp);
            temp_exp = rexp;
        }
     /* addition result stored in temp_res and temp_exp */

        if (temp_res < 0) { /* back to sign-magnitude */
            temp_res_1 = ~temp_res+1;  /* Take 2's complement */
            sign = (int )(((unsigned)1)<<(32-1));  /* Set the sign flag */
        }
        else
            temp_res_1 = temp_res;
        temp_exp_1 = temp_exp;

        /*------------------------------------------------------------------------*/
        /* Round and normalize the result                                         */
        /*------------------------------------------------------------------------*/
        
        if (temp_res_1 < (((int)1)<< (23 % 32))*2) {
            do {int tmp= _lmbd(1, temp_res_1)-32+ (23%32)+2; temp_res_1 <<= tmp; temp_exp_1 -= tmp;} while (0);
        }
        else {
            temp_res_1 += 1;             /* biased rounding */
            if (temp_res_1 >= ((((int)1)<< (23 % 32)) * 4)) {
                temp_res_1 = ((temp_res_1 -1) >> 1) +1;
                temp_exp_1 += 1;
            }    
        }
        temp_res_2 = temp_res_1;
        temp_exp_2 = temp_exp_1;

        /*------------------------------------------------------------------------*/
        /* Check for overflow and underflow                                       */
        /*------------------------------------------------------------------------*/

        /*TO enable the check, Run in DEBUG mode, or define DEBUG macro*/
        /*------------------------------------------------------------------------*/
        /* Assemble result and return                                             */
        /*------------------------------------------------------------------------*/
        res = ((temp_res_2>>1)& ((((int)1)<< (23 % 32))-1)) + (((int )temp_exp_2) << (23 % 32)) +sign;
        
        if(rfrc == 0)  /* right operand is zero, so result = left */
            return left;
        
        if(lfrc == 0)  /* left operands is zero, so result = right */
            return _itof((unsigned)(rgt1));
            
        if(flag_zero == 0)
            res = 0;

        return _itof((unsigned)(res));


    }

    /* ======================================================================== */
    /*  End of file: subsp_i.h                                                  */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */
    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      mpysp -- Single Precision Floating Point Multiply                   */
    /*                                                                          */
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      float mpysp_i                                                       */
    /*      (                                                                   */
    /*        float left,   // Argument 1   //                                  */
    /*        float right   // Argument 2   //                                  */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the single precision multiplication of two      */
    /*      32-bit single precision inputs.                                     */
    /*                                                                          */
    /*    Single precision binury floating point number format is 32 bit number */
    /*    BIT 31 = SIGN, BIT 30 - 23 = EXPONENT and BIT 22 - 0 = MANTISSA       */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */




    static inline float mpysp_i(float left, float right)
    {

        unsigned  lfrc_o, rfrc_o, lfrc, rfrc,  pfrc, pfrc_1, pfrc_2;  /* fraction of left, right and product */
        int    lexp, rexp, pexp, pexp_1, flag_zero;    /* exponent of left, right and product */
        unsigned  sign, lfrc_1, rfrc_1, lfrc_2, rfrc_2; /* temp variable */

       /*------------------------------------------------------------------------*/
       /* Unpack fraction and exponent, ignoring signs for now.                  */
       /* Reinsert hidden bit or re-normalize fraction as appropriate.           */
       /*------------------------------------------------------------------------*/
           pfrc = 0;
        (lfrc_o)=_ftoi(left);
           (rfrc_o)=_ftoi(right);
           sign = (lfrc_o ^ rfrc_o) & (((unsigned)1)<<(32-1));
           lfrc = lfrc_o & ~(((unsigned)1)<<(32-1));
           rfrc = rfrc_o & ~(((unsigned)1)<<(32-1));
        
        flag_zero = (lfrc == 0 | rfrc == 0); /* Set flag_zero = 1 if either operand is zero */

        lexp = (int)(lfrc >> (23 % 32));  /* Extract the exponent */
        rexp = (int)(rfrc >> (23 % 32));
        lfrc_1 = (lfrc & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)) ; /* Insert hidden bit */
        rfrc_1 = (rfrc & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32));

       /*------------------------------------------------------------------------*/
       /* Compute product exponent and fraction.                                 */
       /* Round and normalize product if needed.                                 */
       /*------------------------------------------------------------------------*/
           pexp = lexp + rexp; /* Exponent = sum of the exponents of operands */
         lfrc_2 = lfrc_1 * 32; /* Mantissa shift left by 5 */       
        rfrc_2 = rfrc_1 * 32;        
        pfrc = _hill(_mpy32u(lfrc_2,rfrc_2)); /* Multiply the fractions of the 2 operands */

        pfrc = pfrc + 1;     /* biased rounding */
           if (pfrc >= ((((int)1)<< (23 % 32)) * 4))
           {
               pfrc >>= 1;
               pexp += 1;
           }  

        pfrc_1 = pfrc;
        pexp_1 = pexp - 127;
       /*------------------------------------------------------------------------*/
       /* Check for overflow and underflow.                                      */
       /*------------------------------------------------------------------------*/

       /*TO enable the check, Run in DEBUG mode, or define DEBUG macro*/

       /*------------------------------------------------------------------------*/
       /* assemble result and return.                                            */
       /*------------------------------------------------------------------------*/

           pfrc_2 = ((pfrc_1 >> 1) & ((((int)1)<< (23 % 32))-1)) + (((int )pexp_1) << (23 % 32));

          pfrc_2 = pfrc_2 + sign;

        if(flag_zero == 1) /* Check whether flag_zero is set */
            pfrc_2 = 0;    

        return _itof(pfrc_2);



    }

    /* ======================================================================== */
    /*  End of file: mpysp_i.h                                                  */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */
    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      divsp -- Single Precision Floating Point Divide                     */
    /*                                                                          */
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      float divsp_i                                                       */
    /*      (                                                                   */
    /*        float left,   // Argument 1   //                                  */
    /*        float right   // Argument 2   //                                  */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the single precision division of two            */
    /*      32-bit single precision inputs.                                     */
    /*                                                                          */
    /*    Single precision binury floating point number format is 32 bit number   */
    /*    BIT 31 = SIGN, BIT 30 - 23 = EXPONENT and BIT 22 - 0 = MANTISSA         */
    /*                                                                          */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */





    static inline float divsp_i(float left, float right)
    {

        unsigned  lfrc, rfrc, pfrc, pfrc_1, W;     /* fraction of left, right and product */
        int    lexp, rexp, pexp, pexp_1, Q, Q_1, N;    /* exponent of left, right and product */
        unsigned  sign, flag_zero, flag_infinity, lfrc_o, rfrc_o, temp_res;    
        unsigned W_1, lfrc_1, rfrc_1, lfrc_2, rfrc_2;    
       /*------------------------------------------------------------------------*/
       /* Unpack fraction and exponent, ignoring signs for now.                  */
       /* Reinsert hidden bit or re-normalize fraction as appropriate.           */
       /*------------------------------------------------------------------------*/

         pfrc = 0;
         (lfrc)=_ftoi(left);
         (rfrc)=_ftoi(right);
         sign = (lfrc ^ rfrc) & (((unsigned)1)<<(32-1)); /*Sign of the result = EXOR of the sign of the operands */
         lfrc_o = lfrc & ~(((unsigned)1)<<(32-1));
         rfrc_o = rfrc & ~(((unsigned)1)<<(32-1));

         flag_zero = lfrc_o; /* Set Flag_zero = 0 if the dividend is zero */
         flag_infinity = rfrc_o; /* Set flag_infinity = 0 if divisor is zero */

         lexp = lfrc_o >> 23;  /* Extract the exponent */
         rexp = rfrc_o >> 23;

         lfrc_1 = ((lfrc_o & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)));
         rfrc_1 = ((rfrc_o & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)));
         lfrc_2 = lfrc_1 * 128; /* Shift left by 7 */
         rfrc_2 = rfrc_1 * 128; /* Shift left by 7 */
         Q = 0;  /* Set partial quotient to zero */

       /*------------------------------------------------------------------------*/
       /* Compute quotient exponent and fraction.                                */
       /* Round and normalize quotient if needed.                                */
       /*------------------------------------------------------------------------*/
         pexp = lexp - rexp;  /* Exponent of the result = difference of exponents of operands */

        /* 0.5 < quotient < 2.0, hence the 25 iterations */
         for(N = 0; N < 5; N++){
            W = lfrc_2;   /* Copy the Q bits into temp W */
            lfrc_2 = _clr(lfrc_2,0,4); /* clear the lower 5 bits */

            lfrc_2 = _subc(lfrc_2,rfrc_2); /* repeated subtraction to get the partial quotient */
            W = _extu(W,27,27);

            lfrc_2 = _subc(lfrc_2,rfrc_2);
            Q = Q + W;
            
            lfrc_2 = _subc(lfrc_2,rfrc_2);
            Q = Q * 32;        

            lfrc_2 = _subc(lfrc_2,rfrc_2);

            lfrc_2 = _subc(lfrc_2,rfrc_2);
         }
         pexp_1 = pexp + 133;

         W_1 = _norm(Q);  /* normalize the quotient */
         temp_res = _extu(lfrc_2,27,27);  /* Extract the final quotient bits */
         Q_1 = Q + temp_res;
         pexp_1 = pexp_1 - W_1; /* Adjust the exponent based on the result */
         Q_1 = Q_1 << W_1;

         pfrc = Q_1 + 1;

       /*------------------------------------------------------------------------*/
       /* check for overflow and underflow                                       */
       /*------------------------------------------------------------------------*/

    /*TO enable the check, Run in DEBUG mode, or define DEBUG macro*/

       
       /*------------------------------------------------------------------------*/
       /* assemble result and return                                             */
       /*------------------------------------------------------------------------*/

        pfrc_1 = ((pfrc >> 7) & ((((int)1)<< (23 % 32))-1)) + (((int )pexp_1) << 23 );
        
        if(flag_zero == 0) /* If flag_zero = 0, dividend is zero, so result = 0 */
            pfrc_1 = 0;

        if(flag_infinity == 0) /* If flag_infinity = 0, divisor is zero, so result = infinity */
             pfrc_1 = (((int)((((int)1)<<8)-1)) << (23 % 32));
        
        if(flag_zero == 0 & flag_infinity == 0) /* If both opernads are zero, result = NAN */
            pfrc_1 = ((((int)((((int)1)<<8)-1)) << (23 % 32))+1);

        pfrc_1 += sign;

        return _itof(pfrc_1);

    /* endif_IEEE_Hardware */


    }

    /* ======================================================================== */
    /*  End of file: divsp_i.h                                                  */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */
    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      recipsp -- Single Precision Floating Point Reciprocal               */
    /*                                                                          */
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      float recipsp_ci                                                    */
    /*      (                                                                   */
    /*        float right   // Argument 1   //                                  */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the single precision reciprocal of the          */
    /*      32-bit single precision inputs.                                     */
    /*                                                                          */
    /*    Single precision binury floating point number format is 32 bit number */
    /*    BIT 31 = SIGN, BIT 30 - 23 = EXPONENT and BIT 22 - 0 = MANTISSA       */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */



    static inline float recipsp_i(float right)
    {

        unsigned  lfrc, rfrc, pfrc, lfrc_1, rfrc_1, W, W_1, pfrc_1;     /* fraction of left, right and product */
        int    lexp, rexp, pexp, pexp_1, Q, Q_1, N;    /* exponent of left, right and product */
        unsigned  sign, flag_infinity, lfrc_o, rfrc_o; /* sign bit of the result */   
        unsigned lfrc_2, rfrc_2, temp_res;
       /*------------------------------------------------------------------------*/
       /* Unpack fraction and exponent, ignoring signs for now.                  */
       /* Reinsert hidden bit or re-normalize fraction as appropriate.           */
       /*------------------------------------------------------------------------*/
        float left = 1.0; /* Dividend is 1 */
        pfrc = 0;
        (lfrc)=_ftoi(left);
        (rfrc)=_ftoi(right);
        sign = (lfrc ^ rfrc) & (((unsigned)1)<<(32-1)); /*Sign of the result = EXOR of the sign of the operands */
        lfrc_o = lfrc & ~(((unsigned)1)<<(32-1));
        rfrc_o = rfrc & ~(((unsigned)1)<<(32-1));

        flag_infinity = rfrc_o; /* Set flag_infinity = 0 if divisor is zero */

        lexp = lfrc_o >> 23;  /* Extract the exponent */
        rexp = rfrc_o >> 23;

        lfrc_1 = ((lfrc_o & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)));
        rfrc_1 = ((rfrc_o & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32)));
        lfrc_2 = lfrc_1 * 128; /* Shift left by 7 */
        rfrc_2 = rfrc_1 * 128; /* Shift left by 7 */
        Q = 0;  /* Set partial quotient to zero */

       /*------------------------------------------------------------------------*/
       /* Compute quotient exponent and fraction.                                */
       /* Round and normalize quotient if needed.                                */
       /*------------------------------------------------------------------------*/
        pexp = lexp - rexp;  /* Exponent of the result = difference of exponents of operands */

        /* 0.5 < quotient < 2.0, hence the 25 iterations */
        for(N = 0; N < 5; N++){

            W = lfrc_2;   /* Copy the Q bits into temp W */
            lfrc_2 = _clr(lfrc_2,0,4); /* clear the lower 5 bits */

            lfrc_2 = _subc(lfrc_2,rfrc_2); /* repeated subtraction to get the partial quotient */
            W = _extu(W,27,27);

            lfrc_2 = _subc(lfrc_2,rfrc_2);
            Q = Q + W;
            
            lfrc_2 = _subc(lfrc_2,rfrc_2);
            Q = Q * 32;        

            lfrc_2 = _subc(lfrc_2,rfrc_2);

            lfrc_2 = _subc(lfrc_2,rfrc_2);
        }
        pexp_1 = pexp + 133;

        W_1 = _norm(Q);  /* normalize the quotient */
        temp_res = _extu(lfrc_2,27,27);  /* Extract the final quotient bits */
        Q_1 = Q + temp_res;
        pexp_1 = pexp_1 - W_1; /* Adjust the exponent based on the result */
        Q_1 = Q_1 << W_1;
        pfrc = Q_1 + 1;  

       /*------------------------------------------------------------------------*/
       /* check for overflow and underflow                                       */
       /*------------------------------------------------------------------------*/

    /*TO enable the check, Run in DEBUG mode, or define DEBUG macro*/

       
       /*------------------------------------------------------------------------*/
       /* assemble result and return                                             */
       /*------------------------------------------------------------------------*/

        pfrc_1 = ((pfrc >> 7) & ((((int)1)<< (23 % 32))-1)) + (((int )pexp_1) << 23 );

        if(flag_infinity == 0) /* If flag_infinity = 0, divisor is zero, so result = infinity */
            pfrc_1 = (((int)((((int)1)<<8)-1)) << (23 % 32));
        
        pfrc_1 += sign;

        return _itof(pfrc_1);

    /* endif_IEEE_Hardware */


    }


    /* ======================================================================== */
    /*  End of file: recipsp_ci.c                                                */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */
    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      intsp -- 32-bit Signed Integer -> 32-bit IEEE-754 SP Floating       */
    /*      Point                                                               */
    /*                                                                          */
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      float intsp_i                                                       */
    /*      (                                                                   */
    /*        int a,   // Argument 1   //                                       */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the single precision floating point             */
    /*      representation of the inpt integer.                                 */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */




    static inline float intsp_i(int x)
    {

        unsigned  rfrc, rfrc_1;
        int rexp, rexp_1; /* frc and exp of result */
        unsigned  rslt, rslt_1;

        rfrc = x;
        if ((int )rfrc < 0)
            rfrc = ~rfrc + 1;  /* *WANT* -most_neg == most_neg */

        rexp = _lmbd(1,  rfrc ) ; /* no of consecutive 0 MSBs */

        rfrc_1 = rfrc << rexp;
        rexp_1 = 127  + 32 - 2 - rexp;

       /* align for mantissa field and round */

            rslt = (unsigned )(((rfrc_1 >> ((32 - 23 -1) - 1)) +1) >> 1);

       /*-----------------------------------------------------------------------*/
       /* The exponent field in rfrc now holds 1 or maybe 2 if the fraction     */
       /* rounded up.  ADD in rexp to simultaneously combine exponent/fraction  */
       /* and also increment the exponent by the appropriate amount.            */
       /*-----------------------------------------------------------------------*/
        rslt_1 = rslt + (((unsigned )rexp_1) << 23) ;

        if (x < 0)
            rslt_1 += (((unsigned)1)<<(32-1));

        if(x == 0)
            rslt_1 = 0;

        return _itof(rslt_1);


    }

    /* ======================================================================== */
    /*  End of file: intsp_i.h                                                  */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */
    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      uintsp -- 40-bit Unsigned Long Integer -> 32-bit IEEE-754 SP        */
    /*      Floating Point                                                      */
    /*                                                                          */
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      float uintsp_i                                                      */
    /*      (                                                                   */
    /*        unsigned long int a,   // Argument 1   //                         */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the single precision floating point             */
    /*      value of the input.                                                 */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */



    static inline float uintsp_i(unsigned long int x)
    {
        unsigned  rfrc, rfrc_1;
        int rexp, rexp_1; /* frc and exp of result */
        unsigned  rslt, rslt_1;
        
        rfrc = (unsigned) x;

        rexp = _lmbd(1, rfrc ) ; /* no of consecutive 0 MSBs */

        rfrc_1 = rfrc << rexp;
        rexp_1 = 127  + 32 - 2 - rexp;

       /* align for mantissa field and round */
            rslt = (unsigned )(((rfrc_1 >> ((32 - 23 -1)-1)) +1) >> 1);

       /*------------------------------------------------------------------------*/
       /* The exponent field in rfrc now holds 1 or maybe 2 if the fraction */
       /* rounded up.  ADD in rexp to simultaneously combine exponent/fraction */
       /* and also increment the exponent by the appropriate amount.  */
       /*------------------------------------------------------------------------*/
        rslt_1 = rslt + (((unsigned )rexp_1) << 23) ;
        if((unsigned )x == 0)
            rslt_1 = 0;

        return _itof(rslt_1);


    }

    /* ======================================================================== */
    /*  End of file: uintsp_i.h                                                 */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */
    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      spint -- 32-bit IEEE-754 SP Floating Point -> 32-bit Signed         */
    /*      Integer                                                             */
    /*                                                                          */
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      int spint_i                                                         */
    /*      (                                                                   */
    /*        float a,   // Argument 1   //                                     */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the integer value of the 32-bit                 */
    /*      single precision input.                                             */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */



    static inline int spint_i(float x)
    {

        int  rslt;
        unsigned  rfrc, rfrc_0, rfrc_1;
        int rexp, rexp_1;   /* frac and exp of result */
        int flag_zero;

        (rfrc_0)=_ftoi(x);
        rfrc = rfrc_0 & ~(((unsigned)1)<<(32-1));
        flag_zero = rfrc;
        rexp = (int)(rfrc >> 23 );
        rfrc_1 = (rfrc & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32));    /* insert hidden bit */
        rexp_1 = 127 + 32 - 1 - rexp;

        rslt = rfrc_1;
        rslt = (unsigned )(rslt << (32  - 23 -1)) >> rexp_1;
        if (rfrc_0 & (((unsigned)1)<<(32-1)))
            rslt = ~rslt + 1;

        if (rexp_1 <= 0) /* overflow */
               rslt = 2147483647 ;

        if ((rfrc_0 & (((unsigned)1)<<(32-1))) && (rexp_1 <= 0))
            rslt = ~rslt ; // INT_MIN = -INT_MAX-1
           
        if(flag_zero == 0 | rexp_1 >= 32)   /* underflow */
            rslt = 0;

        return rslt;
    }

    /* ======================================================================== */
    /*  End of file: spint_i.h                                                  */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */
    /* ======================================================================== */
    /*  TEXAS INSTRUMENTS, INC.                                                 */
    /*                                                                          */
    /*  NAME                                                                    */
    /*      spuint -- 32-bit IEEE-754 SP Floating Point -> 32-bit Unsigned      */
    /*      Integer                                                             */
    /*                                                                          */
    /*  USAGE                                                                   */
    /*      This function is C callable, and is called according to this        */
    /*      C prototype:                                                        */
    /*                                                                          */
    /*      unsigned int spuint_i                                               */
    /*      (                                                                   */
    /*        float a,   // Argument 1   //                                     */
    /*      );                                                                  */
    /*                                                                          */
    /*  DESCRIPTION                                                             */
    /*      This kernel returns the integer value of the 32-bit                 */
    /*      single precision input.                                             */
    /*                                                                          */
    /*  TECHNIQUES                                                              */
    /*                                                                          */
    /*  SOURCE                                                                  */
    /* ------------------------------------------------------------------------ */
    /*            Copyright (c) 2008 Texas Instruments, Incorporated.           */
    /*                           All Rights Reserved.                           */
    /* ======================================================================== */



    static inline unsigned int spuint_i(float x)
    {

        unsigned  rslt;
        unsigned  rfrc, rfrc_0, rfrc_1;
        int rexp, rexp_1;   /* frac and exp of result */

        (rfrc_0)=_ftoi(x);
     
        rfrc = rfrc_0 & ~(((unsigned)1)<<(32-1));
        rexp = (int) (rfrc >> 23);
        
        rfrc_1 = (rfrc & ((((int)1)<< (23 % 32))-1)) + (((int)1)<< (23 % 32));    /* insert hidden bit */
        rexp_1 = 127  + 32 - 1 - rexp;

        rslt = (rfrc_1 << (32 - 23 -1)) >> rexp_1;
     
        if (rexp_1 < 0)
        { /* overflow  */
            rslt = 4294967295U ;
        }

        if (rfrc_0 & (((unsigned)1)<<(32-1)))
        {
            rslt = ~rslt + 1;            
            if((rexp_1 < 0))
                rslt = (unsigned )(-2147483647-1) ;
            if((int)rslt < 0)
                rslt = (unsigned )(-2147483647-1) ;
        }    
          if((rexp == 0) | (rexp_1 >= 32)) /* underflow */
            rslt = (unsigned )0;
        
        return rslt;


    }

    /* ======================================================================== */
    /*  End of file: spuint_i.h                                                 */
    /* ------------------------------------------------------------------------ */
    /*          Copyright (C) 2008 Texas Instruments, Incorporated.             */
    /*                          All Rights Reserved.                            */
    /* ======================================================================== */
    /****************************************************************************/
    /*  sqrtsp_i.h          v6.0.8                                                 */
    /*  Copyright (c) 1997-2006  Texas Instruments Incorporated                 */
    /****************************************************************************/
     

    /* ======================================================================== */
    /*S Created By Prashanth Viswanath 08-22-08                                S*/
    /* ======================================================================== */




    static inline float sqrtsp_i(float x)
    {
        float    f, y, z, y1;
        int      e;
        float a, b;
        int uy, ux, e1, n;
            
    //    zero_flag = x;   

        b=((x));
        ux = _ftoi(b); /* Required to extract the exponent */
        e = ((ux >> (32 - (8 +1) )) & ((1<< 8 )-1) ); /* get the exponent */
        if (e == 0) /* +/- ZERO or denormalized? */
        {
     
            b = mpysp_i(x,(16777216.0f) );  /* its not denormalized now! */
           
            ux = _ftoi(b);
           
            e = ((ux >> (32 - (8 +1) )) & ((1<< 8 )-1) ) - 24 ;
               
            if (_eqlf(b,(0.0f))) {
                f = x;
            } /* +/- ZERO */

        }
        else if (e == ((1<< 8 )-1) ) { /* infinities and NAN's */
            if (_lssf(b,(-3.402823466E+38f))) {
                 errno = 1;
                 b=((-3.402823466E+38f));
            }
            else if (_gtrf(b,(3.402823466E+38f))) {
                 errno = 1;
                b=((3.402823466E+38f));
             }
             else{
                 errno = 1;
                 b = (0.0f);
             }
             
         }
         e -= (127 -1) ;
         b = _itof((ux & ((1<<(32 -1))+(1<<(23 % 32 ))-1) ) | /* out with the old ...*/
                    ((127 -1)  << (32 - (8 +1) )));       /* and in with the new */
        
         f = b;

        /* First form an estimate of the inverse-square-root.                */
        /* The accuracy of the estimate determines the number of required    */
        /* Newton iterations to compute the required n-bit mantissa result.  */
        /* Given a number expressed as x = f* 2**e, an estimate of 1/SQRT(x),*/
        /* may be computed as:                                               */
        /*   1/SQRT(x)                                                       */
        /* = 1/SQRT(f * 2**e)                                                */
        /* = 1/SQRT(f)      * 1/SQRT(2**e)                                   */
        /*~= (C1*f + C2)    * 1/SQRT(2**(e & 1)) * 1/SQRT(2**(e-(e & 1)))    */
        /* = (C1*f + C2)    * 1/SQRT(2**(e & 1)) * (2**-((e-(e & 1))/2))     */
        /* = (C1*f + C2)    * 1/SQRT(2**(e & 1)) * (2**-((e-(e & 1))/2)-1)*2 */
        /* = (C1*f + C2)    * 1/SQRT(2**(e & 1)) * (2**-((e-(e & 1))/2)-1)*2 */
        /* = 2*(C1*f + C2)  * 1/SQRT(2**(e & 1)) * (2**-((e-(e & 1))/2)-1)   */
        /* =(2*C1*f + 2*C2) * 1/SQRT(2**(e & 1)) * (2**-((e-(e & 1))/2)-1)   */
        /* =(2*C1*f + 2*C2) * {1 or 1/SQRT(2)}   * (2**-((e-(e & 1))/2)-1)   */
        /* .5 <= f < 1, we need 1 <= f < 2, so... */
        /* e = e - 1  ; -- moved below.  Maybe CPU has LSB test as byproduct. */
        /* f = f * 2.0; -- subsumed into calculation below */

        f = mpysp_i((-1.145508f) ,f);
        f = addsp_i(f,(2.528320f));
        e -= 1;
        if (e & 1)
        {
            e -= 1;
            f = mpysp_i(f, (0.70710678118654752440f));
        }
     /* note: last use of "e" */
        n = ~(e >> 1);
        a=(f);
        uy = (int)_ftoi(a);
        e1 = ((uy >> (32 - (8 +1) )) & ((1<< 8 )-1) );
        a = _itof((uy & ((1<<(32 -1))+(1<<(23 % 32 ))-1) ) |              /* out with the old ...*/
            ((e1+n) << (32 - (8 +1) )));    /* and in with the new */
        if (n > 128 + (127 - 1) - e1)
        {
            errno = 2;
            a=(((_geqf(f,(0.0f))) ? (3.402823466E+38f) : (-3.402823466E+38f) ));

            y = a;
        }
        
        if (n < (-125) + (127 -1) - e1) { /* underflow or denormalized? */
                      /* resulting number will be denormalized */
            a = _itof((uy & ((1<<(32 -1))+(1<<(23 % 32 ))-1) ) |                /* out with the old...*/
                 ((e1+n+ 24 )<<(32 - (8 +1) )));/* in with (some) new.*/
            y = mpysp_i(a,(5.9604644753E-8f));
            if (n < (-125) -(24 -1)+ (127 -1) - e1) /* underflow? */
                 a = (0.0f);
             /* MPYF will underflow if target does not support denormalized nos. */
        }
        y = a;
        if (e1 == 0)
        {
            if (_eqlf(f,(0.0f)))
                y = f;
            y = mpysp_i(f,(16777216.0f));
            uy = (int) _ftoi(y);
            e1 = ((uy >> (32 -(8+1))) & ((1 << 8)-1 )) - 24;
        }
        else if (e1 == ((1<<8)-1))
            y = f;

        /* Estimate of 1/sqrt in y now good to about 5 mantissa bits. */
        /* Refine estimate with Newton iterations.                    */
        /* Do one less newton iterations than is required.            */
        /* Accuracy roughly doubles each time through the loop.       */
        /* Haven't determined actual accuracy vs. iterations yet.     */
        /* Thresholds on loop choices are thus overly conservative.   */
        /* Note: Cannot square y below for reasons of over/under-flow.*/
        /* y = y+y*(0.5-((x*y)*0.5)*y); */
            y1 = mpysp_i(x,y);
            y1 = mpysp_i((0.5f),y1);
            y1 = mpysp_i(y1,y);
            y1 = subsp_i((0.5f),y1);
            y1 = mpysp_i(y1,y);
            y = addsp_i(y,y1);

            y1 = mpysp_i(x,y);
            y1 = mpysp_i((0.5f),y1);
            y1 = mpysp_i(y1,y);
            y1 = subsp_i((0.5f),y1);
            y1 = mpysp_i(y1,y);
            y = addsp_i(y,y1);

        z = mpysp_i(x,y);

           /* Here's the last iteration! */
           /* return z+z*(0.5-((x*y)*0.5)*y); */

        y1 = mpysp_i(x,y);
        y1 = mpysp_i((0.5f),y1);
        y1 = mpysp_i(y1,y);
        y1 = subsp_i((0.5f),y1);
        y1 = mpysp_i(y1,z);
        z = addsp_i(z,y1);
        if(x <= 0)
            z = 0;  
        return z;
     
    } /* SQRTF */


        /* ======================================================================== */
        /*  End of file: sqrtsp_i.h                                                 */
        /* ------------------------------------------------------------------------ */
        /*          Copyright (C) 2002 Texas Instruments, Incorporated.             */
        /*                          All Rights Reserved.                            */
        /* ======================================================================== */





    void prcss(
        float  * restrict ox,
        float  *  restrict oy,
        const float ix,
        const float iy,
        const float l[])
    {
        float x = 0.0f;
        float y = 0.0f;

        float R2 = mpysp_i(l[7] ,l[7] ); //FAST
        float R4 = mpysp_i(R2, R2);
        float R6 = mpysp_i(R4, R2);
        float B1_2 =  addsp_i((float)l[3],(float) l[3]);
        float B2_2 =addsp_i((float)l[4] ,(float)l[4]);
        float factor2 = mpysp_i(ix , iy);
        float factor3 = mpysp_i(ix , ix);
        float factor4 = mpysp_i(iy , iy);
        float factor1 = addsp_i(factor3 , factor4);
        float factor5 = mpysp_i(factor1, factor1);
        float factor6 = mpysp_i(factor5 , factor1);
      x = addsp_i(ix, factor5);
      y = addsp_i(iy, factor6);

        float factor7 =
           addsp_i(
                   mpysp_i(
                       subsp_i(factor1,R2) ,
                       l[0]  
                   ),
                addsp_i(   
                    mpysp_i(
                        subsp_i(factor5, R4),
                        l[1]
                    ),  
                    mpysp_i(
                        subsp_i(factor6, R6),
                        l[2]
                    )
                )
            );

      x = mpysp_i(ix, factor7);
      y = mpysp_i(iy, factor7);

      x =         
            addsp_i(
                  x,     
                  addsp_i(
                    mpysp_i(
                        addsp_i(
                            addsp_i(factor3, factor3),
                            factor1),
                        l[3]  ),
                      mpysp_i(factor2, B2_2))
            )
          ;
      y =                 
            addsp_i(
                  y,
                  addsp_i (    
                          mpysp_i(
                              addsp_i(
                                  addsp_i(factor4, factor4),
                                  factor1),
                              l[4] ),
                          mpysp_i(factor2, B1_2))
            )
              ;
      x =
            addsp_i(
                  x,
                  addsp_i( mpysp_i(ix, l[5]), mpysp_i( iy, l[6]) ))  ;
        x = addsp_i(x, l[8] );
        y = addsp_i(y, l[9]);

        *ox = x;
        *oy = y;
        return;
    }


    float e[]={1.10001f, 2.2f, 0.02f, 0.03f, 0.04, 0.05f, 0.06f, 0.07f, 0.08f, 0.09f };
    int main()
    {
     float a,b,c,d;
      a=10.f;
      b=20.f;
      c = mpysp_i(a,b);
      d = addsp_i(a,b);
      printf("c=%f d=%f\n",c,d);
      prcss(&a,&b,1.0f,2.0f,e);
      printf("%f %f\n",a,b);
      return 0;
    }

    ===

    .pjt

    ===

    ; Code Composer Project File, Version 2.0 (do not modify or remove this line)

    [Project Settings]
    ProjectDir="C:\fastRTS_c62xc64x_1_42_INTRINSICS_TEST_2012-03-04_0310\c6400\C_fastRTS\example\"
    ProjectType=Executable
    CPUFamily=TMS320C64XX
    Tool="Compiler"
    Tool="CustomBuilder"
    Tool="DspBiosBuilder"
    Tool="Linker"
    Config="Release"

    [Source Files]
    Source="C:\CCStudio_v3.3\C6000\cgtools\lib\rts64plus.lib"
    Source="inline_usage.c"
    Source="link.cmd"

    ["Compiler" Settings: "Release"]
    Options=-g -os -o3 -fr"$(Proj_dir)\Release" -fs"$(Proj_dir)\Release" -ft"$(Proj_dir)\Release" -i"../include/" -d"INLINE_C" -mt -mw -mh64 -mi1000 -mr1 -mv6400+ --mem_model:data=near --preproc_with_comment --preproc_with_compile

    ["Linker" Settings: "Release"]
    Options=-c -m".\Release\Test_case.map" -o".\Release\Test_case.out" -w -x

    ["inline_usage.c" Settings: "Release"]
    Options="Compiler" +{-k -al -o1} -{-g -o3}

    ["link.cmd" Settings: "Release"]
    LinkOrder=1



  • As inline candidates, those functions are quite large.  I wouldn't be surprised if the optimizer concluded that the code size growth was likely to be unacceptable.

  • There are things you can do to increase the number of times addsp_i is inlined.  

    General changes to your build options ... Always use -o3.  I think you are, but I don't know enough about CCS project file formats to be sure.  Always use -on2.  This creates a file, extension .nfo, with all sorts of information about the code optimization.  Do not use -g.  This inhibits optimization generally.  I'm not sure of exactly how -g may affect inlining, but it can't be good.

    Use the --auto_inline=threshold option.  In your case, --auto_inline=175.  This says all functions of size 175 or less should be inlined.  The .nfo file shows that the size of the addsp_i function is 166.  

    Use the FUNC_ALWAYS_INLINE pragma.  Like this ...

    #pragma FUNC_ALWAYS_INLINE(addsp_i);
    float addsp_i(float left, float right) { /* code here */ }

    Be careful with this pragma.  You can easily create a really huge function which never finishes building.  

    You'll have to experiment with these options to see which works best for your case.  Please read up on these options in the C6000 Compiler manual.  

    Thanks and regards,

    -George