c6x.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. /*****************************************************************************/
  2. /* C6X.H v8.2.2 */
  3. /* */
  4. /* Copyright (c) 1996-2017 Texas Instruments Incorporated */
  5. /* http://www.ti.com/ */
  6. /* */
  7. /* Redistribution and use in source and binary forms, with or without */
  8. /* modification, are permitted provided that the following conditions */
  9. /* are met: */
  10. /* */
  11. /* Redistributions of source code must retain the above copyright */
  12. /* notice, this list of conditions and the following disclaimer. */
  13. /* */
  14. /* Redistributions in binary form must reproduce the above copyright */
  15. /* notice, this list of conditions and the following disclaimer in */
  16. /* the documentation and/or other materials provided with the */
  17. /* distribution. */
  18. /* */
  19. /* Neither the name of Texas Instruments Incorporated nor the names */
  20. /* of its contributors may be used to endorse or promote products */
  21. /* derived from this software without specific prior written */
  22. /* permission. */
  23. /* */
  24. /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
  25. /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
  26. /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
  27. /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
  28. /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
  29. /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
  30. /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
  31. /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
  32. /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  33. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
  34. /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  35. /* */
  36. /*****************************************************************************/
  37. #include "vect.h"
  38. #ifdef __cplusplus
  39. extern "C"
  40. {
  41. #endif /* __cplusplus */
  42. /*****************************************************************************/
  43. /* */
  44. /* NOTICE TO THOSE WHO USE INTRINSICS AND PACKED DATA */
  45. /* */
  46. /* This note contains information on a new __float2_t type. */
  47. /* It also contains recommendations on the use of the "double" type. */
  48. /* */
  49. /* In order to better support packed data compiler optimizations in the */
  50. /* future, the use of the type "double" for packed data is now discouraged */
  51. /* and its support may be discontinued in the future. */
  52. /* */
  53. /* There are several recommendations and changes as a result. Note that */
  54. /* these changes do NOT break compatibility with older code (source files */
  55. /* or object files). */
  56. /* */
  57. /* (1) long long should be used for 64-bit packed integer data. The double */
  58. /* type should be used only for double-precision floating point values. */
  59. /* */
  60. /* (2) There is a new type, __float2_t, that holds two floats and should */
  61. /* be used instead of double for holding two floats. For now, this new */
  62. /* type is typedef'ed to double in c6x.h, but could be changed in the */
  63. /* future to a structure or vector type to allow better optimization of */
  64. /* packed data floats. We recommend the use of __float2_t for any */
  65. /* float x2 data instead of double. */
  66. /* */
  67. /* (3) There are new __float2_t manipulation intrinsics (see below) that */
  68. /* should be used to create and manipulate objects of type __float2_t. */
  69. /* */
  70. /* (4) C66 intrinsics that deal with packed float data are now declared */
  71. /* using __float2_t instead of double. (Those intrinsics are declared */
  72. /* in this file, c6x.h.) */
  73. /* */
  74. /* (5) When using any intrinsic that involves __float2_t, c6x.h must be */
  75. /* included. */
  76. /* */
  77. /* (6) Certain intrinsics that used double to store fixed-point packed */
  78. /* data have been deprecated. They will still be supported in the */
  79. /* near future, but their descriptions will be removed from the */
  80. /* compiler user's guide (spru187). Deprecated: _mpy2, _mpyhi, _mpyli, */
  81. /* _mpysu4, _mpyu4, and _smpy2. Use the long long versions instead. */
  82. /* */
  83. /* Please see */
  84. /* http://processors.wiki.ti.com/index.php/C6000_Intrinsics_and_Type_Double */
  85. /* and the C6000 Compiler User's Guide (v7.2), spru187, for more */
  86. /* information. */
  87. /* */
  88. /*****************************************************************************/
  89. /* If not using host intrinsics, define __float2_t items. */
  90. #ifndef __FLOAT2_DEFINES__
  91. #define __FLOAT2_DEFINES__
  92. typedef double __float2_t;
  93. /*-------------------------------------------------------------------------*/
  94. /* __float2_t manipulation intrinsics */
  95. /* */
  96. /* Since __float2_t is just a typedef to double at this time, we simply */
  97. /* use #defines to "create" the __float2_t manipulation intrinsics. The */
  98. /* __float2_t intrinsics are listed in this comment for convenience. */
  99. /* */
  100. /* __float2_t _lltof2(long long) Reinterpret long long as __float2_t */
  101. /* long long _f2toll(__float2_t) Reinterpret __float2_t as long long */
  102. /* __float2_t _ftof2(float, float) Create a __float2_t from 2 floats */
  103. /* float _hif2(__float2_t) Return the hi 32 bits of a __float2_t */
  104. /* float _lof2(__float2_t) Return the lo 32 bits of a __float2_t */
  105. /* __int40_t _f2tol(__float2_t) Reinterpret __float2_t as 40-bit type */
  106. /* __float2_t _ltof2(__int40_t) Reinterpret 40-bit type as __float2_t */
  107. /* */
  108. /* __float2_t & _amem8_f2(void *) | */
  109. /* __float2_t & _amem8_f2_const(void *) | Allows (un)aligned loads and */
  110. /* __float2_t & _mem8_f2(void *) | stores of 8 bytes to and from */
  111. /* __float2_t & _mem8_f2_const(void *) | memory. */
  112. /* */
  113. /* __float2_t _fdmv_f2(float, float) Move two floats with one instruction */
  114. /* __float2_t _hif2_128(__x128_t) Return hi 64 bits of __x128_t */
  115. /* __float2_t _lof2_128(__x128_t) Return hi 64 bits of __x128_t */
  116. /* __x128_t _f2to128(__float2_t, __float2_t) Compose __x128_t */
  117. /* __float2_t _fdmvd_f2(float, float) Delayed move of two floats */
  118. /*-------------------------------------------------------------------------*/
  119. #define _lltof2 _lltod
  120. #define _f2toll _dtoll
  121. #define _ftof2 _ftod
  122. #define _hif2 _hif
  123. #define _lof2 _lof
  124. #define _f2tol _dtol
  125. #define _ltof2 _ltod
  126. #define _amem8_f2 _amemd8
  127. #define _amem8_f2_const _amemd8_const
  128. /* _mem8_f2 and _mem8_f2_const for C6400 and compatible */
  129. #if defined(_TMS320C6400) || defined (_TMS320C6740) || \
  130. defined(_TMS320C6600)
  131. #define _mem8_f2 _memd8
  132. #define _mem8_f2_const _memd8_const
  133. #endif
  134. /* _fdmv_f2 for C6400+ and compatible */
  135. #if defined(_TMS320C6400_PLUS) || defined(_TMS320C6740) || \
  136. defined(_TMS320C6600)
  137. #define _fdmv_f2 _fdmv
  138. #endif
  139. /* __float2_t manipulation intrinsics for __x128_t and C6600 */
  140. #ifdef _TMS320C6600
  141. #define _hif2_128 _hid128
  142. #define _lof2_128 _lod128
  143. #define _f2to128 _dto128
  144. #define _fdmvd_f2 _fdmvd
  145. #endif
  146. #endif
  147. unsigned _extu (unsigned, unsigned, unsigned);
  148. int _ext (int, unsigned, unsigned);
  149. unsigned _set (unsigned, unsigned, unsigned);
  150. unsigned _clr (unsigned, unsigned, unsigned);
  151. unsigned _extur (unsigned, int);
  152. int _extr (int, int);
  153. unsigned _setr (unsigned, int);
  154. unsigned _clrr (unsigned, int);
  155. int _sadd (int, int);
  156. int _ssub (int, int);
  157. int _sshl (int, unsigned);
  158. int _add2 (int, int);
  159. int _sub2 (int, int);
  160. unsigned _subc (unsigned, unsigned);
  161. unsigned _lmbd (unsigned, unsigned);
  162. int _abs (int);
  163. __int40_t _labs (__int40_t);
  164. unsigned _norm (int);
  165. int _smpy (int, int);
  166. int _smpyhl (int, int);
  167. int _smpylh (int, int);
  168. int _smpyh (int, int);
  169. int _mpy (int, int);
  170. int _mpyus (unsigned, int);
  171. int _mpysu (int, unsigned);
  172. unsigned _mpyu (unsigned, unsigned);
  173. int _mpyhl (int, int);
  174. int _mpyhuls (unsigned, int);
  175. int _mpyhslu (int, unsigned);
  176. unsigned _mpyhlu (unsigned, unsigned);
  177. int _mpylh (int, int);
  178. int _mpyluhs (unsigned, int);
  179. int _mpylshu (int, unsigned);
  180. unsigned _mpylhu (unsigned, unsigned);
  181. int _mpyh (int, int);
  182. int _mpyhus (unsigned, int);
  183. int _mpyhsu (int, unsigned);
  184. unsigned _mpyhu (unsigned, unsigned);
  185. __int40_t _lsadd (int, __int40_t);
  186. __int40_t _lssub (int, __int40_t);
  187. int _sat (__int40_t);
  188. unsigned _lnorm (__int40_t);
  189. #ifdef _TMS320C6700
  190. double _fabs (double);
  191. float _fabsf (float);
  192. long long _mpyidll (int, int);
  193. int _spint (float);
  194. int _dpint (double);
  195. float _rcpsp (float);
  196. double _rcpdp (double);
  197. float _rsqrsp (float);
  198. double _rsqrdp (double);
  199. /*double _mpyid (int, int); Deprecated. Use _mpyidll instead. */
  200. #endif
  201. unsigned _hi(double); /* Return the hi 32 bits of a double as an int */
  202. float _hif(double); /* Return the hi 32 bits of a double as a float */
  203. unsigned _hill(long long); /* Return the hi 32 bits of a long long as an int */
  204. unsigned _lo(double); /* Return the lo 32 bits of a double as an int */
  205. float _lof(double); /* Return the lo 32 bits of a double as a float */
  206. unsigned _loll(long long); /* Return the lo 32 bits of a long long as an int */
  207. double _itod(unsigned, unsigned); /* Create a double from 2 ints */
  208. double _ftod(float, float); /* Create a double from 2 floats */
  209. long long _itoll(unsigned, unsigned); /* Create a long long from 2 ints */
  210. float _itof(unsigned); /* Reinterpret int as float. */
  211. unsigned _ftoi(float); /* Reinterpret float as int. */
  212. __int40_t _dtol(double); /* Reinterpret double as 40-bit type */
  213. double _ltod(__int40_t); /* Reinterpret 40-bit type as double */
  214. long long _dtoll(double); /* Reinterpret double as long long */
  215. double _lltod(long long); /* Reinterpret long long as double */
  216. #if defined(_TMS320C6400) || defined(_TMS320C6740) || defined(_TMS320C6600)
  217. /* Define pseudo intrinsics for some pseudo instructions */
  218. #ifndef _cmplt2
  219. #define _cmplt2(src1, src2) _cmpgt2((src2), (src1))
  220. #endif
  221. #ifndef _cmpltu4
  222. #define _cmpltu4(src1, src2) _cmpgtu4((src2), (src1))
  223. #endif
  224. #ifndef _dotpnrus2
  225. #define _dotpnrus2(src1, src2) _dotpnrsu2((src2), (src1))
  226. #endif
  227. #ifndef _dotpus4
  228. #define _dotpus4(src1, src2) _dotpsu4((src2), (src1))
  229. #endif
  230. #ifndef _mpyihll
  231. #define _mpyihll(src1, src2) _mpyhill((src2), (src1))
  232. #endif
  233. #ifndef _mpyihr
  234. #define _mpyihr(src1, src2) _mpyhir((src2), (src1))
  235. #endif
  236. #ifndef _mpyilll
  237. #define _mpyilll(src1, src2) _mpylill((src2), (src1))
  238. #endif
  239. #ifndef _mpyilr
  240. #define _mpyilr(src1, src2) _mpylir((src2), (src1))
  241. #endif
  242. #ifndef _mpyus4ll
  243. #define _mpyus4ll(src1, src2) _mpysu4ll((src2), (src1))
  244. #endif
  245. #ifndef _saddsu2
  246. #define _saddsu2(src1, src2) _saddus2((src2), (src1))
  247. #endif
  248. #ifndef _swap2
  249. #define _swap2(src) _packlh2((src), (src))
  250. #endif
  251. int _add4 (int, int);
  252. int _avg2 (int, int);
  253. unsigned _avgu4 (unsigned, unsigned);
  254. int _cmpeq2 (int, int);
  255. int _cmpeq4 (int, int);
  256. int _cmpgt2 (int, int);
  257. unsigned _cmpgtu4 (unsigned, unsigned);
  258. int _dotp2 (int, int);
  259. int _dotpn2 (int, int);
  260. int _dotpnrsu2 (int, unsigned);
  261. int _dotprsu2 (int, unsigned);
  262. int _dotpsu4 (int, unsigned);
  263. unsigned _dotpu4 (unsigned, unsigned);
  264. int _gmpy4 (int, int);
  265. __int40_t _ldotp2 (int, int);
  266. int _max2 (int, int);
  267. unsigned _maxu4 (unsigned, unsigned);
  268. int _min2 (int, int);
  269. unsigned _minu4 (unsigned, unsigned);
  270. long long _mpy2ll (int, int);
  271. long long _mpyhill (int, int);
  272. int _mpyhir (int, int);
  273. long long _mpylill (int, int);
  274. int _mpylir (int, int);
  275. long long _mpysu4ll (int, unsigned);
  276. long long _mpyu4ll (unsigned, unsigned);
  277. unsigned _pack2 (unsigned, unsigned);
  278. unsigned _packh2 (unsigned, unsigned);
  279. unsigned _packh4 (unsigned, unsigned);
  280. unsigned _packhl2 (unsigned, unsigned);
  281. unsigned _packl4 (unsigned, unsigned);
  282. unsigned _packlh2 (unsigned, unsigned);
  283. unsigned _rotl (unsigned, unsigned);
  284. int _sadd2 (int, int);
  285. unsigned _saddu4 (unsigned, unsigned);
  286. int _saddus2 (unsigned, int);
  287. unsigned _shlmb (unsigned, unsigned);
  288. int _shr2 (int, unsigned);
  289. unsigned _shrmb (unsigned, unsigned);
  290. unsigned _shru2 (unsigned, unsigned);
  291. long long _smpy2ll (int, int);
  292. int _spack2 (int, int);
  293. unsigned _spacku4 (int, int);
  294. int _sshvl (int, int);
  295. int _sshvr (int, int);
  296. int _sub4 (int, int);
  297. int _subabs4 (int, int);
  298. int _abs2 (int);
  299. unsigned _bitc4 (unsigned);
  300. unsigned _bitr (unsigned);
  301. unsigned _deal (unsigned);
  302. int _mvd (int);
  303. unsigned _shfl (unsigned);
  304. unsigned _swap4 (unsigned);
  305. unsigned _unpkhu4 (unsigned);
  306. unsigned _unpklu4 (unsigned);
  307. unsigned _xpnd2 (unsigned);
  308. unsigned _xpnd4 (unsigned);
  309. /*double _mpy2 (int, int); Deprecated: use _mpy2ll instead */
  310. /*double _mpyhi (int, int); Deprecated: use _mpyhill instead */
  311. /*double _mpysu4 (int, unsigned); Deprecated: use _mpysu4ll instead */
  312. /*double _mpyu4 (unsigned, unsigned); Deprecated: use _mpyu4ll instead */
  313. /*double _smpy2 (int, int); Deprecated: use _smpy2ll instead */
  314. #endif
  315. #if defined(_TMS320C6400_PLUS) || defined(_TMS320C6740) || defined(_TMS320C6600)
  316. long long _addsub (int, int);
  317. long long _addsub2 (unsigned, unsigned);
  318. long long _cmpy (unsigned, unsigned);
  319. unsigned _cmpyr (unsigned, unsigned);
  320. unsigned _cmpyr1 (unsigned, unsigned);
  321. long long _ddotph2 (long long, unsigned);
  322. unsigned _ddotph2r (long long, unsigned);
  323. long long _ddotpl2 (long long, unsigned);
  324. unsigned _ddotpl2r (long long, unsigned);
  325. long long _ddotp4 (unsigned, unsigned);
  326. long long _dpack2 (unsigned, unsigned);
  327. long long _dpackx2 (unsigned, unsigned);
  328. long long _dmv (unsigned, unsigned);
  329. double _fdmv (float, float);
  330. unsigned _gmpy (unsigned, unsigned);
  331. long long _mpy32ll (int, int);
  332. int _mpy32 (int, int);
  333. long long _mpy32su (int, unsigned);
  334. long long _mpy32us (unsigned, int);
  335. long long _mpy32u (unsigned, unsigned);
  336. long long _mpy2ir (unsigned, int);
  337. unsigned _rpack2 (unsigned, unsigned);
  338. long long _saddsub (int, int);
  339. long long _saddsub2 (unsigned, unsigned);
  340. long long _shfl3 (unsigned, unsigned);
  341. int _smpy32 (int, int);
  342. int _ssub2 (int, int);
  343. unsigned _xormpy (unsigned, unsigned);
  344. #endif
  345. #if defined(_TMS320C6600)
  346. long long _dcmpyr1 (long long, long long);
  347. long long _dccmpyr1 (long long, long long);
  348. long long _cmpy32r1 (long long, long long);
  349. long long _ccmpy32r1 (long long, long long);
  350. long long _mpyu2 (unsigned, unsigned);
  351. int _dotp4h (long long, long long);
  352. long long _dotp4hll (long long, long long);
  353. int _dotpsu4h (long long, long long);
  354. long long _dotpsu4hll (long long, long long);
  355. long long _dadd (long long, long long);
  356. long long _dadd_c (int, long long);
  357. long long _dsadd (long long, long long);
  358. long long _dadd2 (long long, long long);
  359. long long _dsadd2 (long long, long long);
  360. long long _dsub (long long, long long);
  361. long long _dssub (long long, long long);
  362. long long _dssub2 (long long, long long);
  363. long long _dapys2 (long long, long long);
  364. long long _dshr (long long, unsigned);
  365. long long _dshru (long long, unsigned);
  366. long long _dshl (long long, unsigned);
  367. long long _dshr2 (long long, unsigned);
  368. long long _dshru2 (long long, unsigned);
  369. unsigned _shl2 (unsigned , unsigned);
  370. long long _dshl2 (long long, unsigned);
  371. long long _dxpnd4 (unsigned);
  372. long long _dxpnd2 (unsigned);
  373. int _crot90 (int);
  374. long long _dcrot90 (long long);
  375. int _crot270 (int);
  376. long long _dcrot270 (long long);
  377. long long _dmax2 (long long, long long);
  378. long long _dmin2 (long long, long long);
  379. long long _dmaxu4 (long long, long long);
  380. long long _dminu4 (long long, long long);
  381. unsigned _dcmpgt2 (long long, long long);
  382. unsigned _dcmpeq2 (long long, long long);
  383. unsigned _dcmpgtu4 (long long, long long);
  384. unsigned _dcmpeq4 (long long, long long);
  385. long long _davg2 (long long, long long);
  386. long long _davgu4 (long long, long long);
  387. long long _davgnr2 (long long, long long);
  388. long long _davgnru4 (long long, long long);
  389. long long _unpkbu4 (unsigned);
  390. long long _unpkh2 (unsigned);
  391. long long _unpkhu2 (unsigned);
  392. long long _dpackl2 (long long, long long);
  393. long long _dpackh2 (long long, long long);
  394. long long _dpackhl2 (long long, long long);
  395. long long _dpacklh4 (unsigned, unsigned);
  396. long long _dpackl4 (long long, long long);
  397. long long _dpackh4 (long long, long long);
  398. long long _dspacku4 (long long, long long);
  399. void _mfence ();
  400. __float2_t _dmpysp (__float2_t, __float2_t);
  401. __float2_t _daddsp (__float2_t, __float2_t);
  402. __float2_t _dsubsp (__float2_t, __float2_t);
  403. __float2_t _dinthsp (unsigned);
  404. __float2_t _dinthspu (unsigned);
  405. __float2_t _dintsp (long long);
  406. __float2_t _dintspu (long long);
  407. unsigned _dspinth (__float2_t);
  408. long long _dspint (__float2_t);
  409. int _land (int, int);
  410. int _landn (int, int);
  411. int _lor (int, int);
  412. long long _dmvd (int, int);
  413. double _fdmvd (float, float);
  414. __float2_t _complex_mpysp (__float2_t, __float2_t); /* CMPYSP then DADDSP */
  415. __float2_t _complex_conjugate_mpysp (__float2_t, __float2_t); /* CMPYSP then DSUBSP */
  416. long long _xorll_c (int, long long);
  417. __x128_t __BUILTIN _dcmpy (long long, long long);
  418. __x128_t __BUILTIN _dccmpy (long long, long long);
  419. long long __BUILTIN _cmatmpyr1 (long long, __x128_t);
  420. long long __BUILTIN _ccmatmpyr1 (long long, __x128_t);
  421. __x128_t __BUILTIN _cmatmpy (long long, __x128_t);
  422. __x128_t __BUILTIN _ccmatmpy (long long, __x128_t);
  423. __x128_t __BUILTIN _qsmpy32r1 (__x128_t, __x128_t);
  424. __x128_t __BUILTIN _qmpy32 (__x128_t, __x128_t);
  425. __x128_t __BUILTIN _dsmpy2 (long long, long long);
  426. __x128_t __BUILTIN _dmpy2 (long long, long long);
  427. __x128_t __BUILTIN _dmpyu2 (long long, long long);
  428. __x128_t __BUILTIN _dmpysu4 (long long, long long);
  429. __x128_t __BUILTIN _dmpyu4 (long long, long long);
  430. __x128_t __BUILTIN _cmpysp (__float2_t, __float2_t);
  431. __x128_t __BUILTIN _qmpysp (__x128_t, __x128_t);
  432. long long __BUILTIN _ddotp4h (__x128_t, __x128_t);
  433. long long __BUILTIN _ddotpsu4h (__x128_t, __x128_t);
  434. __x128_t __BUILTIN _ito128 (unsigned, unsigned, unsigned, unsigned);
  435. __x128_t __BUILTIN _fto128 (float, float, float, float);
  436. __x128_t __BUILTIN _llto128 (long long, long long);
  437. __x128_t __BUILTIN _dto128 (double, double);
  438. long long __BUILTIN _hi128 (__x128_t);
  439. double __BUILTIN _hid128 (__x128_t);
  440. long long __BUILTIN _lo128 (__x128_t);
  441. double __BUILTIN _lod128 (__x128_t);
  442. unsigned __BUILTIN _get32_128 (__x128_t, __CONST(0,3) unsigned);
  443. float __BUILTIN _get32f_128 (__x128_t, __CONST(0,3) unsigned);
  444. __x128_t __BUILTIN _dup32_128 (unsigned);
  445. #endif
  446. extern __cregister volatile unsigned int AMR;
  447. extern __cregister volatile unsigned int CSR;
  448. extern __cregister volatile unsigned int IFR;
  449. extern __cregister volatile unsigned int ISR;
  450. extern __cregister volatile unsigned int ICR;
  451. extern __cregister volatile unsigned int IER;
  452. extern __cregister volatile unsigned int ISTP;
  453. extern __cregister volatile unsigned int IRP;
  454. extern __cregister volatile unsigned int NRP;
  455. #if defined(_TMS320C6400) || defined(_TMS320C6740) || defined(_TMS320C6600)
  456. extern __cregister volatile unsigned int GFPGFR;
  457. extern __cregister volatile unsigned int DIER;
  458. #endif
  459. #ifdef _TMS320C6700
  460. extern __cregister volatile unsigned int FADCR;
  461. extern __cregister volatile unsigned int FAUCR;
  462. extern __cregister volatile unsigned int FMCR;
  463. #endif
  464. #ifdef _TMS320C6700_PLUS
  465. extern __cregister volatile unsigned int DESR;
  466. extern __cregister volatile unsigned int DETR;
  467. #endif
  468. #if defined(_TMS320C6400_PLUS) || defined(_TMS320C6740) || defined(_TMS320C6600)
  469. extern __cregister volatile unsigned int REP;
  470. extern __cregister volatile unsigned int TSCL;
  471. extern __cregister volatile unsigned int TSCH;
  472. extern __cregister volatile unsigned int ARP;
  473. extern __cregister volatile unsigned int ILC;
  474. extern __cregister volatile unsigned int RILC;
  475. extern __cregister volatile unsigned int PCE1;
  476. extern __cregister volatile unsigned int DNUM;
  477. extern __cregister volatile unsigned int SSR;
  478. extern __cregister volatile unsigned int GPLYA;
  479. extern __cregister volatile unsigned int GPLYB;
  480. extern __cregister volatile unsigned int TSR;
  481. extern __cregister volatile unsigned int ITSR;
  482. extern __cregister volatile unsigned int NTSR;
  483. extern __cregister volatile unsigned int ECR;
  484. extern __cregister volatile unsigned int EFR;
  485. extern __cregister volatile unsigned int IERR;
  486. extern __cregister volatile unsigned int DMSG;
  487. extern __cregister volatile unsigned int CMSG;
  488. extern __cregister volatile unsigned int DT_DMA_ADDR;
  489. extern __cregister volatile unsigned int DT_DMA_DATA;
  490. extern __cregister volatile unsigned int DT_DMA_CNTL;
  491. extern __cregister volatile unsigned int TCU_CNTL;
  492. extern __cregister volatile unsigned int RTDX_REC_CNTL;
  493. extern __cregister volatile unsigned int RTDX_XMT_CNTL;
  494. extern __cregister volatile unsigned int RTDX_CFG;
  495. extern __cregister volatile unsigned int RTDX_RDATA;
  496. extern __cregister volatile unsigned int RTDX_WDATA;
  497. extern __cregister volatile unsigned int RTDX_RADDR;
  498. extern __cregister volatile unsigned int RTDX_WADDR;
  499. extern __cregister volatile unsigned int MFREG0;
  500. extern __cregister volatile unsigned int DBG_STAT;
  501. extern __cregister volatile unsigned int BRK_EN;
  502. extern __cregister volatile unsigned int HWBP0_CNT;
  503. extern __cregister volatile unsigned int HWBP0;
  504. extern __cregister volatile unsigned int HWBP1;
  505. extern __cregister volatile unsigned int HWBP2;
  506. extern __cregister volatile unsigned int HWBP3;
  507. extern __cregister volatile unsigned int OVERLAY;
  508. extern __cregister volatile unsigned int PC_PROF;
  509. extern __cregister volatile unsigned int ATSR;
  510. extern __cregister volatile unsigned int TRR;
  511. extern __cregister volatile unsigned int TCRR;
  512. #endif
  513. #ifdef __cplusplus
  514. } /* extern "C" */
  515. #endif /* __cplusplus */
  516. /*****************************************************************************/
  517. /* DATA_IS_ALIGNED_2, DATA_IS_ALIGNED_4, DATA_IS_ALIGNED_8 - */
  518. /* Tell the compiler that data is already aligned to a 2-byte, 4-byte */
  519. /* or 8-byte boundary. Note: this macro does not change the */
  520. /* alignment of data. Use DATA_ALIGN to change alignment. */
  521. /*****************************************************************************/
  522. #define DATA_IS_ALIGNED_2(x) (_nassert(((unsigned int)(x) & 0x1) == 0))
  523. #define DATA_IS_ALIGNED_4(x) (_nassert(((unsigned int)(x) & 0x3) == 0))
  524. #define DATA_IS_ALIGNED_8(x) (_nassert(((unsigned int)(x) & 0x7) == 0))
  525. /*****************************************************************************/
  526. /* SAVE_AMR - */
  527. /* Define a local 'volatile unsigned int' variable in your interrupt */
  528. /* routine. */
  529. /* When invoking this macro, pass that local variable to save the AMR. */
  530. /* */
  531. /* If you interrupted an assembly coded routine that may be using */
  532. /* circular addressing, and you interrupt into a C coded interrupt */
  533. /* service routine, you need to set the AMR to 0 for the C code and save */
  534. /* off the AMR register, so that it will have the correct value upon */
  535. /* leaving the C interrupt service routine and returning to the assembly */
  536. /* code. */
  537. /* */
  538. /* Add this routine immediately after your local variable definitions */
  539. /* and before the start of your C interrupt code. */
  540. /*****************************************************************************/
  541. #define SAVE_AMR(temp_AMR) \
  542. do { \
  543. temp_AMR = AMR; \
  544. AMR = 0; \
  545. } while (0)
  546. /*****************************************************************************/
  547. /* RESTORE_AMR - */
  548. /* When invoking this macro, pass the same local variable that was passed */
  549. /* to the SAVE_AMR macro. This macro will restore the AMR to the value */
  550. /* it had when interrupted out of the hand assembly routine. */
  551. /* */
  552. /* Add this macro immediately before exiting the C interrupt service */
  553. /* routine. */
  554. /*****************************************************************************/
  555. #define RESTORE_AMR(temp_AMR) \
  556. do { \
  557. AMR = temp_AMR; \
  558. } while (0)
  559. /*****************************************************************************/
  560. /* SAVE_SAT - */
  561. /* Define a local 'volatile unsigned int' variable in your interrupt */
  562. /* routine. */
  563. /* When invoking this macro, pass that local variable to save the SAT */
  564. /* bit. */
  565. /* */
  566. /* If you interrupted a routine that was performing saturated arithmetic */
  567. /* and the interrupt service routine is also performing saturated */
  568. /* arithmetic, then you must save and restore the SAT bit in your */
  569. /* interrupt service routine. */
  570. /* */
  571. /* Add this routine immediately after your local variable definitions */
  572. /* and before the start of your C interrupt code. */
  573. /*****************************************************************************/
  574. #define SAVE_SAT(temp_SAT) \
  575. do { \
  576. temp_SAT = _extu(CSR, 22, 31); \
  577. } while (0)
  578. /*****************************************************************************/
  579. /* RESTORE_SAT - */
  580. /* When invoking this macro, pass the same local variable that was passed */
  581. /* to the SAVE_SAT macro. This macro will restore the SAT bit to the */
  582. /* value it had when your application was interrupted. */
  583. /* */
  584. /* Add this macro immediately before exiting the C interrupt service */
  585. /* routine. */
  586. /*****************************************************************************/
  587. #define RESTORE_SAT(temp_SAT) \
  588. do { \
  589. CSR = _clr(CSR, 9, 9); \
  590. temp_SAT = _sshl(temp_SAT, 31); \
  591. } while (0)