tie-asm.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /*
  2. * This header file contains assembly-language definitions (assembly
  3. * macros, etc.) for this specific Xtensa processor's TIE extensions
  4. * and options. It is customized to this Xtensa processor configuration.
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. *
  10. * Copyright (C) 1999-2008 Tensilica Inc.
  11. */
  12. #ifndef _XTENSA_CORE_TIE_ASM_H
  13. #define _XTENSA_CORE_TIE_ASM_H
  14. /* Selection parameter values for save-area save/restore macros: */
  15. /* Option vs. TIE: */
  16. #define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */
  17. #define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */
  18. /* Whether used automatically by compiler: */
  19. #define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */
  20. #define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */
  21. /* ABI handling across function calls: */
  22. #define XTHAL_SAS_CALR 0x0010 /* caller-saved */
  23. #define XTHAL_SAS_CALE 0x0020 /* callee-saved */
  24. #define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */
  25. /* Misc */
  26. #define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */
  27. /* Macro to save all non-coprocessor (extra) custom TIE and optional state
  28. * (not including zero-overhead loop registers).
  29. * Save area ptr (clobbered): ptr (16 byte aligned)
  30. * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
  31. */
  32. .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
  33. xchal_sa_start \continue, \ofs
  34. .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
  35. xchal_sa_align \ptr, 0, 1024-4, 4, 4
  36. rsr \at1, BR // boolean option
  37. s32i \at1, \ptr, .Lxchal_ofs_ + 0
  38. .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
  39. .endif
  40. .endm // xchal_ncp_store
  41. /* Macro to save all non-coprocessor (extra) custom TIE and optional state
  42. * (not including zero-overhead loop registers).
  43. * Save area ptr (clobbered): ptr (16 byte aligned)
  44. * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
  45. */
  46. .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
  47. xchal_sa_start \continue, \ofs
  48. .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
  49. xchal_sa_align \ptr, 0, 1024-4, 4, 4
  50. l32i \at1, \ptr, .Lxchal_ofs_ + 0
  51. wsr \at1, BR // boolean option
  52. .set .Lxchal_ofs_, .Lxchal_ofs_ + 4
  53. .endif
  54. .endm // xchal_ncp_load
  55. #define XCHAL_NCP_NUM_ATMPS 1
  56. /* Macro to save the state of TIE coprocessor FPU.
  57. * Save area ptr (clobbered): ptr (16 byte aligned)
  58. * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP0_NUM_ATMPS needed)
  59. */
  60. #define xchal_cp_FPU_store xchal_cp0_store
  61. /* #define xchal_cp_FPU_store_a2 xchal_cp0_store a2 a3 a4 a5 a6 */
  62. .macro xchal_cp0_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
  63. xchal_sa_start \continue, \ofs
  64. .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
  65. xchal_sa_align \ptr, 0, 0, 1, 16
  66. rur232 \at1 // FCR
  67. s32i \at1, \ptr, 0
  68. rur233 \at1 // FSR
  69. s32i \at1, \ptr, 4
  70. SSI f0, \ptr, 8
  71. SSI f1, \ptr, 12
  72. SSI f2, \ptr, 16
  73. SSI f3, \ptr, 20
  74. SSI f4, \ptr, 24
  75. SSI f5, \ptr, 28
  76. SSI f6, \ptr, 32
  77. SSI f7, \ptr, 36
  78. SSI f8, \ptr, 40
  79. SSI f9, \ptr, 44
  80. SSI f10, \ptr, 48
  81. SSI f11, \ptr, 52
  82. SSI f12, \ptr, 56
  83. SSI f13, \ptr, 60
  84. SSI f14, \ptr, 64
  85. SSI f15, \ptr, 68
  86. .set .Lxchal_ofs_, .Lxchal_ofs_ + 72
  87. .endif
  88. .endm // xchal_cp0_store
  89. /* Macro to restore the state of TIE coprocessor FPU.
  90. * Save area ptr (clobbered): ptr (16 byte aligned)
  91. * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP0_NUM_ATMPS needed)
  92. */
  93. #define xchal_cp_FPU_load xchal_cp0_load
  94. /* #define xchal_cp_FPU_load_a2 xchal_cp0_load a2 a3 a4 a5 a6 */
  95. .macro xchal_cp0_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
  96. xchal_sa_start \continue, \ofs
  97. .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
  98. xchal_sa_align \ptr, 0, 0, 1, 16
  99. l32i \at1, \ptr, 0
  100. wur232 \at1 // FCR
  101. l32i \at1, \ptr, 4
  102. wur233 \at1 // FSR
  103. LSI f0, \ptr, 8
  104. LSI f1, \ptr, 12
  105. LSI f2, \ptr, 16
  106. LSI f3, \ptr, 20
  107. LSI f4, \ptr, 24
  108. LSI f5, \ptr, 28
  109. LSI f6, \ptr, 32
  110. LSI f7, \ptr, 36
  111. LSI f8, \ptr, 40
  112. LSI f9, \ptr, 44
  113. LSI f10, \ptr, 48
  114. LSI f11, \ptr, 52
  115. LSI f12, \ptr, 56
  116. LSI f13, \ptr, 60
  117. LSI f14, \ptr, 64
  118. LSI f15, \ptr, 68
  119. .set .Lxchal_ofs_, .Lxchal_ofs_ + 72
  120. .endif
  121. .endm // xchal_cp0_load
  122. #define XCHAL_CP0_NUM_ATMPS 1
  123. /* Macro to save the state of TIE coprocessor XAD.
  124. * Save area ptr (clobbered): ptr (16 byte aligned)
  125. * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP6_NUM_ATMPS needed)
  126. */
  127. #define xchal_cp_XAD_store xchal_cp6_store
  128. /* #define xchal_cp_XAD_store_a2 xchal_cp6_store a2 a3 a4 a5 a6 */
  129. .macro xchal_cp6_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
  130. xchal_sa_start \continue, \ofs
  131. .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
  132. xchal_sa_align \ptr, 0, 0, 1, 16
  133. rur0 \at1 // LDCBHI
  134. s32i \at1, \ptr, 0
  135. rur1 \at1 // LDCBLO
  136. s32i \at1, \ptr, 4
  137. rur2 \at1 // STCBHI
  138. s32i \at1, \ptr, 8
  139. rur3 \at1 // STCBLO
  140. s32i \at1, \ptr, 12
  141. rur8 \at1 // LDBRBASE
  142. s32i \at1, \ptr, 16
  143. rur9 \at1 // LDBROFF
  144. s32i \at1, \ptr, 20
  145. rur10 \at1 // LDBRINC
  146. s32i \at1, \ptr, 24
  147. rur11 \at1 // STBRBASE
  148. s32i \at1, \ptr, 28
  149. rur12 \at1 // STBROFF
  150. s32i \at1, \ptr, 32
  151. rur13 \at1 // STBRINC
  152. s32i \at1, \ptr, 36
  153. rur24 \at1 // SCRATCH0
  154. s32i \at1, \ptr, 40
  155. rur25 \at1 // SCRATCH1
  156. s32i \at1, \ptr, 44
  157. rur26 \at1 // SCRATCH2
  158. s32i \at1, \ptr, 48
  159. rur27 \at1 // SCRATCH3
  160. s32i \at1, \ptr, 52
  161. WRAS128I wra0, \ptr, 64
  162. WRAS128I wra1, \ptr, 80
  163. WRAS128I wra2, \ptr, 96
  164. WRAS128I wra3, \ptr, 112
  165. WRAS128I wra4, \ptr, 128
  166. WRAS128I wra5, \ptr, 144
  167. WRAS128I wra6, \ptr, 160
  168. WRAS128I wra7, \ptr, 176
  169. WRAS128I wra8, \ptr, 192
  170. WRAS128I wra9, \ptr, 208
  171. WRAS128I wra10, \ptr, 224
  172. WRAS128I wra11, \ptr, 240
  173. WRAS128I wra12, \ptr, 256
  174. WRAS128I wra13, \ptr, 272
  175. WRAS128I wra14, \ptr, 288
  176. WRAS128I wra15, \ptr, 304
  177. WRBS128I wrb0, \ptr, 320
  178. WRBS128I wrb1, \ptr, 336
  179. WRBS128I wrb2, \ptr, 352
  180. WRBS128I wrb3, \ptr, 368
  181. WRBS128I wrb4, \ptr, 384
  182. WRBS128I wrb5, \ptr, 400
  183. WRBS128I wrb6, \ptr, 416
  184. WRBS128I wrb7, \ptr, 432
  185. WRBS128I wrb8, \ptr, 448
  186. WRBS128I wrb9, \ptr, 464
  187. WRBS128I wrb10, \ptr, 480
  188. WRBS128I wrb11, \ptr, 496
  189. WRBS128I wrb12, \ptr, 512
  190. WRBS128I wrb13, \ptr, 528
  191. WRBS128I wrb14, \ptr, 544
  192. WRBS128I wrb15, \ptr, 560
  193. .set .Lxchal_ofs_, .Lxchal_ofs_ + 576
  194. .endif
  195. .endm // xchal_cp6_store
  196. /* Macro to restore the state of TIE coprocessor XAD.
  197. * Save area ptr (clobbered): ptr (16 byte aligned)
  198. * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP6_NUM_ATMPS needed)
  199. */
  200. #define xchal_cp_XAD_load xchal_cp6_load
  201. /* #define xchal_cp_XAD_load_a2 xchal_cp6_load a2 a3 a4 a5 a6 */
  202. .macro xchal_cp6_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL
  203. xchal_sa_start \continue, \ofs
  204. .ifeq (XTHAL_SAS_TIE | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select
  205. xchal_sa_align \ptr, 0, 0, 1, 16
  206. l32i \at1, \ptr, 0
  207. wur0 \at1 // LDCBHI
  208. l32i \at1, \ptr, 4
  209. wur1 \at1 // LDCBLO
  210. l32i \at1, \ptr, 8
  211. wur2 \at1 // STCBHI
  212. l32i \at1, \ptr, 12
  213. wur3 \at1 // STCBLO
  214. l32i \at1, \ptr, 16
  215. wur8 \at1 // LDBRBASE
  216. l32i \at1, \ptr, 20
  217. wur9 \at1 // LDBROFF
  218. l32i \at1, \ptr, 24
  219. wur10 \at1 // LDBRINC
  220. l32i \at1, \ptr, 28
  221. wur11 \at1 // STBRBASE
  222. l32i \at1, \ptr, 32
  223. wur12 \at1 // STBROFF
  224. l32i \at1, \ptr, 36
  225. wur13 \at1 // STBRINC
  226. l32i \at1, \ptr, 40
  227. wur24 \at1 // SCRATCH0
  228. l32i \at1, \ptr, 44
  229. wur25 \at1 // SCRATCH1
  230. l32i \at1, \ptr, 48
  231. wur26 \at1 // SCRATCH2
  232. l32i \at1, \ptr, 52
  233. wur27 \at1 // SCRATCH3
  234. WRBL128I wrb0, \ptr, 320
  235. WRBL128I wrb1, \ptr, 336
  236. WRBL128I wrb2, \ptr, 352
  237. WRBL128I wrb3, \ptr, 368
  238. WRBL128I wrb4, \ptr, 384
  239. WRBL128I wrb5, \ptr, 400
  240. WRBL128I wrb6, \ptr, 416
  241. WRBL128I wrb7, \ptr, 432
  242. WRBL128I wrb8, \ptr, 448
  243. WRBL128I wrb9, \ptr, 464
  244. WRBL128I wrb10, \ptr, 480
  245. WRBL128I wrb11, \ptr, 496
  246. WRBL128I wrb12, \ptr, 512
  247. WRBL128I wrb13, \ptr, 528
  248. WRBL128I wrb14, \ptr, 544
  249. WRBL128I wrb15, \ptr, 560
  250. WRAL128I wra0, \ptr, 64
  251. WRAL128I wra1, \ptr, 80
  252. WRAL128I wra2, \ptr, 96
  253. WRAL128I wra3, \ptr, 112
  254. WRAL128I wra4, \ptr, 128
  255. WRAL128I wra5, \ptr, 144
  256. WRAL128I wra6, \ptr, 160
  257. WRAL128I wra7, \ptr, 176
  258. WRAL128I wra8, \ptr, 192
  259. WRAL128I wra9, \ptr, 208
  260. WRAL128I wra10, \ptr, 224
  261. WRAL128I wra11, \ptr, 240
  262. WRAL128I wra12, \ptr, 256
  263. WRAL128I wra13, \ptr, 272
  264. WRAL128I wra14, \ptr, 288
  265. WRAL128I wra15, \ptr, 304
  266. .set .Lxchal_ofs_, .Lxchal_ofs_ + 576
  267. .endif
  268. .endm // xchal_cp6_load
  269. #define XCHAL_CP6_NUM_ATMPS 1
  270. #define XCHAL_SA_NUM_ATMPS 1
  271. /* Empty macros for unconfigured coprocessors: */
  272. .macro xchal_cp1_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
  273. .macro xchal_cp1_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
  274. .macro xchal_cp2_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
  275. .macro xchal_cp2_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
  276. .macro xchal_cp3_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
  277. .macro xchal_cp3_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
  278. .macro xchal_cp4_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
  279. .macro xchal_cp4_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
  280. .macro xchal_cp5_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
  281. .macro xchal_cp5_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
  282. .macro xchal_cp7_store p a b c d continue=0 ofs=-1 select=-1 ; .endm
  283. .macro xchal_cp7_load p a b c d continue=0 ofs=-1 select=-1 ; .endm
  284. #endif /*_XTENSA_CORE_TIE_ASM_H*/