1 /* ======================================================================= */
2 /* TEXAS INSTRUMENTS, INC. */
3 /* */
4 /* DSPLIB DSP Signal Processing Library */
5 /* */
6 /* This library contains proprietary intellectual property of Texas */
7 /* Instruments, Inc. The library and its source code are protected by */
8 /* various copyrights, and portions may also be protected by patents or */
9 /* other legal protections. */
10 /* */
11 /* This software is licensed for use with Texas Instruments TMS320 */
12 /* family DSPs. This license was provided to you prior to installing */
13 /* the software. You may review this license by consulting the file */
14 /* TI_license.PDF which accompanies the files in this library. */
15 /* */
16 /* ----------------------------------------------------------------------- */
17 /* */
18 /* DSP_add16.c -- Intrinsic C Implementation */
19 /* */
20 /* REV 0.0.1 */
21 /* */
22 /* USAGE */
23 /* This routine has the following C prototype: */
24 /* */
25 /* void DSP_add16 ( */
26 /* const int *x, // Input array of length nx */
27 /* const int *y, // Input array of length nx */
28 /* int *restrict r, // Output array of length nx */
29 /* int nx // Number of elements. */
30 /* ); */
31 /* */
32 /* This routine performs a 16-bit by 16-bit addition. */
33 /* */
34 /* ASSUMPTIONS */
35 /* nx > = 4 and is a multiple of 8 */
36 /* The Kernel assumes the input and output arrays are aligned to a */
37 /* 8 byte booundary. */
38 /* */
39 /* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ */
40 /* */
41 /* */
42 /* Redistribution and use in source and binary forms, with or without */
43 /* modification, are permitted provided that the following conditions */
44 /* are met: */
45 /* */
46 /* Redistributions of source code must retain the above copyright */
47 /* notice, this list of conditions and the following disclaimer. */
48 /* */
49 /* Redistributions in binary form must reproduce the above copyright */
50 /* notice, this list of conditions and the following disclaimer in the */
51 /* documentation and/or other materials provided with the */
52 /* distribution. */
53 /* */
54 /* Neither the name of Texas Instruments Incorporated nor the names of */
55 /* its contributors may be used to endorse or promote products derived */
56 /* from this software without specific prior written permission. */
57 /* */
58 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
59 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
60 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
61 /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
62 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
63 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
64 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
65 /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
66 /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
67 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
68 /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
69 /* */
70 /* ======================================================================= */
72 #pragma CODE_SECTION(DSP_add16, ".text:optimized");
74 #include "DSP_add16.h"
76 void DSP_add16 (
77 short * restrict x, /* Input array of length nx */
78 short * restrict y, /* Input array of length nx */
79 short * restrict r, /* Output array of length nx */
80 int nx /* Number of elements. */
81 )
82 {
83 int i;
85 _nassert(((int)x & 7) ==0);
86 _nassert(((int)y & 7) ==0);
87 _nassert(((int)r & 7) ==0);
88 #pragma MUST_ITERATE(8,,8);
89 #pragma UNROLL(8);
91 for(i=0; i<nx; i++) {
92 r[i] = x[i] + y[i];
93 }
94 }
96 /* ======================================================================== */
97 /* End of file: DSP_add16.c */
98 /* ------------------------------------------------------------------------ */
99 /* Copyright (c) 2011 Texas Instruments, Incorporated. */
100 /* All Rights Reserved. */
101 /* ======================================================================== */