]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core/src/Ref_cm4_simd.txt
Updated CMSIS Core documentation.
[cmsis] / CMSIS / DoxyGen / Core / src / Ref_cm4_simd.txt
1 /* ######################  CMSIS Support for Cortex-M4 SIMD Instructions  ####################### */\r
2 /** \r
3 \r
4 \defgroup  intrinsic_SIMD_gr  Intrinsic Functions for SIMD Instructions [only Cortex-M4 and Cortex-M7]\r
5 \brief     Access to dedicated SIMD instructions.\r
6 \r
7 \details\r
8 \r
9 <b>Single Instruction Multiple Data (SIMD)</b> extensions are provided <b>only for Cortex-M4 and Cortex-M7 cores</b>\r
10 to simplify development of application software. SIMD extensions increase the processing capability \r
11 without materially increasing the power consumption. The SIMD extensions are completely transparent \r
12 to the operating system (OS), allowing existing OS ports to be used.  \r
13 \r
14 <b>SIMD Features:</b>\r
15 \r
16  - Simultaneous computation of 2x16-bit or 4x8-bit operands\r
17  - Fractional arithmetic\r
18  - User definable saturation modes (arbitrary word-width)\r
19  - Dual 16x16 multiply-add/subtract 32x32 fractional MAC\r
20  - Simultaneous 8/16-bit select operations\r
21  - Performance up to 3.2 GOPS at 800MHz\r
22  - Performance is achieved with a "near zero" increase in power consumption on a typical implementation\r
23 \r
24 \b Examples:\r
25 \r
26 \b Addition: Add two values using SIMD function\r
27 \r
28 \code\r
29 uint32_t add_halfwords(uint32_t val1, uint32_t val2)\r
30 {\r
31   return __SADD16(val1, val2);\r
32 }\r
33 \endcode\r
34 \r
35 \r
36 \r
37 \b Subtraction: Subtract two values using SIMD function\r
38 \r
39 \code\r
40 uint32_t sub_halfwords(uint32_t val1, uint32_t val2)\r
41 {\r
42   return __SSUB16(val1, val2);\r
43 }\r
44 \endcode\r
45 \r
46 \r
47 \b Multiplication: Performing a multiplication using SIMD function\r
48 \r
49 \code\r
50 uint32_t dual_mul_add_products(uint32_t val1, uint32_t val2)\r
51 {\r
52   return __SMUAD(val1, val2);\r
53 }\r
54 \endcode\r
55 \r
56  @{\r
57 */\r
58 \r
59 \r
60 /**************************************************************************************************/\r
61 /**\r
62     \brief      GE setting quad 8-bit signed addition\r
63     \details     This function performs four 8-bit signed integer additions.\r
64           The GE bits of the APSR are set according to the results of the additions.\r
65     \param      val1    first four 8-bit summands.\r
66     \param      val2    second four 8-bit summands.\r
67 \r
68     \returns\r
69             \li the addition of the first bytes from each operand, in the first byte of the return value.\r
70             \li the addition of the second bytes of each operand, in the second byte of the return value.\r
71             \li the addition of the third bytes of each operand, in the third byte of the return value.\r
72             \li the addition of the fourth bytes of each operand, in the fourth byte of the return value.\r
73         \par\r
74             Each bit in APSR.GE is set or cleared for each byte in the return value, depending on \r
75              the results of the operation.\r
76         \par\r
77             If \em res is the return value, then:\r
78             \li if res[7:0] \>= 0 then APSR.GE[0] = 1 else 0\r
79             \li if res[15:8] \>= 0 then APSR.GE[1] = 1 else 0\r
80             \li if res[23:16] \>= 0 then APSR.GE[2] = 1 else 0\r
81             \li if res[31:24] \>= 0 then APSR.GE[3] = 1 else 0\r
82 \r
83     \par Operation:\r
84         \code\r
85    res[7:0]   = val1[7:0]   + val2[7:0] \r
86    res[15:8]  = val1[15:8]  + val2[15:8] \r
87    res[23:16] = val1[23:16] + val2[23:16] \r
88    res[31:24] = val1[31:24] + val2[31:24]          \r
89         \endcode\r
90 */\r
91 uint32_t __SADD8(uint32_t val1, uint32_t val2);\r
92 \r
93 \r
94 /**************************************************************************************************/\r
95 /** \ingroup    Intrinsic_SIMD_gr  \r
96     \brief      Q setting quad 8-bit saturating addition\r
97     \details     This function enables you to perform four 8-bit integer additions, saturating the results to \r
98           the 8-bit signed integer range -2<sup>7</sup> \<= x \<= 2<sup>7</sup> - 1.\r
99     \param      val1    first four 8-bit summands.\r
100     \param      val2    second four 8-bit summands.\r
101 \r
102     \returns\r
103             \li the saturated addition of the first byte of each operand in the first byte of the return value.\r
104             \li the saturated addition of the second byte of each operand in the second byte of the return value.\r
105             \li the saturated addition of the third byte of each operand in the third byte of the return value.\r
106             \li the saturated addition of the fourth byte of each operand in the fourth byte of the return value.\r
107         \par\r
108             The returned results are saturated to the 16-bit signed integer range -2<sup>7</sup> \<= x \<= 2<sup>7</sup> - 1.\r
109 \r
110     \par Operation:\r
111         \code\r
112    res[7:0]   = val1[7:0]   + val2[7:0] \r
113    res[15:8]  = val1[15:8]  + val2[15:8] \r
114    res[23:16] = val1[23:16] + val2[23:16] \r
115    res[31:24] = val1[31:24] + val2[31:24]          \r
116         \endcode\r
117 */\r
118 uint32_t __QADD8(uint32_t val1, uint32_t val2);\r
119 \r
120 \r
121 /**************************************************************************************************/\r
122 /** \r
123     \brief      Quad 8-bit signed addition with halved results\r
124     \details     This function enables you to perform four signed 8-bit integer additions, halving the results.\r
125     \param      val1    first four 8-bit summands.\r
126     \param      val2    second four 8-bit summands.\r
127 \r
128     \returns\r
129             \li the halved addition of the first bytes from each operand, in the first byte of the return value.\r
130             \li the halved addition of the second bytes from each operand, in the second byte of the return value.\r
131             \li the halved addition of the third bytes from each operand, in the third byte of the return value.\r
132             \li the halved addition of the fourth bytes from each operand, in the fourth byte of the return value.\r
133 \r
134     \par Operation:\r
135         \code\r
136    res[7:0]   = val1[7:0]   + val2[7:0]  >> 1\r
137    res[15:8]  = val1[15:8]  + val2[15:8] >> 1\r
138    res[23:16] = val1[23:16] + val2[23:16] >> 1\r
139    res[31:24] = val1[31:24] + val2[31:24] >> 1         \r
140         \endcode\r
141 */\r
142 uint32_t __SHADD8(uint32_t val1, uint32_t val2);\r
143 \r
144 \r
145 /**************************************************************************************************/\r
146 /** \ingroup    Intrinsic_SIMD_gr  \r
147     \brief      GE setting quad 8-bit unsigned addition\r
148     \r
149     \details    This function enables you to perform four unsigned 8-bit integer additions.\r
150                 The GE bits of the APSR are set according to the results. \r
151                 \r
152     \param      val1    first four 8-bit summands for each addition.\r
153     \param      val2    second four 8-bit summands for each addition.\r
154 \r
155     \returns\r
156             \li the halved addition of the first bytes from each operand, in the first byte of the return value.\r
157             \li the halved addition of the second bytes from each operand, in the second byte of the return value.\r
158             \li the halved addition of the third bytes from each operand, in the third byte of the return value.\r
159             \li the halved addition of the fourth bytes from each operand, in the fourth byte of the return value.\r
160             \r
161     \par    \r
162             Each bit in APSR.GE is set or cleared for each byte in the return value, depending on the results of the operation.\r
163     \r
164     \par    \r
165             If \em res is the return value, then: \r
166             \li if res[7:0] \>= 0x100 then APSR.GE[0] = 1 else 0\r
167             \li if res[15:8] \>= 0x100 then APSR.GE[1] = 1 else 0\r
168             \li if res[23:16] \>= 0x100 then APSR.GE[2] = 1 else 0\r
169             \li if res[31:24] \>= 0x100 then APSR.GE[3] = 1 else 0\r
170 \r
171     \par Operation:\r
172         \code\r
173    res[7:0]   = val1[7:0]   + val2[7:0] \r
174    res[15:8]  = val1[15:8]  + val2[15:8]\r
175    res[23:16] = val1[23:16] + val2[23:16]\r
176    res[31:24] = val1[31:24] + val2[31:24]\r
177         \endcode\r
178 */\r
179 uint32_t __UADD8(uint32_t val1, uint32_t val2);\r
180 \r
181 \r
182 /**************************************************************************************************/\r
183 /** \r
184     \brief      Quad 8-bit unsigned saturating addition\r
185     \r
186     \details    This function enables you to perform four unsigned 8-bit integer additions, saturating the \r
187            results to the 8-bit unsigned integer range 0 \< x \< 2<sup>8</sup> - 1.\r
188                 \r
189     \param      val1    first four 8-bit summands.\r
190     \param      val2    second four 8-bit summands.\r
191 \r
192     \returns\r
193             \li the halved addition of the first bytes in each operand, in the first byte of the return value.\r
194             \li the halved addition of the second bytes in each operand, in the second byte of the return value.\r
195             \li the halved addition of the third bytes in each operand, in the third byte of the return value.\r
196             \li the halved addition of the fourth bytes in each operand, in the fourth byte of the return value.\r
197             \r
198     \par    \r
199             The results are saturated to the 8-bit unsigned integer range 0 \< x \< 2<sup>8</sup> - 1.\r
200 \r
201     \par Operation:\r
202         \code\r
203    res[7:0]   = val1[7:0]   + val2[7:0] \r
204    res[15:8]  = val1[15:8]  + val2[15:8]\r
205    res[23:16] = val1[23:16] + val2[23:16]\r
206    res[31:24] = val1[31:24] + val2[31:24]\r
207         \endcode\r
208 */\r
209 uint32_t __UQADD8(uint32_t val1, uint32_t val2);\r
210 \r
211 \r
212 /**************************************************************************************************/\r
213 /** \r
214     \brief      Quad 8-bit unsigned addition with halved results\r
215     \r
216     \details    This function enables you to perform four unsigned 8-bit integer additions, halving the results.\r
217                 \r
218     \param      val1    first four 8-bit summands.\r
219     \param      val2    second four 8-bit summands.\r
220 \r
221     \returns\r
222             \li the halved addition of the first bytes in each operand, in the first byte of the return value.\r
223             \li the halved addition of the second bytes in each operand, in the second byte of the return value.\r
224             \li the halved addition of the third bytes in each operand, in the third byte of the return value.\r
225             \li the halved addition of the fourth bytes in each operand, in the fourth byte of the return value.\r
226             \r
227     \par Operation:\r
228         \code\r
229    res[7:0]   = val1[7:0]   + val2[7:0]   >> 1\r
230    res[15:8]  = val1[15:8]  + val2[15:8]  >> 1\r
231    res[23:16] = val1[23:16] + val2[23:16] >> 1\r
232    res[31:24] = val1[31:24] + val2[31:24] >> 1\r
233         \endcode\r
234 */\r
235 uint32_t __UHADD8(uint32_t val1, uint32_t val2);\r
236 \r
237 \r
238 /**************************************************************************************************/\r
239 /** \r
240     \brief      GE setting quad 8-bit signed subtraction\r
241     \r
242     \details    This function enables you to perform four 8-bit signed integer subtractions.<br>\r
243                 The GE bits in the APSR are set according to the results.\r
244                 \r
245     \param      val1    first four 8-bit  operands of each subtraction.\r
246     \param      val2    second four 8-bit  operands of each subtraction.\r
247 \r
248     \returns\r
249             \li the subtraction of the first byte in the second operand from the first byte in the \r
250                 first operand, in the first bytes of the return value.\r
251             \li the subtraction of the second byte in the second operand from the second byte in \r
252                 the first operand, in the second byte of the return value.\r
253             \li the subtraction of the third byte in the second operand from the third byte in the \r
254                 first operand, in the third byte of the return value.\r
255             \li the subtraction of the fourth byte in the second operand from the fourth byte in \r
256                 the first operand, in the fourth byte of the return value.\r
257 \r
258         \par    Each bit in APSR.GE is set or cleared for each byte in the return value, depending on \r
259              the results of the operation. \r
260              \r
261         \par\r
262             If \em res is the return value, then:\r
263             \li if res[8:0] \>= 0 then APSR.GE[0] = 1 else 0\r
264             \li if res[15:8] \>= 0 then APSR.GE[1] = 1 else 0\r
265             \li if res[23:16] \>= 0 then APSR.GE[2] = 1 else 0\r
266             \li if res[31:24] \>= 0 then APSR.GE[3] = 1 else 0\r
267 \r
268 \r
269     \par Operation:\r
270         \code\r
271    res[7:0]   = val1[7:0]   - val2[7:0] \r
272    res[15:8]  = val1[15:8]  - val2[15:8]\r
273    res[23:16] = val1[23:16] - val2[23:16]\r
274    res[31:24] = val1[31:24] - val2[31:24]\r
275         \endcode\r
276 */\r
277 uint32_t __SSUB8(uint32_t val1, uint32_t val2);\r
278 \r
279 \r
280 /**************************************************************************************************/\r
281 /** \r
282     \brief      Q setting quad 8-bit saturating subtract\r
283     \r
284     \details    This function enables you to perform four 8-bit integer subtractions, saturating the results \r
285           to the 8-bit signed integer range -2<sup>7</sup> \<= x \<= 2<sup>7</sup> - 1.\r
286                 \r
287     \param      val1    first four 8-bit  operands.\r
288     \param      val2    second four 8-bit  operands.\r
289 \r
290     \returns\r
291             \li the subtraction of the first byte in the second operand from the first byte in the \r
292                 first operand, in the first bytes of the return value.\r
293             \li the subtraction of the second byte in the second operand from the second byte in \r
294                 the first operand, in the second byte of the return value.\r
295             \li the subtraction of the third byte in the second operand from the third byte in the \r
296                 first operand, in the third byte of the return value.\r
297             \li the subtraction of the fourth byte in the second operand from the fourth byte in \r
298                 the first operand, in the fourth byte of the return value.\r
299 \r
300         \par    \r
301             The returned results are saturated to the 8-bit signed integer range -2<sup>7</sup> \<= x \<= 2<sup>7</sup> - 1. \r
302              \r
303             \r
304     \par Operation:\r
305         \code\r
306    res[7:0]   = val1[7:0]   - val2[7:0] \r
307    res[15:8]  = val1[15:8]  - val2[15:8]\r
308    res[23:16] = val1[23:16] - val2[23:16]\r
309    res[31:24] = val1[31:24] - val2[31:24]\r
310         \endcode\r
311 */\r
312 uint32_t __QSUB8(uint32_t val1, uint32_t val2);\r
313 \r
314 \r
315 /**************************************************************************************************/\r
316 /** \r
317     \brief      Quad 8-bit signed subtraction with halved results\r
318     \r
319     \details    This function enables you to perform four signed 8-bit integer subtractions, halving the \r
320      results.\r
321                 \r
322     \param      val1    first four 8-bit  operands.\r
323     \param      val2    second four 8-bit  operands.\r
324 \r
325     \returns\r
326             \li the halved subtraction of the first byte in the second operand from the first byte in the \r
327                 first operand, in the first bytes of the return value.\r
328             \li the halved subtraction of the second byte in the second operand from the second byte in \r
329                 the first operand, in the second byte of the return value.\r
330             \li the halved subtraction of the third byte in the second operand from the third byte in the \r
331                 first operand, in the third byte of the return value.\r
332             \li the halved subtraction of the fourth byte in the second operand from the fourth byte in \r
333                 the first operand, in the fourth byte of the return value.\r
334             \r
335     \par Operation:\r
336         \code\r
337    res[7:0]   = val1[7:0]   - val2[7:0]   >> 1\r
338    res[15:8]  = val1[15:8]  - val2[15:8]  >> 1\r
339    res[23:16] = val1[23:16] - val2[23:16] >> 1\r
340    res[31:24] = val1[31:24] - val2[31:24] >> 1\r
341         \endcode\r
342 */\r
343 uint32_t __SHSUB8(uint32_t val1, uint32_t val2);\r
344 \r
345 \r
346 /**************************************************************************************************/\r
347 /** \r
348     \brief      GE setting quad 8-bit unsigned subtract\r
349     \r
350     \details    This function enables you to perform four 8-bit unsigned integer subtractions.\r
351           The GE bits in the APSR are set according to the results.\r
352                 \r
353     \param      val1    first four 8-bit  operands.\r
354     \param      val2    second four 8-bit  operands.\r
355 \r
356     \returns\r
357             \li the subtraction of the first byte in the second operand from the first byte in the \r
358                 first operand, in the first bytes of the return value.\r
359             \li the subtraction of the second byte in the second operand from the second byte in \r
360                 the first operand, in the second byte of the return value.\r
361             \li the subtraction of the third byte in the second operand from the third byte in the \r
362                 first operand, in the third byte of the return value.\r
363             \li the subtraction of the fourth byte in the second operand from the fourth byte in \r
364                 the first operand, in the fourth byte of the return value.\r
365             \r
366     \par\r
367         Each bit in APSR.GE is set or cleared for each byte in the return value, depending on \r
368              the results of the operation.\r
369              \r
370     \par \r
371         If \em res is the return value, then:\r
372             \li if res[8:0] \>= 0 then APSR.GE[0] = 1 else 0\r
373             \li if res[15:8] \>= 0 then APSR.GE[1] = 1 else 0\r
374             \li if res[23:16] \>= 0 then APSR.GE[2] = 1 else 0\r
375             \li if res[31:24] \>= 0 then APSR.GE[3] = 1 else 0\r
376         \r
377 \r
378     \par Operation:\r
379         \code\r
380    res[7:0]   = val1[7:0]   - val2[7:0]\r
381    res[15:8]  = val1[15:8]  - val2[15:8]\r
382    res[23:16] = val1[23:16] - val2[23:16]\r
383    res[31:24] = val1[31:24] - val2[31:24]\r
384         \endcode\r
385 */\r
386 uint32_t __USUB8(uint32_t val1, uint32_t val2);\r
387 \r
388 \r
389 /**************************************************************************************************/\r
390 /** \r
391     \brief      Quad 8-bit unsigned saturating subtraction\r
392     \r
393     \details    This function enables you to perform four unsigned 8-bit integer subtractions, saturating \r
394           the results to the 8-bit unsigned integer range 0 \< x \< 2<sup>8</sup> - 1.\r
395                 \r
396     \param      val1    first four 8-bit  operands.\r
397     \param      val2    second four 8-bit  operands.\r
398 \r
399     \returns\r
400             \li the subtraction of the first byte in the second operand from the first byte in the \r
401                 first operand, in the first bytes of the return value.\r
402             \li the subtraction of the second byte in the second operand from the second byte in \r
403                 the first operand, in the second byte of the return value.\r
404             \li the subtraction of the third byte in the second operand from the third byte in the \r
405                 first operand, in the third byte of the return value.\r
406             \li the subtraction of the fourth byte in the second operand from the fourth byte in \r
407                 the first operand, in the fourth byte of the return value.\r
408             \r
409     \par\r
410         The results are saturated to the 8-bit unsigned integer range 0 \< x \< 2<sup>8</sup> - 1.\r
411 \r
412         \r
413     \par Operation:\r
414         \code\r
415    res[7:0]   = val1[7:0]   - val2[7:0]\r
416    res[15:8]  = val1[15:8]  - val2[15:8]\r
417    res[23:16] = val1[23:16] - val2[23:16]\r
418    res[31:24] = val1[31:24] - val2[31:24]\r
419         \endcode\r
420 */\r
421 uint32_t __UQSUB8(uint32_t val1, uint32_t val2);\r
422 \r
423 \r
424 /**************************************************************************************************/\r
425 /** \r
426     \brief      Quad 8-bit unsigned subtraction with halved results\r
427     \r
428     \details    This function enables you to perform four unsigned 8-bit integer subtractions, halving the \r
429      results.\r
430                 \r
431     \param      val1    first four 8-bit  operands.\r
432     \param      val2    second four 8-bit  operands.\r
433 \r
434     \returns\r
435             \li the halved subtraction of the first byte in the second operand from the first byte in the \r
436                 first operand, in the first bytes of the return value.\r
437             \li the halved subtraction of the second byte in the second operand from the second byte in \r
438                 the first operand, in the second byte of the return value.\r
439             \li the halved subtraction of the third byte in the second operand from the third byte in the \r
440                 first operand, in the third byte of the return value.\r
441             \li the halved subtraction of the fourth byte in the second operand from the fourth byte in \r
442                 the first operand, in the fourth byte of the return value.\r
443             \r
444     \par Operation:\r
445         \code\r
446    res[7:0]   = val1[7:0]   - val2[7:0]    >> 1\r
447    res[15:8]  = val1[15:8]  - val2[15:8]   >> 1\r
448    res[23:16] = val1[23:16] - val2[23:16]  >> 1\r
449    res[31:24] = val1[31:24] - val2[31:24]  >> 1\r
450         \endcode\r
451 */\r
452 uint32_t __UHSUB8(uint32_t val1, uint32_t val2);\r
453 \r
454 \r
455 /**************************************************************************************************/\r
456 /** \r
457     \brief      GE setting dual 16-bit signed addition\r
458     \r
459     \details    This function enables you to perform two 16-bit signed integer additions.<br>\r
460           The GE bits in the APSR are set according to the results of the additions.\r
461                 \r
462     \param      val1    first two 16-bit  summands.\r
463     \param      val2    second two 16-bit  summands.\r
464 \r
465     \returns\r
466             \li the addition of the low halfwords in the low halfword of the return value.\r
467             \li the addition of the high halfwords in the high halfword of the return value.\r
468             \r
469     \par \r
470         Each bit in APSR.GE is set or cleared for each byte in the return value, depending on\r
471              the results of the operation.\r
472     \par\r
473         If \em res is the return value, then:\r
474             \li if res[15:0] \>= 0 then APSR.GE[1:0] = 11 else 00\r
475             \li if res[31:16] \>= 0 then APSR.GE[3:2] = 11 else 00\r
476 \r
477 \r
478     \par Operation:\r
479         \code\r
480    res[15:0]  = val1[15:0]  + val2[15:0]\r
481    res[31:16] = val1[31:16] + val2[31:16]\r
482         \endcode\r
483 */\r
484 uint32_t __SADD16(uint32_t val1, uint32_t val2);\r
485 \r
486 \r
487 /**************************************************************************************************/\r
488 /** \r
489     \brief      Q setting dual 16-bit saturating addition\r
490     \r
491     \details    This function enables you to perform two 16-bit integer arithmetic additions in parallel, \r
492           saturating the results to the 16-bit signed integer range -2<sup>15</sup> \<= x \<= 2<sup>15</sup> - 1.\r
493                 \r
494     \param      val1    first two 16-bit  summands.\r
495     \param      val2    second two 16-bit  summands.\r
496 \r
497     \returns\r
498             \li the saturated addition of the low halfwords, in the low halfword of the return value.\r
499             \li the saturated addition of the high halfwords, in the high halfword of the return value.\r
500             \r
501     \par \r
502         The returned results are saturated to the 16-bit signed integer \r
503              range -2<sup>15</sup> \<= x \<= 2<sup>15</sup> - 1\r
504 \r
505     \par Operation:\r
506         \code\r
507    res[15:0]  = val1[15:0]  + val2[15:0]\r
508    res[31:16] = val1[31:16] + val2[31:16]\r
509         \endcode\r
510 */\r
511 uint32_t __QADD16(uint32_t val1, uint32_t val2);\r
512 \r
513 \r
514 /**************************************************************************************************/\r
515 /** \r
516     \brief      Dual 16-bit signed addition with halved results\r
517     \r
518     \details    This function enables you to perform two signed 16-bit integer additions, halving the \r
519      results.\r
520                 \r
521     \param      val1    first two 16-bit  summands.\r
522     \param      val2    second two 16-bit  summands.\r
523 \r
524     \returns\r
525             \li the halved addition of the low halfwords, in the low halfword of the return value.\r
526             \li the halved addition of the high halfwords, in the high halfword of the return value.\r
527             \r
528     \par Operation:\r
529         \code\r
530    res[15:0]  = val1[15:0]  + val2[15:0]  >> 1\r
531    res[31:16] = val1[31:16] + val2[31:16] >> 1\r
532         \endcode\r
533 */\r
534 uint32_t __SHADD16(uint32_t val1, uint32_t val2);\r
535 \r
536 \r
537 /**************************************************************************************************/\r
538 /** \r
539     \brief      GE setting dual 16-bit unsigned addition\r
540     \r
541     \details    This function enables you to perform two 16-bit unsigned integer additions.<br>\r
542           The GE bits in the APSR are set according to the results.\r
543                 \r
544     \param      val1    first two 16-bit  summands for each addition.\r
545     \param      val2    second two 16-bit  summands for each addition.\r
546 \r
547     \returns\r
548             \li the addition of the low halfwords in each operand, in the low halfword of the \r
549                 return value.\r
550             \li the addition of the high halfwords in each operand, in the high halfword of the \r
551                 return value.\r
552             \r
553     \par\r
554         Each bit in APSR.GE is set or cleared for each byte in the return value, depending on \r
555              the results of the operation.\r
556     \par\r
557         If \em res is the return value, then:\r
558             \li if res[15:0] \>= 0x10000 then APSR.GE[0] = 11 else 00\r
559             \li if res[31:16] \>= 0x10000 then APSR.GE[1] = 11 else 00\r
560         \r
561     \par Operation:\r
562         \code\r
563    res[15:0]  = val1[15:0]  + val2[15:0] \r
564    res[31:16] = val1[31:16] + val2[31:16]\r
565         \endcode\r
566 */\r
567 uint32_t __UADD16(uint32_t val1, uint32_t val2);\r
568 \r
569 \r
570 /**************************************************************************************************/\r
571 /** \r
572     \brief      Dual 16-bit unsigned saturating addition\r
573     \r
574     \details    This function enables you to perform two unsigned 16-bit integer additions, saturating the \r
575      results to the 16-bit unsigned integer range 0 \< x \< 2<sup>16</sup> - 1.\r
576                 \r
577     \param      val1    first two 16-bit  summands.\r
578     \param      val2    second two 16-bit  summands.\r
579 \r
580     \returns\r
581             \li the addition of the low halfword in the first operand and the low halfword in the \r
582                 second operand, in the low halfword of the return value.\r
583             \li the addition of the high halfword in the first operand and the high halfword in the \r
584                 second operand, in the high halfword of the return value.\r
585             \r
586     \par\r
587         The results are saturated to the 16-bit unsigned integer \r
588              range 0 \< x \< 2<sup>16</sup> - 1.\r
589         \r
590     \par Operation:\r
591         \code\r
592    res[15:0]  = val1[15:0]  + val2[15:0] \r
593    res[31:16] = val1[31:16] + val2[31:16]\r
594         \endcode\r
595 */\r
596 uint32_t __UQADD16(uint32_t val1, uint32_t val2);\r
597 \r
598 \r
599 /**************************************************************************************************/\r
600 /** \r
601     \brief      Dual 16-bit unsigned addition with halved results\r
602     \r
603     \details    This function enables you to perform two unsigned 16-bit integer additions, halving the \r
604      results.\r
605                 \r
606     \param      val1    first two 16-bit  summands.\r
607     \param      val2    second two 16-bit  summands.\r
608 \r
609     \returns\r
610             \li the halved addition of the low halfwords in each operand, in the low halfword of \r
611                 the return value.\r
612             \li the halved addition of the high halfwords in each operand, in the high halfword \r
613                 of the return value.\r
614         \r
615     \par Operation:\r
616         \code\r
617    res[15:0]  = val1[15:0]  + val2[15:0]   >> 1\r
618    res[31:16] = val1[31:16] + val2[31:16]  >> 1\r
619         \endcode\r
620 */\r
621 uint32_t __UHADD16(uint32_t val1, uint32_t val2);\r
622 \r
623 \r
624 /**************************************************************************************************/\r
625 /** \r
626     \brief      GE setting dual 16-bit signed subtraction\r
627     \r
628     \details    This function enables you to perform two 16-bit signed integer subtractions.<br>\r
629           The GE bits in the APSR are set according to the results.\r
630                 \r
631     \param      val1    first two 16-bit operands of each subtraction.\r
632     \param      val2    second two 16-bit operands of each subtraction.\r
633 \r
634     \returns\r
635             \li the subtraction of the low halfword in the second operand from the low halfword \r
636                 in the first operand, in the low halfword of the return value.\r
637             \li the subtraction of the high halfword in the second operand from the high halfword \r
638                 in the first operand, in the high halfword of the return value.\r
639         \r
640     \par \r
641         Each bit in APSR.GE is set or cleared for each byte in the return value, depending on \r
642              the results of the operation.\r
643     \par \r
644         If \li res is the return value, then:\r
645             \li if res[15:0] \>= 0 then APSR.GE[1:0] = 11 else 00\r
646             \li if res[31:16] \>= 0 then APSR.GE[3:2] = 11 else 00\r
647 \r
648         \r
649     \par Operation:\r
650         \code\r
651    res[15:0]  = val1[15:0]  - val2[15:0]\r
652    res[31:16] = val1[31:16] - val2[31:16]\r
653         \endcode\r
654 */\r
655 uint32_t __SSUB16(uint32_t val1, uint32_t val2);\r
656 \r
657 \r
658 /**************************************************************************************************/\r
659 /** \r
660     \brief      Q setting dual 16-bit saturating subtract\r
661     \r
662     \details    This function enables you to perform two 16-bit integer subtractions, saturating the \r
663           results to the 16-bit signed integer range -2<sup>15</sup> \<= x \<= 2<sup>15</sup> - 1.\r
664                 \r
665     \param      val1    first two 16-bit operands.\r
666     \param      val2    second two 16-bit operands.\r
667 \r
668     \returns\r
669             \li the saturated subtraction of the low halfword in the second operand from the low \r
670                 halfword in the first operand, in the low halfword of the returned result.\r
671             \li the saturated subtraction of the high halfword in the second operand from the high \r
672                 halfword in the first operand, in the high halfword of the returned result.\r
673         \r
674     \par \r
675         The returned results are saturated to the 16-bit signed integer \r
676              range -2<sup>15</sup> \<= x \<= 2<sup>15</sup> - 1.\r
677         \r
678     \par Operation:\r
679         \code\r
680    res[15:0]  = val1[15:0]  - val2[15:0]\r
681    res[31:16] = val1[31:16] - val2[31:16]\r
682         \endcode\r
683 */\r
684 uint32_t __QSUB16(uint32_t val1, uint32_t val2);\r
685 \r
686 \r
687 /**************************************************************************************************/\r
688 /** \r
689     \brief      Dual 16-bit signed subtraction with halved results\r
690     \r
691     \details    This function enables you to perform two signed 16-bit integer subtractions, halving the \r
692           results.\r
693                 \r
694     \param      val1    first two 16-bit operands.\r
695     \param      val2    second two 16-bit operands.\r
696 \r
697     \returns\r
698             \li the halved subtraction of the low halfword in the second operand from the low \r
699                 halfword in the first operand, in the low halfword of the returned result.\r
700             \li the halved subtraction of the high halfword in the second operand from the high \r
701                 halfword in the first operand, in the high halfword of the returned result.\r
702         \r
703         \r
704     \par Operation:\r
705         \code\r
706    res[15:0]  = val1[15:0]  - val2[15:0]   >> 1\r
707    res[31:16] = val1[31:16] - val2[31:16]  >> 1\r
708         \endcode\r
709 */\r
710 uint32_t __SHSUB16(uint32_t val1, uint32_t val2);\r
711 \r
712 \r
713 /**************************************************************************************************/\r
714 /** \r
715     \brief      GE setting dual 16-bit unsigned subtract\r
716     \r
717     \details    This function enables you to perform two 16-bit unsigned integer subtractions.<br>\r
718           The GE bits in the APSR are set according to the results.\r
719                 \r
720     \param      val1    first two 16-bit operands.\r
721     \param      val2    second two 16-bit operands.\r
722 \r
723     \returns\r
724             \li the subtraction of the low halfword in the second operand from the low halfword \r
725                 in the first operand, in the low halfword of the return value.\r
726             \li the subtraction of the high halfword in the second operand from the high halfword \r
727                 in the first operand, in the high halfword of the return value.\r
728         \r
729     \par \r
730         Each bit in APSR.GE is set or cleared for each byte in the return value, depending on\r
731              the results of the operation.\r
732         \r
733     \par\r
734         If \em res is the return value, then:\r
735             \li if res[15:0] \>= 0 then APSR.GE[1:0] = 11 else 00\r
736             \li if res[31:16] \>= 0 then APSR.GE[3:2] = 11 else 00\r
737 \r
738     \par Operation:\r
739         \code\r
740    res[15:0]  = val1[15:0]  - val2[15:0]   \r
741    res[31:16] = val1[31:16] - val2[31:16]  \r
742         \endcode\r
743 */\r
744 uint32_t __USUB16(uint32_t val1, uint32_t val2);\r
745 \r
746 \r
747 /**************************************************************************************************/\r
748 /** \r
749     \brief      Dual 16-bit unsigned saturating subtraction\r
750     \r
751     \details    This function enables you to perform two unsigned 16-bit integer subtractions, saturating \r
752           the results to the 16-bit unsigned integer range 0 \< x \< 2<sup>16</sup> - 1.\r
753                 \r
754     \param      val1    first two 16-bit operands for each subtraction.\r
755     \param      val2    second two 16-bit operands for each subtraction.\r
756 \r
757     \returns\r
758             \li the subtraction of the low halfword in the second operand from the low halfword \r
759                 in the first operand, in the low halfword of the return value.\r
760             \li the subtraction of the high halfword in the second operand from the high halfword \r
761                 in the first operand, in the high halfword of the return value.\r
762         \r
763     \par \r
764             The results are saturated to the 16-bit unsigned integer range 0 \< x \< 2<sup>16</sup> - 1.\r
765         \r
766 \r
767     \par Operation:\r
768         \code\r
769    res[15:0]  = val1[15:0]  - val2[15:0]   \r
770    res[31:16] = val1[31:16] - val2[31:16]  \r
771         \endcode\r
772 */\r
773 uint32_t __UQSUB16(uint32_t val1, uint32_t val2);\r
774 \r
775 \r
776 /**************************************************************************************************/\r
777 /** \r
778     \brief      Dual 16-bit unsigned subtraction with halved results\r
779     \r
780     \details    This function enables you to perform two unsigned 16-bit integer subtractions, halving \r
781           the results.\r
782                 \r
783     \param      val1    first two 16-bit operands.\r
784     \param      val2    second two 16-bit operands.\r
785 \r
786     \returns\r
787             \li the halved subtraction of the low halfword in the second operand from the low halfword \r
788                 in the first operand, in the low halfword of the return value.\r
789             \li the halved subtraction of the high halfword in the second operand from the high halfword \r
790                 in the first operand, in the high halfword of the return value.\r
791         \r
792 \r
793     \par Operation:\r
794         \code\r
795    res[15:0]  = val1[15:0]  - val2[15:0]   >> 1\r
796    res[31:16] = val1[31:16] - val2[31:16]  >> 1\r
797         \endcode\r
798 */\r
799 uint32_t __UHSUB16(uint32_t val1, uint32_t val2);\r
800 \r
801 \r
802 /**************************************************************************************************/\r
803 /** \r
804     \brief      GE setting dual 16-bit addition and subtraction with exchange\r
805     \r
806     \details    This function inserts an SASX instruction into the instruction stream generated by the \r
807           compiler. It enables you to exchange the halfwords of the second operand, add the high \r
808           halfwords and subtract the low halfwords.<br>\r
809           The GE bits in the APRS are set according to the results.\r
810                 \r
811     \param      val1    first operand for the subtraction in the low halfword, and the\r
812               first operand for the addition in the high halfword.\r
813     \param      val2    second operand for the subtraction in the high halfword, and the \r
814               second operand for the addition in the low halfword.\r
815               \r
816     \returns\r
817             \li the subtraction of the high halfword in the second operand from the low halfword \r
818                 in the first operand, in the low halfword of the return value.\r
819             \li the addition of the high halfword in the first operand and the low halfword in the \r
820                 second operand, in the high halfword of the return value.\r
821         \r
822     \par \r
823         Each bit in APSR.GE is set or cleared for each byte in the return value, depending on\r
824              the results of the operation.\r
825     \par\r
826         If \em res is the return value, then:\r
827             \li if res[15:0] \>= 0 then APSR.GE[1:0] = 11 else 00\r
828             \li if res[31:16] \>= 0 then APSR.GE[3:2] = 11 else 00\r
829     \r
830     \par Operation:\r
831         \code\r
832    res[15:0]  = val1[15:0]  - val2[31:16]   \r
833    res[31:16] = val1[31:16] + val2[15:0]  \r
834         \endcode\r
835 */\r
836 uint32_t __SASX(uint32_t val1, uint32_t val2);\r
837 \r
838 \r
839 /**************************************************************************************************/\r
840 /** \r
841     \brief      Q setting dual 16-bit add and subtract with exchange\r
842     \r
843     \details    This function enables you to exchange the halfwords of the one operand, then add the high\r
844           halfwords and subtract the low halfwords, saturating the results to the 16-bit signed \r
845           integer range -2<sup>15</sup> \<= x \<= 2<sup>15</sup> - 1.\r
846                 \r
847     \param      val1    first operand for the subtraction in the low halfword, and the \r
848                        first operand for the addition in the high halfword.\r
849     \param      val2    second operand for the subtraction in the high halfword, and the\r
850                        second operand for the addition in the low halfword.\r
851               \r
852     \returns\r
853             \li the saturated subtraction of the high halfword in the second operand from the low \r
854                 halfword in the first operand, in the low halfword of the return value.\r
855             \li the saturated addition of the high halfword in the first operand and the low \r
856                 halfword in the second operand, in the high halfword of the return value.\r
857         \r
858     \par \r
859         The returned results are saturated to the 16-bit signed integer \r
860              range -2<sup>15</sup> \<= x \<= 2<sup>15</sup> - 1.\r
861     \r
862     \par Operation:\r
863         \code\r
864    res[15:0]  = val1[15:0]  - val2[31:16]   \r
865    res[31:16] = val1[31:16] + val2[15:0]  \r
866         \endcode\r
867 */\r
868 uint32_t __QASX(uint32_t val1, uint32_t val2);\r
869 \r
870 \r
871 /**************************************************************************************************/\r
872 /** \r
873     \brief      Dual 16-bit signed addition and subtraction with halved results\r
874     \r
875     \details    This function enables you to exchange the two halfwords of one operand, perform one \r
876           signed 16-bit integer addition and one signed 16-bit subtraction, and halve the results.\r
877                 \r
878     \param      val1    first 16-bit operands.\r
879     \param      val2    second 16-bit operands.\r
880               \r
881     \returns\r
882             \li the halved subtraction of the high halfword in the second operand from the low \r
883                 halfword in the first operand, in the low halfword of the return value.\r
884             \li the halved subtraction of the low halfword in the second operand from the high \r
885                 halfword in the first operand, in the high halfword of the return value.\r
886         \r
887     \par Operation:\r
888         \code\r
889    res[15:0]  = (val1[15:0]  - val2[31:16]) >> 1  \r
890    res[31:16] = (val1[31:16] - val2[15:0] ) >> 1\r
891         \endcode\r
892 */\r
893 uint32_t __SHASX(uint32_t val1, uint32_t val2);\r
894 \r
895 \r
896 /**************************************************************************************************/\r
897 /** \r
898     \brief      GE setting dual 16-bit unsigned addition and subtraction with exchange\r
899     \r
900     \details    This function enables you to exchange the two halfwords of the second operand, add the \r
901           high halfwords and subtract the low halfwords.<br>\r
902           The GE bits in the APSR are set according to the results.\r
903                 \r
904     \param      val1    first operand for the subtraction in the low halfword, and the\r
905               first operand for the addition in the high halfword.\r
906     \param      val2    second operand for the subtraction in the high halfword and the\r
907               second operand for the addition in the low halfword.\r
908               \r
909     \returns\r
910             \li the subtraction of the high halfword in the second operand from the low halfword \r
911                 in the first operand, in the low halfword of the return value.\r
912             \li the addition of the high halfword in the first operand and the low halfword in the \r
913                 second operand, in the high halfword of the return value.\r
914         \r
915     \par \r
916             Each bit in APSR.GE is set or cleared for each byte in the return value, depending on \r
917              the results of the operation.\r
918              \r
919     \par    If \em res is the return value, then:\r
920             \li if res[15:0] \>= 0 then APSR.GE[1:0] = 11 else 00\r
921             \li if res[31:16] \>= 0x10000 then APSR.GE[3:2] = 11 else 00\r
922 \r
923     \par Operation:\r
924         \code\r
925    res[15:0]  = val1[15:0]  - val2[31:16]\r
926    res[31:16] = val1[31:16] + val2[15:0] \r
927         \endcode\r
928 */\r
929 uint32_t __UASX(uint32_t val1, uint32_t val2);\r
930 \r
931 \r
932 /**************************************************************************************************/\r
933 /** \r
934     \brief      Dual 16-bit unsigned saturating addition and subtraction with exchange\r
935     \r
936     \details    This function enables you to exchange the halfwords of the second operand and perform \r
937           one unsigned 16-bit integer addition and one unsigned 16-bit subtraction, saturating the \r
938           results to the 16-bit unsigned integer range 0 \<= x \<= 2<sup>16</sup> - 1.\r
939                 \r
940     \param      val1    first two 16-bit operands.\r
941     \param      val2    second two 16-bit operands.\r
942               \r
943     \returns\r
944             \li the subtraction of the high halfword in the second operand from the low halfword \r
945                 in the first operand, in the low halfword of the return value.\r
946             \li the subtraction of the low halfword in the second operand from the high halfword \r
947                 in the first operand, in the high halfword of the return value.\r
948         \r
949     \par \r
950             The results are saturated to the 16-bit unsigned integer  \r
951              range 0 \<= x \<= 2<sup>16</sup> - 1.\r
952              \r
953     \par Operation:\r
954         \code\r
955    res[15:0]  = val1[15:0]  - val2[31:16]\r
956    res[31:16] = val1[31:16] + val2[15:0] \r
957         \endcode\r
958 */\r
959 uint32_t __UQASX(uint32_t val1, uint32_t val2);\r
960 \r
961 \r
962 /**************************************************************************************************/\r
963 /** \r
964     \brief      Dual 16-bit unsigned addition and subtraction with halved results and exchange\r
965     \r
966     \details    This function enables you to exchange the halfwords of the second operand, add the high \r
967           halfwords and subtract the low halfwords, halving the results.\r
968                 \r
969     \param      val1    first operand for the subtraction in the low halfword, and the\r
970            first operand for the addition in the high halfword.\r
971     \param      val2    second operand for the subtraction in the high halfword, and the \r
972            second operand for the addition in the low halfword.\r
973               \r
974     \returns\r
975             \li the halved subtraction of the high halfword in the second operand from the low \r
976                 halfword in the first operand.\r
977             \li the halved addition of the high halfword in the first operand and the low halfword \r
978                 in the second operand.\r
979         \r
980              \r
981     \par Operation:\r
982         \code\r
983    res[15:0]  = (val1[15:0]  - val2[31:16]) >> 1\r
984    res[31:16] = (val1[31:16] + val2[15:0] ) >> 1\r
985         \endcode\r
986 */\r
987 uint32_t __UHASX(uint32_t val1, uint32_t val2);\r
988 \r
989 \r
990 /**************************************************************************************************/\r
991 /** \r
992     \brief      GE setting dual 16-bit signed subtraction and addition with exchange\r
993     \r
994     \details    This function enables you to exchange the two halfwords of one operand and perform one \r
995           16-bit integer subtraction and one 16-bit addition.<br>\r
996           The GE bits in the APSR are set according to the results.\r
997                 \r
998     \param      val1    first operand for the addition in the low halfword, and the first \r
999               operand for the subtraction in the high halfword.\r
1000     \param      val2    second operand for the addition in the high halfword, and the\r
1001               second operand for the subtraction in the low halfword.\r
1002               \r
1003     \returns\r
1004             \li the addition of the low halfword in the first operand and the high halfword in the \r
1005                 second operand, in the low halfword of the return value.\r
1006             \li the subtraction of the low halfword in the second operand from the high halfword \r
1007                 in the first operand, in the high halfword of the return value.\r
1008     \par\r
1009         Each bit in APSR.GE is set or cleared for each byte in the return value, depending on \r
1010              the results of the operation.\r
1011     \par\r
1012         If \em res is the return value, then:\r
1013             \li if res[15:0] \>= 0 then APSR.GE[1:0] = 11 else 00\r
1014             \li if res[31:16] \>= 0 then APSR.GE[3:2] = 11 else 00\r
1015         \r
1016     \par Operation:\r
1017         \code\r
1018    res[15:0]  = val1[15:0]  + val2[31:16]\r
1019    res[31:16] = val1[31:16] - val2[15:0] \r
1020         \endcode\r
1021 */\r
1022 uint32_t __SSAX(uint32_t val1, uint32_t val2);\r
1023 \r
1024 \r
1025 /**************************************************************************************************/\r
1026 /** \r
1027     \brief      Q setting dual 16-bit subtract and add with exchange\r
1028     \r
1029     \details    This function enables you to exchange the halfwords of one operand, then subtract the \r
1030           high halfwords and add the low halfwords, saturating the results to the 16-bit signed \r
1031           integer range -2<sup>15</sup> \<= x \<= 2<sup>15</sup> - 1.\r
1032                 \r
1033     \param      val1    first operand for the addition in the low halfword, and the first\r
1034            operand for the subtraction in the high halfword.\r
1035     \param      val2    second operand for the addition in the high halfword, and the \r
1036            second operand for the subtraction in the low halfword.\r
1037               \r
1038     \returns\r
1039             \li the saturated addition of the low halfword of the first operand and the high \r
1040                 halfword of the second operand, in the low halfword of the return value.\r
1041             \li the saturated subtraction of the low halfword of the second operand from the high \r
1042                 halfword of the first operand, in the high halfword of the return value.\r
1043     \par\r
1044         The returned results are saturated to the 16-bit signed integer \r
1045              range -2<sup>15</sup> \<= x \<= 2<sup>15</sup> - 1.\r
1046         \r
1047     \par Operation:\r
1048         \code\r
1049    res[15:0]  = val1[15:0]  + val2[31:16]\r
1050    res[31:16] = val1[31:16] - val2[15:0] \r
1051         \endcode\r
1052 */\r
1053 uint32_t __QSAX(uint32_t val1, uint32_t val2);\r
1054 \r
1055 \r
1056 /**************************************************************************************************/\r
1057 /** \r
1058     \brief      Dual 16-bit signed subtraction and addition with halved results\r
1059     \r
1060     \details    This function enables you to exchange the two halfwords of one operand, perform one \r
1061           signed 16-bit integer subtraction and one signed 16-bit addition, and halve the results.\r
1062                 \r
1063     \param      val1    first 16-bit operands.\r
1064     \param      val2    second 16-bit operands.\r
1065               \r
1066     \returns\r
1067             \li the halved addition of the low halfword in the first operand and the high halfword \r
1068                 in the second operand, in the low halfword of the return value.\r
1069             \li the halved subtraction of the low halfword in the second operand from the high \r
1070                 halfword in the first operand, in the high halfword of the return value.\r
1071         \r
1072     \par Operation:\r
1073         \code\r
1074    res[15:0]  = (val1[15:0]  + val2[31:16]) >> 1\r
1075    res[31:16] = (val1[31:16] - val2[15:0] ) >> 1\r
1076         \endcode\r
1077 */\r
1078 uint32_t __SHSAX(uint32_t val1, uint32_t val2);\r
1079 \r
1080 \r
1081 /**************************************************************************************************/\r
1082 /** \r
1083     \brief      GE setting dual 16-bit unsigned subtract and add with exchange\r
1084     \r
1085     \details    This function enables you to exchange the halfwords of the second operand, subtract the \r
1086           high halfwords and add the low halfwords.<br>\r
1087           The GE bits in the APSR are set according to the results.\r
1088                 \r
1089     \param      val1    first operand for the addition in the low halfword, and the first\r
1090               operand for the subtraction in the high halfword.\r
1091     \param      val2    second operand for the addition in the high halfword, and the\r
1092               second operand for the subtraction in the low halfword.\r
1093               \r
1094     \returns\r
1095             \li the addition of the low halfword in the first operand and the high halfword in the \r
1096                 second operand, in the low halfword of the return value.\r
1097             \li the subtraction of the low halfword in the second operand from the high halfword \r
1098                 in the first operand, in the high halfword of the return value.\r
1099     \par \r
1100         Each bit in APSR.GE is set or cleared for each byte in the return value, depending on \r
1101              the results of the operation.\r
1102     \par \r
1103         If \em res is the return value, then:\r
1104             \li if res[15:0] \>= 0x10000 then APSR.GE[1:0] = 11 else 00\r
1105             \li if res[31:16] \>= 0 then APSR.GE[3:2] = 11 else 00\r
1106         \r
1107     \par Operation:\r
1108         \code\r
1109    res[15:0]  = val1[15:0]  + val2[31:16]\r
1110    res[31:16] = val1[31:16] - val2[15:0] \r
1111         \endcode\r
1112 */\r
1113 uint32_t __USAX(uint32_t val1, uint32_t val2);\r
1114 \r
1115 \r
1116 /**************************************************************************************************/\r
1117 /** \r
1118     \brief      Dual 16-bit unsigned saturating subtraction and addition with exchange\r
1119     \r
1120     \details    This function enables you to exchange the halfwords of the second operand and perform \r
1121           one unsigned 16-bit integer subtraction and one unsigned 16-bit addition, saturating the \r
1122           results to the 16-bit unsigned integer range 0 \<= x \<= 2<sup>16</sup> - 1.\r
1123                 \r
1124     \param      val1    first 16-bit operand for the addition in the low halfword, and the\r
1125               first 16-bit operand for the subtraction in the high halfword.\r
1126     \param      val2    second 16-bit halfword for the addition in the high halfword,\r
1127               and the second 16-bit halfword for the subtraction in the low halfword.\r
1128               \r
1129     \returns\r
1130             \li the addition of the low halfword in the first operand and the high halfword in the \r
1131                 second operand, in the low halfword of the return value.\r
1132             \li the subtraction of the low halfword in the second operand from the high halfword \r
1133                 in the first operand, in the high halfword of the return value.\r
1134     \par \r
1135         The results are saturated to the 16-bit unsigned integer \r
1136              range 0 \<= x \<= 2<sup>16</sup> - 1.\r
1137         \r
1138     \par Operation:\r
1139         \code\r
1140    res[15:0]  = val1[15:0]  + val2[31:16]\r
1141    res[31:16] = val1[31:16] - val2[15:0] \r
1142         \endcode\r
1143 */\r
1144 uint32_t __UQSAX(uint32_t val1, uint32_t val2);\r
1145 \r
1146 \r
1147 /**************************************************************************************************/\r
1148 /** \r
1149     \brief      Dual 16-bit unsigned subtraction and addition with halved results and exchange\r
1150     \r
1151     \details    This function enables you to exchange the halfwords of the second operand, subtract the \r
1152           high halfwords and add the low halfwords, halving the results.\r
1153                 \r
1154     \param      val1    first operand for the addition in the low halfword, and the first\r
1155               operand for the subtraction in the high halfword.\r
1156     \param      val2    second operand for the addition in the high halfword, and the\r
1157               second operand for the subtraction in the low halfword.\r
1158               \r
1159     \returns\r
1160             \li the halved addition of the high halfword in the second operand and the low \r
1161                 halfword in the first operand, in the low halfword of the return value.\r
1162             \li the halved subtraction of the low halfword in the second operand from the high \r
1163                 halfword in the first operand, in the high halfword of the return value.\r
1164         \r
1165     \par Operation:\r
1166         \code\r
1167    res[15:0]  = (val1[15:0]  + val2[31:16]) >> 1\r
1168    res[31:16] = (val1[31:16] - val2[15:0] ) >> 1\r
1169         \endcode\r
1170 */\r
1171 uint32_t __UHSAX(uint32_t val1, uint32_t val2);\r
1172 \r
1173 \r
1174 /**************************************************************************************************/\r
1175 /** \r
1176     \brief      Unsigned sum of quad 8-bit unsigned absolute difference\r
1177     \r
1178     \details    This function enables you to perform four unsigned 8-bit subtractions, and add the \r
1179           absolute values of the differences together, returning the result as a single unsigned \r
1180           integer.\r
1181                 \r
1182     \param      val1    first four 8-bit operands for the subtractions.\r
1183     \param      val2    second four 8-bit operands for the subtractions.\r
1184               \r
1185     \returns\r
1186             \li the subtraction of the first byte in the second operand from the first byte in the \r
1187                 first operand.\r
1188             \li the subtraction of the second byte in the second operand from the second byte in \r
1189                 the first operand.\r
1190             \li the subtraction of the third byte in the second operand from the third byte in the \r
1191                 first operand.\r
1192             \li the subtraction of the fourth byte in the second operand from the fourth byte in \r
1193                 the first operand.\r
1194     \par\r
1195         The sum is returned as a single unsigned integer.\r
1196         \r
1197     \r
1198     \par Operation:\r
1199         \code\r
1200    absdiff1  = val1[7:0]   - val2[7:0]\r
1201    absdiff2  = val1[15:8]  - val2[15:8]\r
1202    absdiff3  = val1[23:16] - val2[23:16]\r
1203    absdiff4  = val1[31:24] - val2[31:24]\r
1204    res[31:0] = absdiff1 + absdiff2 + absdiff3 + absdiff4\r
1205         \endcode\r
1206 */\r
1207 uint32_t __USAD8(uint32_t val1, uint32_t val2);\r
1208 \r
1209 \r
1210 /**************************************************************************************************/\r
1211 /** \r
1212     \brief      Unsigned sum of quad 8-bit unsigned absolute difference with 32-bit accumulate\r
1213     \r
1214     \details    This function enables you to perform four unsigned 8-bit subtractions, and add the \r
1215           absolute values of the differences to a 32-bit accumulate operand.\r
1216                 \r
1217     \param      val1    first four 8-bit operands for the subtractions.\r
1218     \param      val2    second four 8-bit operands for the subtractions.\r
1219     \param      val3    accumulation value.\r
1220               \r
1221     \returns\r
1222         the sum of the absolute differences of the following \r
1223             bytes, added to the accumulation value:\r
1224             \li the subtraction of the first byte in the second operand from the first byte in the \r
1225                 first operand.\r
1226             \li the subtraction of the second byte in the second operand from the second byte in \r
1227                 the first operand.\r
1228             \li the subtraction of the third byte in the second operand from the third byte in the \r
1229                 first operand.\r
1230             \li the subtraction of the fourth byte in the second operand from the fourth byte in \r
1231                 the first operand.\r
1232         \r
1233     \r
1234     \par Operation:\r
1235         \code\r
1236    absdiff1  = val1[7:0]   - val2[7:0]\r
1237    absdiff2  = val1[15:8]  - val2[15:8]\r
1238    absdiff3  = val1[23:16] - val2[23:16]\r
1239    absdiff4  = val1[31:24] - val2[31:24]\r
1240    sum       = absdiff1 + absdiff2 + absdiff3 + absdiff4\r
1241    res[31:0] = sum[31:0] + val3[31:0]\r
1242         \endcode\r
1243 */\r
1244 uint32_t __USADA8(uint32_t val1, uint32_t val2, uint32_t val3);\r
1245 \r
1246 \r
1247 /**************************************************************************************************/\r
1248 /** \r
1249     \brief      Q setting dual 16-bit saturate\r
1250     \r
1251     \details    This function enables you to saturate two signed 16-bit values to a selected signed range.<br>\r
1252           The Q bit is set if either operation saturates.\r
1253                 \r
1254     \param      val1    two signed 16-bit values to be saturated.\r
1255     \param      val2    bit position for saturation, an integral constant expression in the\r
1256               range 1 to 16.\r
1257 \r
1258               \r
1259     \returns\r
1260         the sum of the absolute differences of the following \r
1261             bytes, added to the accumulation value:\r
1262             \li the signed saturation of the low halfword in \em val1, saturated to the bit position \r
1263                 specified in \em val2 and returned in the low halfword of the return value.\r
1264             \li the signed saturation of the high halfword in <i>val1</i>, saturated to the bit position \r
1265                 specified in <i>val2</i> and returned in the high halfword of the return value.\r
1266         \r
1267     \r
1268     \par Operation:\r
1269         \code\r
1270    Saturate halfwords in val1 to the signed range specified by the bit position in val2\r
1271         \endcode\r
1272 */\r
1273 uint32_t __SSAT16(uint32_t val1, const uint32_t val2);\r
1274 \r
1275 \r
1276 /**************************************************************************************************/\r
1277 /** \r
1278     \brief      Q setting dual 16-bit unsigned saturate\r
1279     \r
1280     \details    This function enables you to saturate two signed 16-bit values to a selected unsigned \r
1281          range.<br>\r
1282          The Q bit is set if either operation saturates.\r
1283                 \r
1284     \param      val1    two 16-bit values that are to be saturated.\r
1285     \param      val2    bit position for saturation, and must be an integral constant \r
1286            expression in the range 0 to 15.\r
1287 \r
1288               \r
1289     \returns\r
1290         the saturation of the two signed 16-bit values, as non-negative values.\r
1291             \li the saturation of the low halfword in \em val1, saturated to the bit position \r
1292                 specified in \em val2 and returned in the low halfword of the return value.\r
1293             \li the saturation of the high halfword in \em val1, saturated to the bit position \r
1294                 specified in \em val2 and returned in the high halfword of the return value.\r
1295         \r
1296     \r
1297     \par Operation:\r
1298         \code\r
1299    Saturate halfwords in val1 to the unsigned range specified by the bit position in val2\r
1300         \endcode\r
1301 */\r
1302 uint32_t __USAT16(uint32_t val1, const uint32_t val2);\r
1303 \r
1304 \r
1305 /**************************************************************************************************/\r
1306 /** \r
1307     \brief      Dual extract 8-bits and zero-extend to 16-bits\r
1308     \r
1309     \details    This function enables you to extract two 8-bit values from an operand and zero-extend \r
1310           them to 16 bits each.\r
1311                 \r
1312     \param      val     two 8-bit values in val[7:0] and val[23:16] to be sign-extended.\r
1313 \r
1314               \r
1315     \returns\r
1316         the 8-bit values zero-extended to 16-bit values.\r
1317             \li zero-extended value of val[7:0] in the low halfword of the return value.\r
1318             \li zero-extended value of val[23:16] in the high halfword of the return value.\r
1319         \r
1320     \r
1321     \par Operation:\r
1322         \code\r
1323    res[15:0]  = ZeroExtended(val[7:0]  )\r
1324    res[31:16] = ZeroExtended(val[23:16])\r
1325         \endcode\r
1326 */\r
1327 uint32_t __UXTB16(uint32_t val);\r
1328 \r
1329 \r
1330 /**************************************************************************************************/\r
1331 /** \r
1332     \brief      Extracted 16-bit to 32-bit unsigned addition\r
1333     \r
1334     \details    This function enables you to extract two 8-bit values from one operand, zero-extend them \r
1335           to 16 bits each, and add the results to two 16-bit values from another operand.\r
1336                 \r
1337     \param      val1    value added to the zero-extended to 16-bit values.    \r
1338     \param      val2    two 8-bit values to be extracted and zero-extended.\r
1339 \r
1340               \r
1341     \returns\r
1342         the 8-bit values in \em val2, zero-extended to 16-bit values \r
1343             and added to \em val1.\r
1344         \r
1345     \r
1346     \par Operation:\r
1347         \code\r
1348    res[15:0]  = ZeroExt(val2[7:0]   to 16 bits) + val1[15:0]\r
1349    res[31:16] = ZeroExt(val2[31:16] to 16 bits) + val1[31:16]\r
1350         \endcode\r
1351 */\r
1352 uint32_t __UXTAB16(uint32_t val1, uint32_t val2);\r
1353 \r
1354 \r
1355 /**************************************************************************************************/\r
1356 /** \r
1357     \brief      Dual extract 8-bits and sign extend each to 16-bits\r
1358     \r
1359     \details    This function enables you to extract two 8-bit values from an operand and sign-extend \r
1360           them to 16 bits each.\r
1361                 \r
1362     \param      val     two 8-bit values in val[7:0] and val[23:16] to be sign-extended.  \r
1363 \r
1364 \r
1365               \r
1366     \returns\r
1367         the 8-bit values sign-extended to 16-bit values.\r
1368             \li     sign-extended value of val[7:0] in the low halfword of the return value.\r
1369             \li     sign-extended value of val[23:16] in the high halfword of the return value.\r
1370         \r
1371     \r
1372     \par Operation:\r
1373         \code\r
1374    res[15:0]  = SignExtended(val[7:0]\r
1375    res[31:16] = SignExtended(val[23:16]\r
1376         \endcode\r
1377 */\r
1378 uint32_t __SXTB16(uint32_t val);\r
1379 \r
1380 \r
1381 /**************************************************************************************************/\r
1382 /** \r
1383     \brief      Dual extracted 8-bit to 16-bit signed addition\r
1384     \r
1385     \details    This function enables you to extract two 8-bit values from the second operand (at bit \r
1386           positions [7:0] and [23:16]), sign-extend them to 16-bits each, and add the results to the \r
1387           first operand.\r
1388                 \r
1389     \param      val1    values added to the zero-extended to 16-bit values. \r
1390     \param      val2    two 8-bit values to be extracted and zero-extended.\r
1391 \r
1392 \r
1393               \r
1394     \returns\r
1395         the addition of \em val1 and \em val2, where the 8-bit values in \r
1396             val2[7:0] and val2[23:16] have been extracted and sign-extended prior to the addition.\r
1397         \r
1398     \r
1399     \par Operation:\r
1400         \code\r
1401    res[15:0]  = val1[15:0]  + SignExtended(val2[7:0])\r
1402    res[31:16] = val1[31:16] + SignExtended(val2[23:16])\r
1403     \endcode\r
1404 */\r
1405 uint32_t __SXTAB16(uint32_t val1, uint32_t val2);\r
1406 \r
1407 \r
1408 /**************************************************************************************************/\r
1409 /** \r
1410     \brief      Q setting sum of dual 16-bit signed multiply\r
1411     \r
1412     \details    This function enables you to perform two 16-bit signed multiplications, adding the \r
1413           products together.<br>\r
1414           The Q bit is set if the addition overflows.\r
1415                 \r
1416     \param      val1    first 16-bit operands for each multiplication.\r
1417     \param      val2    second 16-bit operands for each multiplication.\r
1418 \r
1419 \r
1420               \r
1421     \returns\r
1422         the sum of the products of the two 16-bit signed multiplications.\r
1423         \r
1424     \r
1425     \par Operation:\r
1426         \code\r
1427    p1 = val1[15:0]  * val2[15:0]\r
1428    p2 = val1[31:16] * val2[31:16]\r
1429    res[31:0] = p1 + p2\r
1430     \endcode\r
1431 */\r
1432 uint32_t __SMUAD(uint32_t val1, uint32_t val2);\r
1433 \r
1434 \r
1435 /**************************************************************************************************/\r
1436 /** \r
1437     \brief      Q setting sum of dual 16-bit signed multiply with exchange\r
1438     \r
1439     \details    This function enables you to perform two 16-bit signed multiplications with exchanged\r
1440           halfwords of the second operand, adding the products together.<br>\r
1441           The Q bit is set if the addition overflows.\r
1442                 \r
1443     \param      val1    first 16-bit operands for each multiplication.\r
1444     \param      val2    second 16-bit operands for each multiplication.\r
1445 \r
1446 \r
1447               \r
1448     \returns\r
1449         the sum of the products of the two 16-bit signed multiplications with exchanged\r
1450             halfwords of the second operand.\r
1451         \r
1452     \r
1453     \par Operation:\r
1454         \code\r
1455    p1 = val1[15:0]  * val2[31:16]\r
1456    p2 = val1[31:16] * val2[15:0]\r
1457    res[31:0] = p1 + p2\r
1458     \endcode\r
1459 */\r
1460 uint32_t __SMUADX(uint32_t val1, uint32_t val2);\r
1461 \r
1462 \r
1463 /**************************************************************************************************/\r
1464 /** \r
1465     \brief      32-bit signed multiply with 32-bit truncated accumulator.\r
1466     \r
1467     \details    This function enables you to perform a signed 32-bit multiplications, adding the most significant 32 bits\r
1468                     of the 64-bit result to a 32-bit accumulate operand.<br>\r
1469 \r
1470     \param      val1    first operand for multiplication.\r
1471     \param      val2    second operand for multiplication.\r
1472     \param      val3    accumulate value.\r
1473 \r
1474               \r
1475     \returns    the product of multiplication (most significant 32 bits) is added to the accumulate \r
1476             value, as a 32-bit integer.\r
1477         \r
1478      \par Operation:\r
1479         \code\r
1480    p = val1 * val2\r
1481    res[31:0] = p[61:32] + val3[31:0]\r
1482     \endcode\r
1483 */\r
1484 uint32_t __SMMLA (int32_t val1, int32_t val2, int32_t val3);\r
1485 \r
1486 \r
1487 /**************************************************************************************************/\r
1488 /** \r
1489     \brief      Q setting dual 16-bit signed multiply with single 32-bit accumulator\r
1490     \r
1491     \details    This function enables you to perform two signed 16-bit multiplications, adding both \r
1492           results to a 32-bit accumulate operand.<br>\r
1493           The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications.\r
1494                 \r
1495     \param      val1    first 16-bit operands for each multiplication.\r
1496     \param      val2    second 16-bit operands for each multiplication.\r
1497     \param      val3    accumulate value.\r
1498 \r
1499               \r
1500     \returns\r
1501         the product of each multiplication added to the accumulate \r
1502             value, as a 32-bit integer.\r
1503         \r
1504     \r
1505     \par Operation:\r
1506         \code\r
1507    p1 = val1[15:0]  * val2[15:0]\r
1508    p2 = val1[31:16] * val2[31:16]\r
1509    res[31:0] = p1 + p2 + val3[31:0]\r
1510     \endcode\r
1511 */\r
1512 uint32_t __SMLAD(uint32_t val1, uint32_t val2, uint32_t val3);\r
1513 \r
1514 \r
1515 /**************************************************************************************************/\r
1516 /** \r
1517     \brief      Q setting pre-exchanged dual 16-bit signed multiply with single 32-bit accumulator\r
1518     \r
1519     \details    This function enables you to perform two signed 16-bit multiplications with exchanged\r
1520           halfwords of the second operand, adding both results to a 32-bit accumulate operand.<br>\r
1521           The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications.\r
1522                 \r
1523     \param      val1    first 16-bit operands for each multiplication.\r
1524     \param      val2    second 16-bit operands for each multiplication.\r
1525     \param      val3    accumulate value.\r
1526 \r
1527               \r
1528     \returns\r
1529         the product of each multiplication with exchanged\r
1530             halfwords of the second operand added to the accumulate value, as a 32-bit integer.\r
1531         \r
1532     \r
1533     \par Operation:\r
1534         \code\r
1535    p1 = val1[15:0]  * val2[31:16]\r
1536    p2 = val1[31:16] * val2[15:0]\r
1537    res[31:0] = p1 + p2 + val3[31:0]\r
1538     \endcode\r
1539 */\r
1540 uint32_t __SMLADX(uint32_t val1, uint32_t val2, uint32_t val3);\r
1541 \r
1542 \r
1543 /**************************************************************************************************/\r
1544 /** \r
1545     \brief      Dual 16-bit signed multiply with single 64-bit accumulator\r
1546     \r
1547     \details    This function enables you to perform two signed 16-bit multiplications, adding both \r
1548           results to a 64-bit accumulate operand. Overflow is only possible as a result of the 64-bit \r
1549           addition. This overflow is not detected if it occurs. Instead, the result wraps around \r
1550           modulo2<sup>64</sup>.\r
1551                 \r
1552     \param      val1    first 16-bit operands for each multiplication.\r
1553     \param      val2    second 16-bit operands for each multiplication.\r
1554     \param      val3    accumulate value.\r
1555 \r
1556               \r
1557     \returns\r
1558         the product of each multiplication added to the accumulate value.\r
1559         \r
1560     \r
1561     \par Operation:\r
1562         \code\r
1563    p1 = val1[15:0]  * val2[15:0]\r
1564    p2 = val1[31:16] * val2[31:16]\r
1565    sum = p1 + p2 + val3[63:32][31:0]\r
1566    res[63:32] = sum[63:32]\r
1567    res[31:0]  = sum[31:0]\r
1568     \endcode\r
1569 */\r
1570 uint64_t __SMLALD(uint32_t val1, uint32_t val2, uint64_t val3);\r
1571 \r
1572 \r
1573 /**************************************************************************************************/\r
1574 /** \r
1575     \brief      Dual 16-bit signed multiply with exchange with single 64-bit accumulator\r
1576     \r
1577     \details    This function enables you to exchange the halfwords of the second operand, and perform \r
1578           two signed 16-bit multiplications, adding both results to a 64-bit accumulate operand. \r
1579           Overflow is only possible as a result of the 64-bit addition. This overflow is not detected \r
1580           if it occurs. Instead, the result wraps around modulo2<sup>64</sup>.\r
1581                 \r
1582     \param      val1    first 16-bit operands for each multiplication.\r
1583     \param      val2    second 16-bit operands for each multiplication.\r
1584     \param      val3    accumulate value.\r
1585 \r
1586               \r
1587     \returns\r
1588         the product of each multiplication added to the accumulate value.\r
1589         \r
1590     \r
1591     \par Operation:\r
1592         \code\r
1593    p1 = val1[15:0]  * val2[31:16]\r
1594    p2 = val1[31:16] * val2[15:0]\r
1595    sum = p1 + p2 + val3[63:32][31:0]\r
1596    res[63:32] = sum[63:32]\r
1597    res[31:0] = sum[31:0]\r
1598     \endcode\r
1599 */\r
1600 unsigned long long __SMLALDX(uint32_t val1, uint32_t val2, unsigned long long val3);\r
1601 \r
1602 \r
1603 /**************************************************************************************************/\r
1604 /** \r
1605     \brief      Dual 16-bit signed multiply returning difference\r
1606     \r
1607     \details    This function enables you to perform two 16-bit signed multiplications, taking the \r
1608           difference of the products by subtracting the high halfword product from the low \r
1609           halfword product.\r
1610                 \r
1611     \param      val1    first 16-bit operands for each multiplication.\r
1612     \param      val2    second 16-bit operands for each multiplication.\r
1613 \r
1614               \r
1615     \returns\r
1616         the difference of the products of the two 16-bit signed multiplications.\r
1617         \r
1618     \r
1619     \par Operation:\r
1620         \code\r
1621    p1 = val1[15:0]  * val2[15:0]\r
1622    p2 = val1[31:16] * val2[31:16]\r
1623    res[31:0] = p1 - p2\r
1624     \endcode\r
1625 */\r
1626 uint32_t __SMUSD(uint32_t val1, uint32_t val2);\r
1627 \r
1628 \r
1629 /**************************************************************************************************/\r
1630 /** \r
1631     \brief      Dual 16-bit signed multiply with exchange returning difference\r
1632     \r
1633     \details    This function enables you to perform two 16-bit signed multiplications, subtracting one \r
1634           of the products from the other. The halfwords of the second operand are exchanged \r
1635           before performing the arithmetic. This produces top * bottom and bottom * top \r
1636           multiplication.\r
1637                 \r
1638     \param      val1    first 16-bit operands for each multiplication.\r
1639     \param      val2    second 16-bit operands for each multiplication.\r
1640 \r
1641               \r
1642     \returns\r
1643         the difference of the products of the two 16-bit signed multiplications.\r
1644         \r
1645     \r
1646     \par Operation:\r
1647         \code\r
1648    p1 = val1[15:0]  * val2[31:16]\r
1649    p2 = val1[31:16] * val2[15:0]\r
1650    res[31:0] = p1 - p2\r
1651     \endcode\r
1652 */\r
1653 uint32_t __SMUSDX(uint32_t val1, uint32_t val2);\r
1654 \r
1655 \r
1656 /**************************************************************************************************/\r
1657 /** \r
1658     \brief      Q setting dual 16-bit signed multiply subtract with 32-bit accumulate\r
1659     \r
1660     \details    This function enables you to perform two 16-bit signed multiplications, take the \r
1661           difference of the products, subtracting the high halfword product from the low halfword \r
1662           product, and add the difference to a 32-bit accumulate operand.<br>\r
1663           The Q bit is set if the accumulation overflows. Overflow cannot occur during the multiplications or the \r
1664           subtraction.\r
1665                 \r
1666     \param      val1    first 16-bit operands for each multiplication.\r
1667     \param      val2    second 16-bit operands for each multiplication.\r
1668     \param      val3    accumulate value.\r
1669 \r
1670               \r
1671     \returns\r
1672         the difference of the product of each multiplication, added \r
1673             to the accumulate value.\r
1674         \r
1675     \r
1676     \par Operation:\r
1677         \code\r
1678    p1 = val1[15:0]  * val2[15:0]\r
1679    p2 = val1[31:16] * val2[31:16]\r
1680    res[31:0] = p1 - p2 + val3[31:0]\r
1681     \endcode\r
1682 */\r
1683 uint32_t __SMLSD(uint32_t val1, uint32_t val2, uint32_t val3);\r
1684 \r
1685 \r
1686 /**************************************************************************************************/\r
1687 /** \r
1688     \brief      Q setting dual 16-bit signed multiply with exchange subtract with 32-bit accumulate\r
1689     \r
1690     \details    This function enables you to exchange the halfwords in the second operand, then perform \r
1691           two 16-bit signed multiplications. The difference of the products is added to a 32-bit \r
1692           accumulate operand.<br>\r
1693           The Q bit is set if the addition overflows. Overflow cannot occur during the multiplications or the subtraction.\r
1694                 \r
1695     \param      val1    first 16-bit operands for each multiplication.\r
1696     \param      val2    second 16-bit operands for each multiplication.\r
1697     \param      val3    accumulate value.\r
1698 \r
1699               \r
1700     \returns\r
1701         the difference of the product of each multiplication, added \r
1702             to the accumulate value.\r
1703         \r
1704     \r
1705     \par Operation:\r
1706         \code\r
1707    p1 = val1[15:0]  * val2[31:16]\r
1708    p2 = val1[31:16] * val2[15:0]\r
1709    res[31:0] = p1 - p2 + val3[31:0]\r
1710     \endcode\r
1711 */\r
1712 uint32_t __SMLSDX(uint32_t val1, uint32_t val2, uint32_t val3);\r
1713 \r
1714 \r
1715 /**************************************************************************************************/\r
1716 /** \r
1717     \brief      Q setting dual 16-bit signed multiply subtract with 64-bit accumulate\r
1718     \r
1719     \details    This function It enables you to perform two 16-bit signed multiplications, take the \r
1720           difference of the products, subtracting the high halfword product from the low halfword \r
1721           product, and add the difference to a 64-bit accumulate operand. Overflow cannot occur \r
1722           during the multiplications or the subtraction. Overflow can occur as a result of the 64-bit \r
1723           addition, and this overflow is not detected. Instead, the result wraps round to  \r
1724           modulo2<sup>64</sup>.\r
1725                 \r
1726     \param      val1    first 16-bit operands for each multiplication.\r
1727     \param      val2    second 16-bit operands for each multiplication.\r
1728     \param      val3    accumulate value.\r
1729 \r
1730               \r
1731     \returns\r
1732         the difference of the product of each multiplication, \r
1733             added to the accumulate value.\r
1734         \r
1735     \r
1736     \par Operation:\r
1737         \code\r
1738    p1 = val1[15:0]  * val2[15:0]\r
1739    p2 = val1[31:16] * val2[31:16]\r
1740    res[63:0] = p1 - p2 + val3[63:0]\r
1741     \endcode\r
1742 */\r
1743 uint64_t __SMLSLD(uint32_t val1, uint32_t val2, uint64_t val3);\r
1744 \r
1745 \r
1746 /**************************************************************************************************/\r
1747 /** \r
1748     \brief      Q setting dual 16-bit signed multiply with exchange subtract with 64-bit accumulate\r
1749     \r
1750     \details    This function enables you to exchange the halfwords of the second operand, perform two \r
1751           16-bit multiplications, adding the difference of the products to a 64-bit accumulate \r
1752           operand. Overflow cannot occur during the multiplications or the subtraction. Overflow \r
1753           can occur as a result of the 64-bit addition, and this overflow is not detected. Instead, \r
1754           the result wraps round to modulo2<sup>64</sup>.\r
1755                 \r
1756     \param      val1    first 16-bit operands for each multiplication.\r
1757     \param      val2    second 16-bit operands for each multiplication.\r
1758     \param      val3    accumulate value.\r
1759 \r
1760               \r
1761     \returns\r
1762         the difference of the product of each multiplication, \r
1763             added to the accumulate value.\r
1764         \r
1765     \r
1766     \par Operation:\r
1767         \code\r
1768    p1 = val1[15:0]  * val2[31:16]\r
1769    p2 = val1[31:16] * val2[15:0]\r
1770    res[63:0] = p1 - p2 + val3[63:0]\r
1771     \endcode\r
1772 */\r
1773 unsigned long long __SMLSLDX(uint32_t val1, uint32_t val2, unsigned long long val3);\r
1774 \r
1775 \r
1776 /**************************************************************************************************/\r
1777 /** \r
1778     \brief      Select bytes based on GE bits\r
1779     \r
1780     \details    This function inserts a SEL instruction into the instruction stream generated by the \r
1781           compiler. It enables you to select bytes from the input parameters, whereby the bytes \r
1782           that are selected depend upon the results of previous SIMD instruction function. The \r
1783           results of previous SIMD instruction function are represented by the Greater than or \r
1784           Equal flags in the Application Program Status Register (APSR).\r
1785           The __SEL function works equally well on both halfword and byte operand function \r
1786           results. This is because halfword operand operations set two (duplicate) GE bits per \r
1787           value.\r
1788                 \r
1789     \param      val1    four selectable 8-bit values.\r
1790     \param      val2    four selectable 8-bit values.\r
1791 \r
1792               \r
1793     \returns\r
1794         The function selects bytes from the input parameters and returns them in the \r
1795             return value, res, according to the following criteria:\r
1796             \li if APSR.GE[0] == 1 then res[7:0] = val1[7:0] else res[7:0] = val2[7:0]\r
1797             \li if APSR.GE[1] == 1 then res[15:8] = val1[15:8] else res[15:8] = val2[15:8]\r
1798             \li if APSR.GE[2] == 1 then res[23:16] = val1[23:16] else res[23:16] = val2[23:16]\r
1799             \li if APSR.GE[3] == 1 then res[31;24] = val1[31:24] else res = val2[31:24]\r
1800   \r
1801 */\r
1802 uint32_t __SEL(uint32_t val1, uint32_t val2);\r
1803 \r
1804 \r
1805 /**************************************************************************************************/\r
1806 /** \r
1807     \brief      Q setting saturating add\r
1808     \r
1809     \details    This function enables you to obtain the saturating add of two integers.<br>\r
1810          The Q bit is set if the operation saturates.\r
1811                 \r
1812     \param      val1    first summand of the saturating add operation.\r
1813     \param      val2    second summand of the saturating add operation.\r
1814 \r
1815               \r
1816     \returns\r
1817         the saturating addition of val1 and val2.\r
1818   \r
1819     \par Operation:\r
1820         \code\r
1821    res[31:0] = SAT(val1 + SAT(val2))\r
1822         \endcode\r
1823 */\r
1824 uint32_t __QADD(uint32_t val1, uint32_t val2);\r
1825 \r
1826 \r
1827 /**************************************************************************************************/\r
1828 /** \r
1829     \brief      Q setting saturating subtract\r
1830     \r
1831     \details    This function enables you to obtain the saturating subtraction of two integers.<br>\r
1832          The Q bit is set if the operation saturates.\r
1833                 \r
1834     \param      val1    minuend of the saturating subtraction operation.\r
1835     \param      val2    subtrahend of the saturating subtraction operation.\r
1836 \r
1837               \r
1838     \returns\r
1839         the saturating subtraction of val1 and val2.\r
1840   \r
1841     \par Operation:\r
1842         \code\r
1843    res[31:0] = SAT(val1 - SAT(val2))\r
1844         \endcode\r
1845 */\r
1846 uint32_t __QSUB(uint32_t val1, uint32_t val2);\r
1847 \r
1848 \r
1849 /**************************************************************************************************/\r
1850 /** \r
1851     \brief      Halfword packing instruction. Combines bits[15:0] of <i>val1</i> \r
1852                 with bits[31:16] of <i>val2</i> levitated with the <i>val3</i>.\r
1853     \r
1854     \details    Combine a halfword from one register with a halfword from another register. \r
1855                 The second argument can be left-shifted before extraction of the halfword. The registers \r
1856                 PC and SP are not allowed as arguments. This instruction does not change the flags.\r
1857                 \r
1858     \param      val1    first 16-bit operands\r
1859     \param      val2    second 16-bit operands\r
1860     \param      val3    value for left-shifting <i>val2</i>. Value range [0..31].\r
1861 \r
1862               \r
1863     \returns\r
1864         the combination of halfwords.\r
1865   \r
1866     \par Operation:\r
1867         \code\r
1868    res[15:0]  = val1[15:0]\r
1869    res[31:16] = val2[31:16]<<val3 \r
1870         \endcode\r
1871 */\r
1872 uint32_t __PKHBT(uint32_t val1, uint32_t val2, uint32_t val3);\r
1873 \r
1874 \r
1875 /**************************************************************************************************/\r
1876 /** \r
1877     \brief      Halfword packing instruction. Combines bits[31:16] of <i>val1</i> \r
1878                 with bits[15:0] of <i>val2</i> right-shifted with the <i>val3</i>.\r
1879     \r
1880     \details    Combines a halfword from one register with a halfword from another register. \r
1881                 The second argument can be right-shifted before extraction of the halfword. The registers \r
1882                 PC and SP are not allowed as arguments. This instruction does not change the flags.\r
1883                 \r
1884     \param      val1    second 16-bit operands\r
1885     \param      val2    first 16-bit operands\r
1886     \param      val3    value for right-shifting <i>val2</i>. Value range [1..32].\r
1887 \r
1888               \r
1889     \returns\r
1890         the combination of halfwords.\r
1891   \r
1892     \par Operation:\r
1893         \code\r
1894    res[15:0]  = val2[15:0]>>val3\r
1895    res[31:16] = val1[31:16] \r
1896         \endcode\r
1897 */\r
1898 uint32_t __PKHTB(uint32_t val1, uint32_t val2, uint32_t val3);\r
1899 \r
1900 /** @} */  /* end group intrinsic_SIMD_gr */