You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1854 lines
89KB

  1. /*
  2. * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com)
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVUTIL_MIPS_GENERIC_MACROS_MSA_H
  21. #define AVUTIL_MIPS_GENERIC_MACROS_MSA_H
  22. #include <stdint.h>
  23. #include <msa.h>
  24. #define LD_B(RTYPE, psrc) *((RTYPE *)(psrc))
  25. #define LD_UB(...) LD_B(v16u8, __VA_ARGS__)
  26. #define LD_SB(...) LD_B(v16i8, __VA_ARGS__)
  27. #define LD_H(RTYPE, psrc) *((RTYPE *)(psrc))
  28. #define LD_UH(...) LD_H(v8u16, __VA_ARGS__)
  29. #define LD_SH(...) LD_H(v8i16, __VA_ARGS__)
  30. #define LD_W(RTYPE, psrc) *((RTYPE *)(psrc))
  31. #define LD_UW(...) LD_W(v4u32, __VA_ARGS__)
  32. #define LD_SW(...) LD_W(v4i32, __VA_ARGS__)
  33. #define ST_B(RTYPE, in, pdst) *((RTYPE *)(pdst)) = (in)
  34. #define ST_UB(...) ST_B(v16u8, __VA_ARGS__)
  35. #define ST_SB(...) ST_B(v16i8, __VA_ARGS__)
  36. #define ST_H(RTYPE, in, pdst) *((RTYPE *)(pdst)) = (in)
  37. #define ST_UH(...) ST_H(v8u16, __VA_ARGS__)
  38. #define ST_SH(...) ST_H(v8i16, __VA_ARGS__)
  39. #define ST_W(RTYPE, in, pdst) *((RTYPE *)(pdst)) = (in)
  40. #define ST_UW(...) ST_W(v4u32, __VA_ARGS__)
  41. #define ST_SW(...) ST_W(v4i32, __VA_ARGS__)
  42. #if (__mips_isa_rev >= 6)
  43. #define LW(psrc) \
  44. ( { \
  45. uint8_t *psrc_m = (uint8_t *) (psrc); \
  46. uint32_t val_m; \
  47. \
  48. __asm__ volatile ( \
  49. "lw %[val_m], %[psrc_m] \n\t" \
  50. \
  51. : [val_m] "=r" (val_m) \
  52. : [psrc_m] "m" (*psrc_m) \
  53. ); \
  54. \
  55. val_m; \
  56. } )
  57. #if (__mips == 64)
  58. #define LD(psrc) \
  59. ( { \
  60. uint8_t *psrc_m = (uint8_t *) (psrc); \
  61. uint64_t val_m = 0; \
  62. \
  63. __asm__ volatile ( \
  64. "ld %[val_m], %[psrc_m] \n\t" \
  65. \
  66. : [val_m] "=r" (val_m) \
  67. : [psrc_m] "m" (*psrc_m) \
  68. ); \
  69. \
  70. val_m; \
  71. } )
  72. #else // !(__mips == 64)
  73. #define LD(psrc) \
  74. ( { \
  75. uint8_t *psrc_m = (uint8_t *) (psrc); \
  76. uint32_t val0_m, val1_m; \
  77. uint64_t val_m = 0; \
  78. \
  79. val0_m = LW(psrc_m); \
  80. val1_m = LW(psrc_m + 4); \
  81. \
  82. val_m = (uint64_t) (val1_m); \
  83. val_m = (uint64_t) ((val_m << 32) & 0xFFFFFFFF00000000); \
  84. val_m = (uint64_t) (val_m | (uint64_t) val0_m); \
  85. \
  86. val_m; \
  87. } )
  88. #endif // (__mips == 64)
  89. #define SH(val, pdst) \
  90. { \
  91. uint8_t *pdst_m = (uint8_t *) (pdst); \
  92. uint16_t val_m = (val); \
  93. \
  94. __asm__ volatile ( \
  95. "sh %[val_m], %[pdst_m] \n\t" \
  96. \
  97. : [pdst_m] "=m" (*pdst_m) \
  98. : [val_m] "r" (val_m) \
  99. ); \
  100. }
  101. #define SW(val, pdst) \
  102. { \
  103. uint8_t *pdst_m = (uint8_t *) (pdst); \
  104. uint32_t val_m = (val); \
  105. \
  106. __asm__ volatile ( \
  107. "sw %[val_m], %[pdst_m] \n\t" \
  108. \
  109. : [pdst_m] "=m" (*pdst_m) \
  110. : [val_m] "r" (val_m) \
  111. ); \
  112. }
  113. #define SD(val, pdst) \
  114. { \
  115. uint8_t *pdst_m = (uint8_t *) (pdst); \
  116. uint64_t val_m = (val); \
  117. \
  118. __asm__ volatile ( \
  119. "sd %[val_m], %[pdst_m] \n\t" \
  120. \
  121. : [pdst_m] "=m" (*pdst_m) \
  122. : [val_m] "r" (val_m) \
  123. ); \
  124. }
  125. #else // !(__mips_isa_rev >= 6)
  126. #define LW(psrc) \
  127. ( { \
  128. uint8_t *psrc_m = (uint8_t *) (psrc); \
  129. uint32_t val_m; \
  130. \
  131. __asm__ volatile ( \
  132. "ulw %[val_m], %[psrc_m] \n\t" \
  133. \
  134. : [val_m] "=r" (val_m) \
  135. : [psrc_m] "m" (*psrc_m) \
  136. ); \
  137. \
  138. val_m; \
  139. } )
  140. #if (__mips == 64)
  141. #define LD(psrc) \
  142. ( { \
  143. uint8_t *psrc_m = (uint8_t *) (psrc); \
  144. uint64_t val_m = 0; \
  145. \
  146. __asm__ volatile ( \
  147. "uld %[val_m], %[psrc_m] \n\t" \
  148. \
  149. : [val_m] "=r" (val_m) \
  150. : [psrc_m] "m" (*psrc_m) \
  151. ); \
  152. \
  153. val_m; \
  154. } )
  155. #else // !(__mips == 64)
  156. #define LD(psrc) \
  157. ( { \
  158. uint8_t *psrc_m1 = (uint8_t *) (psrc); \
  159. uint32_t val0_m, val1_m; \
  160. uint64_t val_m = 0; \
  161. \
  162. val0_m = LW(psrc_m1); \
  163. val1_m = LW(psrc_m1 + 4); \
  164. \
  165. val_m = (uint64_t) (val1_m); \
  166. val_m = (uint64_t) ((val_m << 32) & 0xFFFFFFFF00000000); \
  167. val_m = (uint64_t) (val_m | (uint64_t) val0_m); \
  168. \
  169. val_m; \
  170. } )
  171. #endif // (__mips == 64)
  172. #define SH(val, pdst) \
  173. { \
  174. uint8_t *pdst_m = (uint8_t *) (pdst); \
  175. uint16_t val_m = (val); \
  176. \
  177. __asm__ volatile ( \
  178. "ush %[val_m], %[pdst_m] \n\t" \
  179. \
  180. : [pdst_m] "=m" (*pdst_m) \
  181. : [val_m] "r" (val_m) \
  182. ); \
  183. }
  184. #define SW(val, pdst) \
  185. { \
  186. uint8_t *pdst_m = (uint8_t *) (pdst); \
  187. uint32_t val_m = (val); \
  188. \
  189. __asm__ volatile ( \
  190. "usw %[val_m], %[pdst_m] \n\t" \
  191. \
  192. : [pdst_m] "=m" (*pdst_m) \
  193. : [val_m] "r" (val_m) \
  194. ); \
  195. }
  196. #define SD(val, pdst) \
  197. { \
  198. uint8_t *pdst_m1 = (uint8_t *) (pdst); \
  199. uint32_t val0_m, val1_m; \
  200. \
  201. val0_m = (uint32_t) ((val) & 0x00000000FFFFFFFF); \
  202. val1_m = (uint32_t) (((val) >> 32) & 0x00000000FFFFFFFF); \
  203. \
  204. SW(val0_m, pdst_m1); \
  205. SW(val1_m, pdst_m1 + 4); \
  206. }
  207. #endif // (__mips_isa_rev >= 6)
  208. /* Description : Load 4 words with stride
  209. Arguments : Inputs - psrc (source pointer to load from)
  210. - stride
  211. Outputs - out0, out1, out2, out3
  212. Details : Loads word in 'out0' from (psrc)
  213. Loads word in 'out1' from (psrc + stride)
  214. Loads word in 'out2' from (psrc + 2 * stride)
  215. Loads word in 'out3' from (psrc + 3 * stride)
  216. */
  217. #define LW4(psrc, stride, out0, out1, out2, out3) \
  218. { \
  219. out0 = LW((psrc)); \
  220. out1 = LW((psrc) + stride); \
  221. out2 = LW((psrc) + 2 * stride); \
  222. out3 = LW((psrc) + 3 * stride); \
  223. }
  224. /* Description : Store 4 words with stride
  225. Arguments : Inputs - in0, in1, in2, in3, pdst, stride
  226. Details : Stores word from 'in0' to (pdst)
  227. Stores word from 'in1' to (pdst + stride)
  228. Stores word from 'in2' to (pdst + 2 * stride)
  229. Stores word from 'in3' to (pdst + 3 * stride)
  230. */
  231. #define SW4(in0, in1, in2, in3, pdst, stride) \
  232. { \
  233. SW(in0, (pdst)) \
  234. SW(in1, (pdst) + stride); \
  235. SW(in2, (pdst) + 2 * stride); \
  236. SW(in3, (pdst) + 3 * stride); \
  237. }
  238. /* Description : Store 4 double words with stride
  239. Arguments : Inputs - in0, in1, in2, in3, pdst, stride
  240. Details : Stores double word from 'in0' to (pdst)
  241. Stores double word from 'in1' to (pdst + stride)
  242. Stores double word from 'in2' to (pdst + 2 * stride)
  243. Stores double word from 'in3' to (pdst + 3 * stride)
  244. */
  245. #define SD4(in0, in1, in2, in3, pdst, stride) \
  246. { \
  247. SD(in0, (pdst)) \
  248. SD(in1, (pdst) + stride); \
  249. SD(in2, (pdst) + 2 * stride); \
  250. SD(in3, (pdst) + 3 * stride); \
  251. }
  252. /* Description : Load vectors with 16 byte elements with stride
  253. Arguments : Inputs - psrc (source pointer to load from)
  254. - stride
  255. Outputs - out0, out1
  256. Return Type - as per RTYPE
  257. Details : Loads 16 byte elements in 'out0' from (psrc)
  258. Loads 16 byte elements in 'out1' from (psrc + stride)
  259. */
  260. #define LD_B2(RTYPE, psrc, stride, out0, out1) \
  261. { \
  262. out0 = LD_B(RTYPE, (psrc)); \
  263. out1 = LD_B(RTYPE, (psrc) + stride); \
  264. }
  265. #define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__)
  266. #define LD_SB2(...) LD_B2(v16i8, __VA_ARGS__)
  267. #define LD_B3(RTYPE, psrc, stride, out0, out1, out2) \
  268. { \
  269. LD_B2(RTYPE, (psrc), stride, out0, out1); \
  270. out2 = LD_B(RTYPE, (psrc) + 2 * stride); \
  271. }
  272. #define LD_SB3(...) LD_B3(v16i8, __VA_ARGS__)
  273. #define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) \
  274. { \
  275. LD_B2(RTYPE, (psrc), stride, out0, out1); \
  276. LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \
  277. }
  278. #define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__)
  279. #define LD_SB4(...) LD_B4(v16i8, __VA_ARGS__)
  280. #define LD_B5(RTYPE, psrc, stride, out0, out1, out2, out3, out4) \
  281. { \
  282. LD_B4(RTYPE, (psrc), stride, out0, out1, out2, out3); \
  283. out4 = LD_B(RTYPE, (psrc) + 4 * stride); \
  284. }
  285. #define LD_UB5(...) LD_B5(v16u8, __VA_ARGS__)
  286. #define LD_SB5(...) LD_B5(v16i8, __VA_ARGS__)
  287. #define LD_B6(RTYPE, psrc, stride, out0, out1, out2, out3, out4, out5) \
  288. { \
  289. LD_B4(RTYPE, (psrc), stride, out0, out1, out2, out3); \
  290. LD_B2(RTYPE, (psrc) + 4 * stride, stride, out4, out5); \
  291. }
  292. #define LD_SB6(...) LD_B6(v16i8, __VA_ARGS__)
  293. #define LD_B7(RTYPE, psrc, stride, \
  294. out0, out1, out2, out3, out4, out5, out6) \
  295. { \
  296. LD_B5(RTYPE, (psrc), stride, out0, out1, out2, out3, out4); \
  297. LD_B2(RTYPE, (psrc) + 5 * stride, stride, out5, out6); \
  298. }
  299. #define LD_SB7(...) LD_B7(v16i8, __VA_ARGS__)
  300. #define LD_B8(RTYPE, psrc, stride, \
  301. out0, out1, out2, out3, out4, out5, out6, out7) \
  302. { \
  303. LD_B4(RTYPE, (psrc), stride, out0, out1, out2, out3); \
  304. LD_B4(RTYPE, (psrc) + 4 * stride, stride, out4, out5, out6, out7); \
  305. }
  306. #define LD_UB8(...) LD_B8(v16u8, __VA_ARGS__)
  307. #define LD_SB8(...) LD_B8(v16i8, __VA_ARGS__)
  308. /* Description : Load vectors with 8 halfword elements with stride
  309. Arguments : Inputs - psrc (source pointer to load from)
  310. - stride
  311. Outputs - out0, out1
  312. Details : Loads 8 halfword elements in 'out0' from (psrc)
  313. Loads 8 halfword elements in 'out1' from (psrc + stride)
  314. */
  315. #define LD_H2(RTYPE, psrc, stride, out0, out1) \
  316. { \
  317. out0 = LD_H(RTYPE, (psrc)); \
  318. out1 = LD_H(RTYPE, (psrc) + (stride)); \
  319. }
  320. #define LD_UH2(...) LD_H2(v8u16, __VA_ARGS__)
  321. #define LD_SH2(...) LD_H2(v8i16, __VA_ARGS__)
  322. #define LD_H4(RTYPE, psrc, stride, out0, out1, out2, out3) \
  323. { \
  324. LD_H2(RTYPE, (psrc), stride, out0, out1); \
  325. LD_H2(RTYPE, (psrc) + 2 * stride, stride, out2, out3); \
  326. }
  327. #define LD_UH4(...) LD_H4(v8u16, __VA_ARGS__)
  328. #define LD_SH4(...) LD_H4(v8i16, __VA_ARGS__)
  329. #define LD_H6(RTYPE, psrc, stride, out0, out1, out2, out3, out4, out5) \
  330. { \
  331. LD_H4(RTYPE, (psrc), stride, out0, out1, out2, out3); \
  332. LD_H2(RTYPE, (psrc) + 4 * stride, stride, out4, out5); \
  333. }
  334. #define LD_UH6(...) LD_H6(v8u16, __VA_ARGS__)
  335. #define LD_SH6(...) LD_H6(v8i16, __VA_ARGS__)
  336. #define LD_H8(RTYPE, psrc, stride, \
  337. out0, out1, out2, out3, out4, out5, out6, out7) \
  338. { \
  339. LD_H4(RTYPE, (psrc), stride, out0, out1, out2, out3); \
  340. LD_H4(RTYPE, (psrc) + 4 * stride, stride, out4, out5, out6, out7); \
  341. }
  342. #define LD_UH8(...) LD_H8(v8u16, __VA_ARGS__)
  343. #define LD_SH8(...) LD_H8(v8i16, __VA_ARGS__)
  344. /* Description : Store vectors of 16 byte elements with stride
  345. Arguments : Inputs - in0, in1, stride
  346. Outputs - pdst (destination pointer to store to)
  347. Details : Stores 16 byte elements from 'in0' to (pdst)
  348. Stores 16 byte elements from 'in1' to (pdst + stride)
  349. */
  350. #define ST_B2(RTYPE, in0, in1, pdst, stride) \
  351. { \
  352. ST_B(RTYPE, in0, (pdst)); \
  353. ST_B(RTYPE, in1, (pdst) + stride); \
  354. }
  355. #define ST_UB2(...) ST_B2(v16u8, __VA_ARGS__)
  356. #define ST_SB2(...) ST_B2(v16i8, __VA_ARGS__)
  357. #define ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride) \
  358. { \
  359. ST_B2(RTYPE, in0, in1, (pdst), stride); \
  360. ST_B2(RTYPE, in2, in3, (pdst) + 2 * stride, stride); \
  361. }
  362. #define ST_UB4(...) ST_B4(v16u8, __VA_ARGS__)
  363. #define ST_SB4(...) ST_B4(v16i8, __VA_ARGS__)
  364. #define ST_B8(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  365. pdst, stride) \
  366. { \
  367. ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride); \
  368. ST_B4(RTYPE, in4, in5, in6, in7, (pdst) + 4 * stride, stride); \
  369. }
  370. #define ST_UB8(...) ST_B8(v16u8, __VA_ARGS__)
  371. /* Description : Store vectors of 8 halfword elements with stride
  372. Arguments : Inputs - in0, in1, stride
  373. Outputs - pdst (destination pointer to store to)
  374. Details : Stores 8 halfword elements from 'in0' to (pdst)
  375. Stores 8 halfword elements from 'in1' to (pdst + stride)
  376. */
  377. #define ST_H2(RTYPE, in0, in1, pdst, stride) \
  378. { \
  379. ST_H(RTYPE, in0, (pdst)); \
  380. ST_H(RTYPE, in1, (pdst) + stride); \
  381. }
  382. #define ST_UH2(...) ST_H2(v8u16, __VA_ARGS__)
  383. #define ST_SH2(...) ST_H2(v8i16, __VA_ARGS__)
  384. #define ST_H4(RTYPE, in0, in1, in2, in3, pdst, stride) \
  385. { \
  386. ST_H2(RTYPE, in0, in1, (pdst), stride); \
  387. ST_H2(RTYPE, in2, in3, (pdst) + 2 * stride, stride); \
  388. }
  389. #define ST_SH4(...) ST_H4(v8i16, __VA_ARGS__)
  390. #define ST_H6(RTYPE, in0, in1, in2, in3, in4, in5, pdst, stride) \
  391. { \
  392. ST_H4(RTYPE, in0, in1, in2, in3, (pdst), stride); \
  393. ST_H2(RTYPE, in4, in5, (pdst) + 4 * stride, stride); \
  394. }
  395. #define ST_SH6(...) ST_H6(v8i16, __VA_ARGS__)
  396. #define ST_H8(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, pdst, stride) \
  397. { \
  398. ST_H4(RTYPE, in0, in1, in2, in3, (pdst), stride); \
  399. ST_H4(RTYPE, in4, in5, in6, in7, (pdst) + 4 * stride, stride); \
  400. }
  401. #define ST_SH8(...) ST_H8(v8i16, __VA_ARGS__)
  402. /* Description : Store vectors of word elements with stride
  403. Arguments : Inputs - in0, in1, stride
  404. Outputs - pdst (destination pointer to store to)
  405. Return Type - signed word
  406. Details : Stores 4 word elements from 'in0' to (pdst)
  407. Stores 4 word elements from 'in1' to (pdst + stride)
  408. */
  409. #define ST_SW2(in0, in1, pdst, stride) \
  410. { \
  411. ST_SW(in0, (pdst)); \
  412. ST_SW(in1, (pdst) + stride); \
  413. }
  414. /* Description : Store as 2x4 byte block to destination memory from input vector
  415. Arguments : Inputs - in, stidx, pdst, stride
  416. Return Type - unsigned byte
  417. Details : Index stidx halfword element from 'in' vector is copied and
  418. stored on first line
  419. Index stidx+1 halfword element from 'in' vector is copied and
  420. stored on second line
  421. Index stidx+2 halfword element from 'in' vector is copied and
  422. stored on third line
  423. Index stidx+3 halfword element from 'in' vector is copied and
  424. stored on fourth line
  425. */
  426. #define ST2x4_UB(in, stidx, pdst, stride) \
  427. { \
  428. uint16_t out0_m, out1_m, out2_m, out3_m; \
  429. uint8_t *pblk_2x4_m = (uint8_t *) (pdst); \
  430. \
  431. out0_m = __msa_copy_u_h((v8i16) in, (stidx)); \
  432. out1_m = __msa_copy_u_h((v8i16) in, (stidx + 1)); \
  433. out2_m = __msa_copy_u_h((v8i16) in, (stidx + 2)); \
  434. out3_m = __msa_copy_u_h((v8i16) in, (stidx + 3)); \
  435. \
  436. SH(out0_m, pblk_2x4_m); \
  437. SH(out1_m, pblk_2x4_m + stride); \
  438. SH(out2_m, pblk_2x4_m + 2 * stride); \
  439. SH(out3_m, pblk_2x4_m + 3 * stride); \
  440. }
  441. /* Description : Store as 4x2 byte block to destination memory from input vector
  442. Arguments : Inputs - in, pdst, stride
  443. Return Type - unsigned byte
  444. Details : Index 0 word element from input vector is copied and stored
  445. on first line
  446. Index 1 word element from input vector is copied and stored
  447. on second line
  448. */
  449. #define ST4x2_UB(in, pdst, stride) \
  450. { \
  451. uint32_t out0_m, out1_m; \
  452. uint8_t *pblk_4x2_m = (uint8_t *) (pdst); \
  453. \
  454. out0_m = __msa_copy_u_w((v4i32) in, 0); \
  455. out1_m = __msa_copy_u_w((v4i32) in, 1); \
  456. \
  457. SW(out0_m, pblk_4x2_m); \
  458. SW(out1_m, pblk_4x2_m + stride); \
  459. }
  460. /* Description : Store as 4x4 byte block to destination memory from input vector
  461. Arguments : Inputs - in0, in1, pdst, stride
  462. Return Type - unsigned byte
  463. Details : Idx0 word element from input vector 'in0' is copied and stored
  464. on first line
  465. Idx1 word element from input vector 'in0' is copied and stored
  466. on second line
  467. Idx2 word element from input vector 'in1' is copied and stored
  468. on third line
  469. Idx3 word element from input vector 'in1' is copied and stored
  470. on fourth line
  471. */
  472. #define ST4x4_UB(in0, in1, idx0, idx1, idx2, idx3, pdst, stride) \
  473. { \
  474. uint32_t out0_m, out1_m, out2_m, out3_m; \
  475. uint8_t *pblk_4x4_m = (uint8_t *) (pdst); \
  476. \
  477. out0_m = __msa_copy_u_w((v4i32) in0, idx0); \
  478. out1_m = __msa_copy_u_w((v4i32) in0, idx1); \
  479. out2_m = __msa_copy_u_w((v4i32) in1, idx2); \
  480. out3_m = __msa_copy_u_w((v4i32) in1, idx3); \
  481. \
  482. SW4(out0_m, out1_m, out2_m, out3_m, pblk_4x4_m, stride); \
  483. }
  484. #define ST4x8_UB(in0, in1, pdst, stride) \
  485. { \
  486. uint8_t *pblk_4x8 = (uint8_t *) (pdst); \
  487. \
  488. ST4x4_UB(in0, in0, 0, 1, 2, 3, pblk_4x8, stride); \
  489. ST4x4_UB(in1, in1, 0, 1, 2, 3, pblk_4x8 + 4 * stride, stride); \
  490. }
  491. /* Description : Store as 6x4 byte block to destination memory from input
  492. vectors
  493. Arguments : Inputs - in0, in1, pdst, stride
  494. Return Type - unsigned byte
  495. Details : Index 0 word element from input vector 'in0' is copied and
  496. stored on first line followed by index 2 halfword element
  497. Index 2 word element from input vector 'in0' is copied and
  498. stored on second line followed by index 2 halfword element
  499. Index 0 word element from input vector 'in1' is copied and
  500. stored on third line followed by index 2 halfword element
  501. Index 2 word element from input vector 'in1' is copied and
  502. stored on fourth line followed by index 2 halfword element
  503. */
  504. #define ST6x4_UB(in0, in1, pdst, stride) \
  505. { \
  506. uint32_t out0_m, out1_m, out2_m, out3_m; \
  507. uint16_t out4_m, out5_m, out6_m, out7_m; \
  508. uint8_t *pblk_6x4_m = (uint8_t *) (pdst); \
  509. \
  510. out0_m = __msa_copy_u_w((v4i32) in0, 0); \
  511. out1_m = __msa_copy_u_w((v4i32) in0, 2); \
  512. out2_m = __msa_copy_u_w((v4i32) in1, 0); \
  513. out3_m = __msa_copy_u_w((v4i32) in1, 2); \
  514. \
  515. out4_m = __msa_copy_u_h((v8i16) in0, 2); \
  516. out5_m = __msa_copy_u_h((v8i16) in0, 6); \
  517. out6_m = __msa_copy_u_h((v8i16) in1, 2); \
  518. out7_m = __msa_copy_u_h((v8i16) in1, 6); \
  519. \
  520. SW(out0_m, pblk_6x4_m); \
  521. SH(out4_m, (pblk_6x4_m + 4)); \
  522. pblk_6x4_m += stride; \
  523. SW(out1_m, pblk_6x4_m); \
  524. SH(out5_m, (pblk_6x4_m + 4)); \
  525. pblk_6x4_m += stride; \
  526. SW(out2_m, pblk_6x4_m); \
  527. SH(out6_m, (pblk_6x4_m + 4)); \
  528. pblk_6x4_m += stride; \
  529. SW(out3_m, pblk_6x4_m); \
  530. SH(out7_m, (pblk_6x4_m + 4)); \
  531. }
  532. /* Description : Store as 8x2 byte block to destination memory from input vector
  533. Arguments : Inputs - in, pdst, stride
  534. Details : Index 0 double word element from input vector 'in' is copied
  535. and stored to destination memory at (pdst)
  536. Index 1 double word element from input vector 'in' is copied
  537. and stored to destination memory at (pdst + stride)
  538. */
  539. #define ST8x2_UB(in, pdst, stride) \
  540. { \
  541. uint64_t out0_m, out1_m; \
  542. uint8_t *pblk_8x2_m = (uint8_t *) (pdst); \
  543. \
  544. out0_m = __msa_copy_u_d((v2i64) in, 0); \
  545. out1_m = __msa_copy_u_d((v2i64) in, 1); \
  546. \
  547. SD(out0_m, pblk_8x2_m); \
  548. SD(out1_m, pblk_8x2_m + stride); \
  549. }
  550. /* Description : Store as 8x4 byte block to destination memory from input
  551. vectors
  552. Arguments : Inputs - in0, in1, pdst, stride
  553. Details : Index 0 double word element from input vector 'in0' is copied
  554. and stored to destination memory at (pblk_8x4_m)
  555. Index 1 double word element from input vector 'in0' is copied
  556. and stored to destination memory at (pblk_8x4_m + stride)
  557. Index 0 double word element from input vector 'in1' is copied
  558. and stored to destination memory at (pblk_8x4_m + 2 * stride)
  559. Index 1 double word element from input vector 'in1' is copied
  560. and stored to destination memory at (pblk_8x4_m + 3 * stride)
  561. */
  562. #define ST8x4_UB(in0, in1, pdst, stride) \
  563. { \
  564. uint64_t out0_m, out1_m, out2_m, out3_m; \
  565. uint8_t *pblk_8x4_m = (uint8_t *) (pdst); \
  566. \
  567. out0_m = __msa_copy_u_d((v2i64) in0, 0); \
  568. out1_m = __msa_copy_u_d((v2i64) in0, 1); \
  569. out2_m = __msa_copy_u_d((v2i64) in1, 0); \
  570. out3_m = __msa_copy_u_d((v2i64) in1, 1); \
  571. \
  572. SD4(out0_m, out1_m, out2_m, out3_m, pblk_8x4_m, stride); \
  573. }
  574. #define ST8x8_UB(in0, in1, in2, in3, pdst, stride) \
  575. { \
  576. uint8_t *pblk_8x8_m = (uint8_t *) (pdst); \
  577. \
  578. ST8x4_UB(in0, in1, pblk_8x8_m, stride); \
  579. ST8x4_UB(in2, in3, pblk_8x8_m + 4 * stride, stride); \
  580. }
  581. #define ST12x4_UB(in0, in1, in2, pdst, stride) \
  582. { \
  583. uint8_t *pblk_12x4_m = (uint8_t *) (pdst); \
  584. \
  585. /* left 8x4 */ \
  586. ST8x4_UB(in0, in1, pblk_12x4_m, stride); \
  587. /* right 4x4 */ \
  588. ST4x4_UB(in2, in2, 0, 1, 2, 3, pblk_12x4_m + 8, stride); \
  589. }
  590. /* Description : Store as 12x8 byte block to destination memory from
  591. input vectors
  592. Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7, pdst, stride
  593. Details : Index 0 double word element from input vector 'in0' is copied
  594. and stored to destination memory at (pblk_12x8_m) followed by
  595. index 2 word element from same input vector 'in0' at
  596. (pblk_12x8_m + 8)
  597. Similar to remaining lines
  598. */
  599. #define ST12x8_UB(in0, in1, in2, in3, in4, in5, in6, in7, pdst, stride) \
  600. { \
  601. uint64_t out0_m, out1_m, out2_m, out3_m; \
  602. uint64_t out4_m, out5_m, out6_m, out7_m; \
  603. uint32_t out8_m, out9_m, out10_m, out11_m; \
  604. uint32_t out12_m, out13_m, out14_m, out15_m; \
  605. uint8_t *pblk_12x8_m = (uint8_t *) (pdst); \
  606. \
  607. out0_m = __msa_copy_u_d((v2i64) in0, 0); \
  608. out1_m = __msa_copy_u_d((v2i64) in1, 0); \
  609. out2_m = __msa_copy_u_d((v2i64) in2, 0); \
  610. out3_m = __msa_copy_u_d((v2i64) in3, 0); \
  611. out4_m = __msa_copy_u_d((v2i64) in4, 0); \
  612. out5_m = __msa_copy_u_d((v2i64) in5, 0); \
  613. out6_m = __msa_copy_u_d((v2i64) in6, 0); \
  614. out7_m = __msa_copy_u_d((v2i64) in7, 0); \
  615. \
  616. out8_m = __msa_copy_u_w((v4i32) in0, 2); \
  617. out9_m = __msa_copy_u_w((v4i32) in1, 2); \
  618. out10_m = __msa_copy_u_w((v4i32) in2, 2); \
  619. out11_m = __msa_copy_u_w((v4i32) in3, 2); \
  620. out12_m = __msa_copy_u_w((v4i32) in4, 2); \
  621. out13_m = __msa_copy_u_w((v4i32) in5, 2); \
  622. out14_m = __msa_copy_u_w((v4i32) in6, 2); \
  623. out15_m = __msa_copy_u_w((v4i32) in7, 2); \
  624. \
  625. SD(out0_m, pblk_12x8_m); \
  626. SW(out8_m, pblk_12x8_m + 8); \
  627. pblk_12x8_m += stride; \
  628. SD(out1_m, pblk_12x8_m); \
  629. SW(out9_m, pblk_12x8_m + 8); \
  630. pblk_12x8_m += stride; \
  631. SD(out2_m, pblk_12x8_m); \
  632. SW(out10_m, pblk_12x8_m + 8); \
  633. pblk_12x8_m += stride; \
  634. SD(out3_m, pblk_12x8_m); \
  635. SW(out11_m, pblk_12x8_m + 8); \
  636. pblk_12x8_m += stride; \
  637. SD(out4_m, pblk_12x8_m); \
  638. SW(out12_m, pblk_12x8_m + 8); \
  639. pblk_12x8_m += stride; \
  640. SD(out5_m, pblk_12x8_m); \
  641. SW(out13_m, pblk_12x8_m + 8); \
  642. pblk_12x8_m += stride; \
  643. SD(out6_m, pblk_12x8_m); \
  644. SW(out14_m, pblk_12x8_m + 8); \
  645. pblk_12x8_m += stride; \
  646. SD(out7_m, pblk_12x8_m); \
  647. SW(out15_m, pblk_12x8_m + 8); \
  648. }
  649. /* Description : Immediate number of columns to slide with zero
  650. Arguments : Inputs - in0, in1, slide_val
  651. Outputs - out0, out1
  652. Return Type - as per RTYPE
  653. Details : Byte elements from 'zero_m' vector are slide into 'in0' by
  654. number of elements specified by 'slide_val'
  655. */
  656. #define SLDI_B2_0(RTYPE, in0, in1, out0, out1, slide_val) \
  657. { \
  658. v16i8 zero_m = { 0 }; \
  659. out0 = (RTYPE) __msa_sldi_b((v16i8) zero_m, (v16i8) in0, slide_val); \
  660. out1 = (RTYPE) __msa_sldi_b((v16i8) zero_m, (v16i8) in1, slide_val); \
  661. }
  662. #define SLDI_B2_0_UB(...) SLDI_B2_0(v16u8, __VA_ARGS__)
  663. #define SLDI_B4_0(RTYPE, in0, in1, in2, in3, \
  664. out0, out1, out2, out3, slide_val) \
  665. { \
  666. SLDI_B2_0(RTYPE, in0, in1, out0, out1, slide_val); \
  667. SLDI_B2_0(RTYPE, in2, in3, out2, out3, slide_val); \
  668. }
  669. #define SLDI_B4_0_SB(...) SLDI_B4_0(v16i8, __VA_ARGS__)
  670. /* Description : Shuffle byte vector elements as per mask vector
  671. Arguments : Inputs - in0, in1, in2, in3, mask0, mask1
  672. Outputs - out0, out1
  673. Return Type - as per RTYPE
  674. Details : Selective byte elements from in0 & in1 are copied to out0 as
  675. per control vector mask0
  676. Selective byte elements from in2 & in3 are copied to out1 as
  677. per control vector mask1
  678. */
  679. #define VSHF_B2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1) \
  680. { \
  681. out0 = (RTYPE) __msa_vshf_b((v16i8) mask0, (v16i8) in1, (v16i8) in0); \
  682. out1 = (RTYPE) __msa_vshf_b((v16i8) mask1, (v16i8) in3, (v16i8) in2); \
  683. }
  684. #define VSHF_B2_UB(...) VSHF_B2(v16u8, __VA_ARGS__)
  685. #define VSHF_B2_SB(...) VSHF_B2(v16i8, __VA_ARGS__)
  686. #define VSHF_B2_UH(...) VSHF_B2(v8u16, __VA_ARGS__)
  687. #define VSHF_B2_SH(...) VSHF_B2(v8i16, __VA_ARGS__)
  688. #define VSHF_B3(RTYPE, in0, in1, in2, in3, in4, in5, mask0, mask1, mask2, \
  689. out0, out1, out2) \
  690. { \
  691. VSHF_B2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1); \
  692. out2 = (RTYPE) __msa_vshf_b((v16i8) mask2, (v16i8) in5, (v16i8) in4); \
  693. }
  694. #define VSHF_B3_SB(...) VSHF_B3(v16i8, __VA_ARGS__)
  695. #define VSHF_B4(RTYPE, in0, in1, mask0, mask1, mask2, mask3, \
  696. out0, out1, out2, out3) \
  697. { \
  698. VSHF_B2(RTYPE, in0, in1, in0, in1, mask0, mask1, out0, out1); \
  699. VSHF_B2(RTYPE, in0, in1, in0, in1, mask2, mask3, out2, out3); \
  700. }
  701. #define VSHF_B4_SB(...) VSHF_B4(v16i8, __VA_ARGS__)
  702. /* Description : Shuffle byte vector elements as per mask vector
  703. Arguments : Inputs - in0, in1, in2, in3, mask0, mask1
  704. Outputs - out0, out1
  705. Return Type - as per RTYPE
  706. Details : Selective byte elements from in0 & in1 are copied to out0 as
  707. per control vector mask0
  708. Selective byte elements from in2 & in3 are copied to out1 as
  709. per control vector mask1
  710. */
  711. #define VSHF_W2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1) \
  712. { \
  713. out0 = (RTYPE) __msa_vshf_w((v4i32) mask0, (v4i32) in1, (v4i32) in0); \
  714. out1 = (RTYPE) __msa_vshf_w((v4i32) mask1, (v4i32) in3, (v4i32) in2); \
  715. }
  716. #define VSHF_W2_SB(...) VSHF_W2(v16i8, __VA_ARGS__)
  717. /* Description : Dot product of byte vector elements
  718. Arguments : Inputs - mult0, mult1
  719. cnst0, cnst1
  720. Outputs - out0, out1
  721. Return Type - signed halfword
  722. Details : Signed byte elements from mult0 are multiplied with
  723. signed byte elements from cnst0 producing a result
  724. twice the size of input i.e. signed halfword.
  725. Then this multiplication results of adjacent odd-even elements
  726. are added together and stored to the out vector
  727. (2 signed halfword results)
  728. */
  729. #define DOTP_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) \
  730. { \
  731. out0 = (RTYPE) __msa_dotp_s_h((v16i8) mult0, (v16i8) cnst0); \
  732. out1 = (RTYPE) __msa_dotp_s_h((v16i8) mult1, (v16i8) cnst1); \
  733. }
  734. #define DOTP_SB2_SH(...) DOTP_SB2(v8i16, __VA_ARGS__)
  735. #define DOTP_SB3(RTYPE, mult0, mult1, mult2, cnst0, cnst1, cnst2, \
  736. out0, out1, out2) \
  737. { \
  738. DOTP_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1); \
  739. out2 = (RTYPE) __msa_dotp_s_h((v16i8) mult2, (v16i8) cnst2); \
  740. }
  741. #define DOTP_SB3_SH(...) DOTP_SB3(v8i16, __VA_ARGS__)
  742. #define DOTP_SB4(RTYPE, mult0, mult1, mult2, mult3, \
  743. cnst0, cnst1, cnst2, cnst3, out0, out1, out2, out3) \
  744. { \
  745. DOTP_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1); \
  746. DOTP_SB2(RTYPE, mult2, mult3, cnst2, cnst3, out2, out3); \
  747. }
  748. #define DOTP_SB4_SH(...) DOTP_SB4(v8i16, __VA_ARGS__)
  749. /* Description : Dot product of halfword vector elements
  750. Arguments : Inputs - mult0, mult1
  751. cnst0, cnst1
  752. Outputs - out0, out1
  753. Return Type - signed word
  754. Details : Signed halfword elements from mult0 are multiplied with
  755. signed halfword elements from cnst0 producing a result
  756. twice the size of input i.e. signed word.
  757. Then this multiplication results of adjacent odd-even elements
  758. are added together and stored to the out vector
  759. (2 signed word results)
  760. */
  761. #define DOTP_SH2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) \
  762. { \
  763. out0 = (RTYPE) __msa_dotp_s_w((v8i16) mult0, (v8i16) cnst0); \
  764. out1 = (RTYPE) __msa_dotp_s_w((v8i16) mult1, (v8i16) cnst1); \
  765. }
  766. #define DOTP_SH2_SW(...) DOTP_SH2(v4i32, __VA_ARGS__)
  767. #define DOTP_SH4(RTYPE, mult0, mult1, mult2, mult3, \
  768. cnst0, cnst1, cnst2, cnst3, \
  769. out0, out1, out2, out3) \
  770. { \
  771. DOTP_SH2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1); \
  772. DOTP_SH2(RTYPE, mult2, mult3, cnst2, cnst3, out2, out3); \
  773. }
  774. #define DOTP_SH4_SW(...) DOTP_SH4(v4i32, __VA_ARGS__)
  775. /* Description : Dot product & addition of byte vector elements
  776. Arguments : Inputs - mult0, mult1
  777. cnst0, cnst1
  778. Outputs - out0, out1
  779. Return Type - signed halfword
  780. Details : Signed byte elements from mult0 are multiplied with
  781. signed byte elements from cnst0 producing a result
  782. twice the size of input i.e. signed halfword.
  783. Then this multiplication results of adjacent odd-even elements
  784. are added to the out vector
  785. (2 signed halfword results)
  786. */
  787. #define DPADD_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) \
  788. { \
  789. out0 = (RTYPE) __msa_dpadd_s_h((v8i16) out0, \
  790. (v16i8) mult0, (v16i8) cnst0); \
  791. out1 = (RTYPE) __msa_dpadd_s_h((v8i16) out1, \
  792. (v16i8) mult1, (v16i8) cnst1); \
  793. }
  794. #define DPADD_SB2_SH(...) DPADD_SB2(v8i16, __VA_ARGS__)
  795. #define DPADD_SB4(RTYPE, mult0, mult1, mult2, mult3, \
  796. cnst0, cnst1, cnst2, cnst3, out0, out1, out2, out3) \
  797. { \
  798. DPADD_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1); \
  799. DPADD_SB2(RTYPE, mult2, mult3, cnst2, cnst3, out2, out3); \
  800. }
  801. #define DPADD_SB4_SH(...) DPADD_SB4(v8i16, __VA_ARGS__)
  802. /* Description : Dot product & addition of halfword vector elements
  803. Arguments : Inputs - mult0, mult1
  804. cnst0, cnst1
  805. Outputs - out0, out1
  806. Return Type - signed word
  807. Details : Signed halfword elements from mult0 are multiplied with
  808. signed halfword elements from cnst0 producing a result
  809. twice the size of input i.e. signed word.
  810. Then this multiplication results of adjacent odd-even elements
  811. are added to the out vector
  812. (2 signed word results)
  813. */
  814. #define DPADD_SH2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) \
  815. { \
  816. out0 = (RTYPE) __msa_dpadd_s_w((v4i32) out0, \
  817. (v8i16) mult0, (v8i16) cnst0); \
  818. out1 = (RTYPE) __msa_dpadd_s_w((v4i32) out1, \
  819. (v8i16) mult1, (v8i16) cnst1); \
  820. }
  821. #define DPADD_SH2_SW(...) DPADD_SH2(v4i32, __VA_ARGS__)
  822. /* Description : Clips all halfword elements of input vector between min & max
  823. out = ((in) < (min)) ? (min) : (((in) > (max)) ? (max) : (in))
  824. Arguments : Inputs - in (input vector)
  825. - min (min threshold)
  826. - max (max threshold)
  827. Outputs - out_m (output vector with clipped elements)
  828. Return Type - signed halfword
  829. */
  830. #define CLIP_SH(in, min, max) \
  831. ( { \
  832. v8i16 out_m; \
  833. \
  834. out_m = __msa_max_s_h((v8i16) min, (v8i16) in); \
  835. out_m = __msa_min_s_h((v8i16) max, (v8i16) out_m); \
  836. out_m; \
  837. } )
  838. /* Description : Clips all signed halfword elements of input vector
  839. between 0 & 255
  840. Arguments : Inputs - in (input vector)
  841. Outputs - out_m (output vector with clipped elements)
  842. Return Type - signed halfword
  843. */
  844. #define CLIP_SH_0_255(in) \
  845. ( { \
  846. v8i16 max_m = __msa_ldi_h(255); \
  847. v8i16 out_m; \
  848. \
  849. out_m = __msa_maxi_s_h((v8i16) in, 0); \
  850. out_m = __msa_min_s_h((v8i16) max_m, (v8i16) out_m); \
  851. out_m; \
  852. } )
  853. #define CLIP_SH2_0_255(in0, in1) \
  854. { \
  855. in0 = CLIP_SH_0_255(in0); \
  856. in1 = CLIP_SH_0_255(in1); \
  857. }
  858. #define CLIP_SH4_0_255(in0, in1, in2, in3) \
  859. { \
  860. CLIP_SH2_0_255(in0, in1); \
  861. CLIP_SH2_0_255(in2, in3); \
  862. }
  863. /* Description : Clips all signed word elements of input vector
  864. between 0 & 255
  865. Arguments : Inputs - in (input vector)
  866. Outputs - out_m (output vector with clipped elements)
  867. Return Type - signed word
  868. */
  869. #define CLIP_SW_0_255(in) \
  870. ( { \
  871. v4i32 max_m = __msa_ldi_w(255); \
  872. v4i32 out_m; \
  873. \
  874. out_m = __msa_maxi_s_w((v4i32) in, 0); \
  875. out_m = __msa_min_s_w((v4i32) max_m, (v4i32) out_m); \
  876. out_m; \
  877. } )
  878. /* Description : Horizontal subtraction of unsigned byte vector elements
  879. Arguments : Inputs - in0, in1
  880. Outputs - out0, out1
  881. Return Type - as per RTYPE
  882. Details : Each unsigned odd byte element from 'in0' is subtracted from
  883. even unsigned byte element from 'in0' (pairwise) and the
  884. halfword result is stored in 'out0'
  885. */
  886. #define HSUB_UB2(RTYPE, in0, in1, out0, out1) \
  887. { \
  888. out0 = (RTYPE) __msa_hsub_u_h((v16u8) in0, (v16u8) in0); \
  889. out1 = (RTYPE) __msa_hsub_u_h((v16u8) in1, (v16u8) in1); \
  890. }
  891. #define HSUB_UB2_UH(...) HSUB_UB2(v8u16, __VA_ARGS__)
  892. #define HSUB_UB2_SH(...) HSUB_UB2(v8i16, __VA_ARGS__)
  893. /* Description : Interleave even halfword elements from vectors
  894. Arguments : Inputs - in0, in1, in2, in3
  895. Outputs - out0, out1
  896. Return Type - as per RTYPE
  897. Details : Even halfword elements of 'in0' and even halfword
  898. elements of 'in1' are interleaved and copied to 'out0'
  899. Even halfword elements of 'in2' and even halfword
  900. elements of 'in3' are interleaved and copied to 'out1'
  901. */
  902. #define ILVEV_H2(RTYPE, in0, in1, in2, in3, out0, out1) \
  903. { \
  904. out0 = (RTYPE) __msa_ilvev_h((v8i16) in1, (v8i16) in0); \
  905. out1 = (RTYPE) __msa_ilvev_h((v8i16) in3, (v8i16) in2); \
  906. }
  907. #define ILVEV_H2_UB(...) ILVEV_H2(v16u8, __VA_ARGS__)
  908. /* Description : Interleave even word elements from vectors
  909. Arguments : Inputs - in0, in1, in2, in3
  910. Outputs - out0, out1
  911. Return Type - as per RTYPE
  912. Details : Even word elements of 'in0' and even word
  913. elements of 'in1' are interleaved and copied to 'out0'
  914. Even word elements of 'in2' and even word
  915. elements of 'in3' are interleaved and copied to 'out1'
  916. */
  917. #define ILVEV_W2(RTYPE, in0, in1, in2, in3, out0, out1) \
  918. { \
  919. out0 = (RTYPE) __msa_ilvev_w((v4i32) in1, (v4i32) in0); \
  920. out1 = (RTYPE) __msa_ilvev_w((v4i32) in3, (v4i32) in2); \
  921. }
  922. #define ILVEV_W2_SB(...) ILVEV_W2(v16i8, __VA_ARGS__)
  923. /* Description : Interleave even double word elements from vectors
  924. Arguments : Inputs - in0, in1, in2, in3
  925. Outputs - out0, out1
  926. Return Type - as per RTYPE
  927. Details : Even double word elements of 'in0' and even double word
  928. elements of 'in1' are interleaved and copied to 'out0'
  929. Even double word elements of 'in2' and even double word
  930. elements of 'in3' are interleaved and copied to 'out1'
  931. */
  932. #define ILVEV_D2(RTYPE, in0, in1, in2, in3, out0, out1) \
  933. { \
  934. out0 = (RTYPE) __msa_ilvev_d((v2i64) in1, (v2i64) in0); \
  935. out1 = (RTYPE) __msa_ilvev_d((v2i64) in3, (v2i64) in2); \
  936. }
  937. #define ILVEV_D2_UB(...) ILVEV_D2(v16u8, __VA_ARGS__)
  938. /* Description : Interleave left half of byte elements from vectors
  939. Arguments : Inputs - in0, in1, in2, in3
  940. Outputs - out0, out1
  941. Return Type - as per RTYPE
  942. Details : Left half of byte elements of in0 and left half of byte
  943. elements of in1 are interleaved and copied to out0.
  944. Left half of byte elements of in2 and left half of byte
  945. elements of in3 are interleaved and copied to out1.
  946. */
  947. #define ILVL_B2(RTYPE, in0, in1, in2, in3, out0, out1) \
  948. { \
  949. out0 = (RTYPE) __msa_ilvl_b((v16i8) in0, (v16i8) in1); \
  950. out1 = (RTYPE) __msa_ilvl_b((v16i8) in2, (v16i8) in3); \
  951. }
  952. #define ILVL_B2_SB(...) ILVL_B2(v16i8, __VA_ARGS__)
  953. #define ILVL_B2_SH(...) ILVL_B2(v8i16, __VA_ARGS__)
  954. #define ILVL_B4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  955. out0, out1, out2, out3) \
  956. { \
  957. ILVL_B2(RTYPE, in0, in1, in2, in3, out0, out1); \
  958. ILVL_B2(RTYPE, in4, in5, in6, in7, out2, out3); \
  959. }
  960. #define ILVL_B4_SB(...) ILVL_B4(v16i8, __VA_ARGS__)
  961. #define ILVL_B4_UH(...) ILVL_B4(v8u16, __VA_ARGS__)
  962. #define ILVL_B4_SH(...) ILVL_B4(v8i16, __VA_ARGS__)
  963. /* Description : Interleave left half of halfword elements from vectors
  964. Arguments : Inputs - in0, in1, in2, in3
  965. Outputs - out0, out1
  966. Return Type - as per RTYPE
  967. Details : Left half of halfword elements of in0 and left half of halfword
  968. elements of in1 are interleaved and copied to out0.
  969. Left half of halfword elements of in2 and left half of halfword
  970. elements of in3 are interleaved and copied to out1.
  971. */
  972. #define ILVL_H2(RTYPE, in0, in1, in2, in3, out0, out1) \
  973. { \
  974. out0 = (RTYPE) __msa_ilvl_h((v8i16) in0, (v8i16) in1); \
  975. out1 = (RTYPE) __msa_ilvl_h((v8i16) in2, (v8i16) in3); \
  976. }
  977. #define ILVL_H2_SH(...) ILVL_H2(v8i16, __VA_ARGS__)
  978. #define ILVL_H2_SW(...) ILVL_H2(v4i32, __VA_ARGS__)
  979. #define ILVL_H4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  980. out0, out1, out2, out3) \
  981. { \
  982. ILVL_H2(RTYPE, in0, in1, in2, in3, out0, out1); \
  983. ILVL_H2(RTYPE, in4, in5, in6, in7, out2, out3); \
  984. }
  985. #define ILVL_H4_SH(...) ILVL_H4(v8i16, __VA_ARGS__)
  986. /* Description : Interleave left half of word elements from vectors
  987. Arguments : Inputs - in0, in1, in2, in3
  988. Outputs - out0, out1
  989. Return Type - as per RTYPE
  990. Details : Left half of word elements of in0 and left half of word
  991. elements of in1 are interleaved and copied to out0.
  992. Left half of word elements of in2 and left half of word
  993. elements of in3 are interleaved and copied to out1.
  994. */
  995. #define ILVL_W2(RTYPE, in0, in1, in2, in3, out0, out1) \
  996. { \
  997. out0 = (RTYPE) __msa_ilvl_w((v4i32) in0, (v4i32) in1); \
  998. out1 = (RTYPE) __msa_ilvl_w((v4i32) in2, (v4i32) in3); \
  999. }
  1000. #define ILVL_W2_SB(...) ILVL_W2(v16i8, __VA_ARGS__)
  1001. /* Description : Interleave right half of byte elements from vectors
  1002. Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
  1003. Outputs - out0, out1, out2, out3
  1004. Return Type - as per RTYPE
  1005. Details : Right half of byte elements of in0 and right half of byte
  1006. elements of in1 are interleaved and copied to out0.
  1007. Right half of byte elements of in2 and right half of byte
  1008. elements of in3 are interleaved and copied to out1.
  1009. Similar for other pairs
  1010. */
  1011. #define ILVR_B2(RTYPE, in0, in1, in2, in3, out0, out1) \
  1012. { \
  1013. out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1); \
  1014. out1 = (RTYPE) __msa_ilvr_b((v16i8) in2, (v16i8) in3); \
  1015. }
  1016. #define ILVR_B2_UB(...) ILVR_B2(v16u8, __VA_ARGS__)
  1017. #define ILVR_B2_SB(...) ILVR_B2(v16i8, __VA_ARGS__)
  1018. #define ILVR_B2_UH(...) ILVR_B2(v8u16, __VA_ARGS__)
  1019. #define ILVR_B2_SH(...) ILVR_B2(v8i16, __VA_ARGS__)
  1020. #define ILVR_B4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  1021. out0, out1, out2, out3) \
  1022. { \
  1023. ILVR_B2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1024. ILVR_B2(RTYPE, in4, in5, in6, in7, out2, out3); \
  1025. }
  1026. #define ILVR_B4_SB(...) ILVR_B4(v16i8, __VA_ARGS__)
  1027. #define ILVR_B4_UH(...) ILVR_B4(v8u16, __VA_ARGS__)
  1028. #define ILVR_B4_SH(...) ILVR_B4(v8i16, __VA_ARGS__)
  1029. /* Description : Interleave right half of halfword elements from vectors
  1030. Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
  1031. Outputs - out0, out1, out2, out3
  1032. Return Type - signed halfword
  1033. Details : Right half of halfword elements of in0 and right half of
  1034. halfword elements of in1 are interleaved and copied to out0.
  1035. Right half of halfword elements of in2 and right half of
  1036. halfword elements of in3 are interleaved and copied to out1.
  1037. Similar for other pairs
  1038. */
  1039. #define ILVR_H2(RTYPE, in0, in1, in2, in3, out0, out1) \
  1040. { \
  1041. out0 = (RTYPE) __msa_ilvr_h((v8i16) in0, (v8i16) in1); \
  1042. out1 = (RTYPE) __msa_ilvr_h((v8i16) in2, (v8i16) in3); \
  1043. }
  1044. #define ILVR_H2_SH(...) ILVR_H2(v8i16, __VA_ARGS__)
  1045. #define ILVR_H2_SW(...) ILVR_H2(v4i32, __VA_ARGS__)
  1046. #define ILVR_H3(RTYPE, in0, in1, in2, in3, in4, in5, out0, out1, out2) \
  1047. { \
  1048. ILVR_H2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1049. out2 = (RTYPE) __msa_ilvr_h((v8i16) in4, (v8i16) in5); \
  1050. }
  1051. #define ILVR_H3_SH(...) ILVR_H3(v8i16, __VA_ARGS__)
  1052. #define ILVR_H4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  1053. out0, out1, out2, out3) \
  1054. { \
  1055. ILVR_H2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1056. ILVR_H2(RTYPE, in4, in5, in6, in7, out2, out3); \
  1057. }
  1058. #define ILVR_H4_SH(...) ILVR_H4(v8i16, __VA_ARGS__)
  1059. #define ILVR_W2(RTYPE, in0, in1, in2, in3, out0, out1) \
  1060. { \
  1061. out0 = (RTYPE) __msa_ilvr_w((v4i32) in0, (v4i32) in1); \
  1062. out1 = (RTYPE) __msa_ilvr_w((v4i32) in2, (v4i32) in3); \
  1063. }
  1064. #define ILVR_W2_UB(...) ILVR_W2(v16u8, __VA_ARGS__)
  1065. #define ILVR_W2_SB(...) ILVR_W2(v16i8, __VA_ARGS__)
  1066. #define ILVR_W4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  1067. out0, out1, out2, out3) \
  1068. { \
  1069. ILVR_W2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1070. ILVR_W2(RTYPE, in4, in5, in6, in7, out2, out3); \
  1071. }
  1072. #define ILVR_W4_SB(...) ILVR_W4(v16i8, __VA_ARGS__)
  1073. /* Description : Interleave right half of double word elements from vectors
  1074. Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
  1075. Outputs - out0, out1, out2, out3
  1076. Return Type - unsigned double word
  1077. Details : Right half of double word elements of in0 and right half of
  1078. double word elements of in1 are interleaved and copied to out0.
  1079. Right half of double word elements of in2 and right half of
  1080. double word elements of in3 are interleaved and copied to out1.
  1081. */
  1082. #define ILVR_D2(RTYPE, in0, in1, in2, in3, out0, out1) \
  1083. { \
  1084. out0 = (RTYPE) __msa_ilvr_d((v2i64) (in0), (v2i64) (in1)); \
  1085. out1 = (RTYPE) __msa_ilvr_d((v2i64) (in2), (v2i64) (in3)); \
  1086. }
  1087. #define ILVR_D2_SB(...) ILVR_D2(v16i8, __VA_ARGS__)
  1088. #define ILVR_D2_SH(...) ILVR_D2(v8i16, __VA_ARGS__)
  1089. #define ILVR_D3(RTYPE, in0, in1, in2, in3, in4, in5, out0, out1, out2) \
  1090. { \
  1091. ILVR_D2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1092. out2 = (RTYPE) __msa_ilvr_d((v2i64) (in4), (v2i64) (in5)); \
  1093. }
  1094. #define ILVR_D3_SB(...) ILVR_D3(v16i8, __VA_ARGS__)
  1095. #define ILVR_D4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  1096. out0, out1, out2, out3) \
  1097. { \
  1098. ILVR_D2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1099. ILVR_D2(RTYPE, in4, in5, in6, in7, out2, out3); \
  1100. }
  1101. #define ILVR_D4_SB(...) ILVR_D4(v16i8, __VA_ARGS__)
  1102. /* Description : Interleave both left and right half of input vectors
  1103. Arguments : Inputs - in0, in1
  1104. Outputs - out0, out1
  1105. Return Type - as per RTYPE
  1106. Details : Right half of byte elements from 'in0' and 'in1' are
  1107. interleaved and stored to 'out0'
  1108. Left half of byte elements from 'in0' and 'in1' are
  1109. interleaved and stored to 'out1'
  1110. */
  1111. #define ILVRL_B2(RTYPE, in0, in1, out0, out1) \
  1112. { \
  1113. out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1); \
  1114. out1 = (RTYPE) __msa_ilvl_b((v16i8) in0, (v16i8) in1); \
  1115. }
  1116. #define ILVRL_B2_SB(...) ILVRL_B2(v16i8, __VA_ARGS__)
  1117. #define ILVRL_B2_SH(...) ILVRL_B2(v8i16, __VA_ARGS__)
  1118. #define ILVRL_H2(RTYPE, in0, in1, out0, out1) \
  1119. { \
  1120. out0 = (RTYPE) __msa_ilvr_h((v8i16) in0, (v8i16) in1); \
  1121. out1 = (RTYPE) __msa_ilvl_h((v8i16) in0, (v8i16) in1); \
  1122. }
  1123. #define ILVRL_H2_SB(...) ILVRL_H2(v16i8, __VA_ARGS__)
  1124. #define ILVRL_H2_SH(...) ILVRL_H2(v8i16, __VA_ARGS__)
  1125. #define ILVRL_H2_SW(...) ILVRL_H2(v4i32, __VA_ARGS__)
  1126. #define ILVRL_W2(RTYPE, in0, in1, out0, out1) \
  1127. { \
  1128. out0 = (RTYPE) __msa_ilvr_w((v4i32) in0, (v4i32) in1); \
  1129. out1 = (RTYPE) __msa_ilvl_w((v4i32) in0, (v4i32) in1); \
  1130. }
  1131. #define ILVRL_W2_SH(...) ILVRL_W2(v8i16, __VA_ARGS__)
  1132. /* Description : Maximum values between signed elements of vector and
  1133. 5-bit signed immediate value are copied to the output vector
  1134. Arguments : Inputs - in0, in1, in2, in3, max_val
  1135. Outputs - in0, in1, in2, in3 (in place)
  1136. Return Type - unsigned halfword
  1137. Details : Maximum of signed halfword element values from 'in0' and
  1138. 'max_val' are written to output vector 'in0'
  1139. */
  1140. #define MAXI_SH2(RTYPE, in0, in1, max_val) \
  1141. { \
  1142. in0 = (RTYPE) __msa_maxi_s_h((v8i16) in0, (max_val)); \
  1143. in1 = (RTYPE) __msa_maxi_s_h((v8i16) in1, (max_val)); \
  1144. }
  1145. #define MAXI_SH2_SH(...) MAXI_SH2(v8i16, __VA_ARGS__)
  1146. #define MAXI_SH4(RTYPE, in0, in1, in2, in3, max_val) \
  1147. { \
  1148. MAXI_SH2(RTYPE, in0, in1, max_val); \
  1149. MAXI_SH2(RTYPE, in2, in3, max_val); \
  1150. }
  1151. #define MAXI_SH4_UH(...) MAXI_SH4(v8u16, __VA_ARGS__)
  1152. /* Description : Saturate the halfword element values to the max
  1153. unsigned value of (sat_val+1 bits)
  1154. The element data width remains unchanged
  1155. Arguments : Inputs - in0, in1, in2, in3, sat_val
  1156. Outputs - in0, in1, in2, in3 (in place)
  1157. Return Type - unsigned halfword
  1158. Details : Each unsigned halfword element from 'in0' is saturated to the
  1159. value generated with (sat_val+1) bit range
  1160. Results are in placed to original vectors
  1161. */
  1162. #define SAT_UH2(RTYPE, in0, in1, sat_val) \
  1163. { \
  1164. in0 = (RTYPE) __msa_sat_u_h((v8u16) in0, sat_val); \
  1165. in1 = (RTYPE) __msa_sat_u_h((v8u16) in1, sat_val); \
  1166. }
  1167. #define SAT_UH2_UH(...) SAT_UH2(v8u16, __VA_ARGS__)
  1168. #define SAT_UH4(RTYPE, in0, in1, in2, in3, sat_val) \
  1169. { \
  1170. SAT_UH2(RTYPE, in0, in1, sat_val); \
  1171. SAT_UH2(RTYPE, in2, in3, sat_val) \
  1172. }
  1173. #define SAT_UH4_UH(...) SAT_UH4(v8u16, __VA_ARGS__)
  1174. /* Description : Saturate the halfword element values to the max
  1175. unsigned value of (sat_val+1 bits)
  1176. The element data width remains unchanged
  1177. Arguments : Inputs - in0, in1, in2, in3, sat_val
  1178. Outputs - in0, in1, in2, in3 (in place)
  1179. Return Type - unsigned halfword
  1180. Details : Each unsigned halfword element from 'in0' is saturated to the
  1181. value generated with (sat_val+1) bit range
  1182. Results are in placed to original vectors
  1183. */
  1184. #define SAT_SH2(RTYPE, in0, in1, sat_val) \
  1185. { \
  1186. in0 = (RTYPE) __msa_sat_s_h((v8i16) in0, sat_val); \
  1187. in1 = (RTYPE) __msa_sat_s_h((v8i16) in1, sat_val); \
  1188. }
  1189. #define SAT_SH2_SH(...) SAT_SH2(v8i16, __VA_ARGS__)
  1190. #define SAT_SH3(RTYPE, in0, in1, in2, sat_val) \
  1191. { \
  1192. SAT_SH2(RTYPE, in0, in1, sat_val) \
  1193. in2 = (RTYPE) __msa_sat_s_h((v8i16) in2, sat_val); \
  1194. }
  1195. #define SAT_SH3_SH(...) SAT_SH3(v8i16, __VA_ARGS__)
  1196. #define SAT_SH4(RTYPE, in0, in1, in2, in3, sat_val) \
  1197. { \
  1198. SAT_SH2(RTYPE, in0, in1, sat_val); \
  1199. SAT_SH2(RTYPE, in2, in3, sat_val); \
  1200. }
  1201. #define SAT_SH4_SH(...) SAT_SH4(v8i16, __VA_ARGS__)
  1202. /* Description : Indexed halfword element values are replicated to all
  1203. elements in output vector
  1204. Arguments : Inputs - in, idx0, idx1
  1205. Outputs - out0, out1
  1206. Return Type - as per RTYPE
  1207. Details : 'idx0' element value from 'in' vector is replicated to all
  1208. elements in 'out0' vector
  1209. Valid index range for halfword operation is 0-7
  1210. */
  1211. #define SPLATI_H2(RTYPE, in, idx0, idx1, out0, out1) \
  1212. { \
  1213. out0 = (RTYPE) __msa_splati_h((v8i16) in, idx0); \
  1214. out1 = (RTYPE) __msa_splati_h((v8i16) in, idx1); \
  1215. }
  1216. #define SPLATI_H2_SH(...) SPLATI_H2(v8i16, __VA_ARGS__)
  1217. #define SPLATI_H4(RTYPE, in, idx0, idx1, idx2, idx3, \
  1218. out0, out1, out2, out3) \
  1219. { \
  1220. SPLATI_H2(RTYPE, in, idx0, idx1, out0, out1); \
  1221. SPLATI_H2(RTYPE, in, idx2, idx3, out2, out3); \
  1222. }
  1223. #define SPLATI_H4_SB(...) SPLATI_H4(v16i8, __VA_ARGS__)
  1224. #define SPLATI_H4_SH(...) SPLATI_H4(v8i16, __VA_ARGS__)
  1225. /* Description : Indexed word element values are replicated to all
  1226. elements in output vector
  1227. Arguments : Inputs - in, stidx
  1228. Outputs - out0, out1
  1229. Return Type - as per RTYPE
  1230. Details : 'stidx' element value from 'in' vector is replicated to all
  1231. elements in 'out0' vector
  1232. 'stidx + 1' element value from 'in' vector is replicated to all
  1233. elements in 'out1' vector
  1234. Valid index range for halfword operation is 0-3
  1235. */
  1236. #define SPLATI_W2(RTYPE, in, stidx, out0, out1) \
  1237. { \
  1238. out0 = (RTYPE) __msa_splati_w((v4i32) in, stidx); \
  1239. out1 = (RTYPE) __msa_splati_w((v4i32) in, (stidx+1)); \
  1240. }
  1241. #define SPLATI_W2_SW(...) SPLATI_W2(v4i32, __VA_ARGS__)
  1242. #define SPLATI_W4(RTYPE, in, out0, out1, out2, out3) \
  1243. { \
  1244. SPLATI_W2(RTYPE, in, 0, out0, out1); \
  1245. SPLATI_W2(RTYPE, in, 2, out2, out3); \
  1246. }
  1247. #define SPLATI_W4_SW(...) SPLATI_W4(v4i32, __VA_ARGS__)
  1248. /* Description : Pack even byte elements of vector pairs
  1249. Arguments : Inputs - in0, in1, in2, in3
  1250. Outputs - out0, out1
  1251. Return Type - as per RTYPE
  1252. Details : Even byte elements of in0 are copied to the left half of
  1253. out0 & even byte elements of in1 are copied to the right
  1254. half of out0.
  1255. Even byte elements of in2 are copied to the left half of
  1256. out1 & even byte elements of in3 are copied to the right
  1257. half of out1.
  1258. */
  1259. #define PCKEV_B2(RTYPE, in0, in1, in2, in3, out0, out1) \
  1260. { \
  1261. out0 = (RTYPE) __msa_pckev_b((v16i8) in0, (v16i8) in1); \
  1262. out1 = (RTYPE) __msa_pckev_b((v16i8) in2, (v16i8) in3); \
  1263. }
  1264. #define PCKEV_B2_SB(...) PCKEV_B2(v16i8, __VA_ARGS__)
  1265. #define PCKEV_B2_UB(...) PCKEV_B2(v16u8, __VA_ARGS__)
  1266. #define PCKEV_B2_SH(...) PCKEV_B2(v8i16, __VA_ARGS__)
  1267. #define PCKEV_B2_SW(...) PCKEV_B2(v4i32, __VA_ARGS__)
  1268. #define PCKEV_B3(RTYPE, in0, in1, in2, in3, in4, in5, out0, out1, out2) \
  1269. { \
  1270. PCKEV_B2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1271. out2 = (RTYPE) __msa_pckev_b((v16i8) in4, (v16i8) in5); \
  1272. }
  1273. #define PCKEV_B3_UB(...) PCKEV_B3(v16u8, __VA_ARGS__)
  1274. #define PCKEV_B3_SB(...) PCKEV_B3(v16i8, __VA_ARGS__)
  1275. #define PCKEV_B4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  1276. out0, out1, out2, out3) \
  1277. { \
  1278. PCKEV_B2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1279. PCKEV_B2(RTYPE, in4, in5, in6, in7, out2, out3); \
  1280. }
  1281. #define PCKEV_B4_SB(...) PCKEV_B4(v16i8, __VA_ARGS__)
  1282. #define PCKEV_B4_UB(...) PCKEV_B4(v16u8, __VA_ARGS__)
  1283. #define PCKEV_B4_SH(...) PCKEV_B4(v8i16, __VA_ARGS__)
  1284. #define PCKEV_B4_SW(...) PCKEV_B4(v4i32, __VA_ARGS__)
  1285. /* Description : Pack even halfword elements of vector pairs
  1286. Arguments : Inputs - in0, in1, in2, in3
  1287. Outputs - out0, out1
  1288. Return Type - as per RTYPE
  1289. Details : Even halfword elements of in0 are copied to the left half of
  1290. out0 & even halfword elements of in1 are copied to the right
  1291. half of out0.
  1292. Even halfword elements of in2 are copied to the left half of
  1293. out1 & even halfword elements of in3 are copied to the right
  1294. half of out1.
  1295. */
  1296. #define PCKEV_H2(RTYPE, in0, in1, in2, in3, out0, out1) \
  1297. { \
  1298. out0 = (RTYPE) __msa_pckev_h((v8i16) in0, (v8i16) in1); \
  1299. out1 = (RTYPE) __msa_pckev_h((v8i16) in2, (v8i16) in3); \
  1300. }
  1301. #define PCKEV_H2_SH(...) PCKEV_H2(v8i16, __VA_ARGS__)
  1302. #define PCKEV_H2_SW(...) PCKEV_H2(v4i32, __VA_ARGS__)
  1303. #define PCKEV_H4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  1304. out0, out1, out2, out3) \
  1305. { \
  1306. PCKEV_H2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1307. PCKEV_H2(RTYPE, in4, in5, in6, in7, out2, out3); \
  1308. }
  1309. #define PCKEV_H4_SH(...) PCKEV_H4(v8i16, __VA_ARGS__)
  1310. #define PCKEV_H4_SW(...) PCKEV_H4(v4i32, __VA_ARGS__)
  1311. /* Description : Each byte element is logically xor'ed with immediate 128
  1312. Arguments : Inputs - in0, in1
  1313. Outputs - in0, in1 (in-place)
  1314. Return Type - as per RTYPE
  1315. Details : Each unsigned byte element from input vector 'in0' is
  1316. logically xor'ed with 128 and result is in-place stored in
  1317. 'in0' vector
  1318. Each unsigned byte element from input vector 'in1' is
  1319. logically xor'ed with 128 and result is in-place stored in
  1320. 'in1' vector
  1321. Similar for other pairs
  1322. */
  1323. #define XORI_B2_128(RTYPE, in0, in1) \
  1324. { \
  1325. in0 = (RTYPE) __msa_xori_b((v16u8) in0, 128); \
  1326. in1 = (RTYPE) __msa_xori_b((v16u8) in1, 128); \
  1327. }
  1328. #define XORI_B2_128_SB(...) XORI_B2_128(v16i8, __VA_ARGS__)
  1329. #define XORI_B3_128(RTYPE, in0, in1, in2) \
  1330. { \
  1331. XORI_B2_128(RTYPE, in0, in1); \
  1332. in2 = (RTYPE) __msa_xori_b((v16u8) in2, 128); \
  1333. }
  1334. #define XORI_B3_128_SB(...) XORI_B3_128(v16i8, __VA_ARGS__)
  1335. #define XORI_B4_128(RTYPE, in0, in1, in2, in3) \
  1336. { \
  1337. XORI_B2_128(RTYPE, in0, in1); \
  1338. XORI_B2_128(RTYPE, in2, in3); \
  1339. }
  1340. #define XORI_B4_128_UB(...) XORI_B4_128(v16u8, __VA_ARGS__)
  1341. #define XORI_B4_128_SB(...) XORI_B4_128(v16i8, __VA_ARGS__)
  1342. #define XORI_B4_128_SH(...) XORI_B4_128(v8i16, __VA_ARGS__)
  1343. #define XORI_B5_128(RTYPE, in0, in1, in2, in3, in4) \
  1344. { \
  1345. XORI_B3_128(RTYPE, in0, in1, in2); \
  1346. XORI_B2_128(RTYPE, in3, in4); \
  1347. }
  1348. #define XORI_B5_128_SB(...) XORI_B5_128(v16i8, __VA_ARGS__)
  1349. #define XORI_B6_128(RTYPE, in0, in1, in2, in3, in4, in5) \
  1350. { \
  1351. XORI_B4_128(RTYPE, in0, in1, in2, in3); \
  1352. XORI_B2_128(RTYPE, in4, in5); \
  1353. }
  1354. #define XORI_B6_128_SB(...) XORI_B6_128(v16i8, __VA_ARGS__)
  1355. #define XORI_B7_128(RTYPE, in0, in1, in2, in3, in4, in5, in6) \
  1356. { \
  1357. XORI_B4_128(RTYPE, in0, in1, in2, in3); \
  1358. XORI_B3_128(RTYPE, in4, in5, in6); \
  1359. }
  1360. #define XORI_B7_128_SB(...) XORI_B7_128(v16i8, __VA_ARGS__)
  1361. #define XORI_B8_128(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7) \
  1362. { \
  1363. XORI_B4_128(RTYPE, in0, in1, in2, in3); \
  1364. XORI_B4_128(RTYPE, in4, in5, in6, in7); \
  1365. }
  1366. #define XORI_B8_128_SB(...) XORI_B8_128(v16i8, __VA_ARGS__)
  1367. /* Description : Addition of signed halfword elements and signed saturation
  1368. Arguments : Inputs - in0, in1, in2, in3
  1369. Outputs - out0, out1
  1370. Return Type - as per RTYPE
  1371. Details : Signed halfword elements from 'in0' are added to signed
  1372. halfword elements of 'in1'. The result is then signed saturated
  1373. between -32768 to +32767 (as per halfword data type)
  1374. Similar for other pairs
  1375. */
  1376. #define ADDS_SH2(RTYPE, in0, in1, in2, in3, out0, out1) \
  1377. { \
  1378. out0 = (RTYPE) __msa_adds_s_h((v8i16) in0, (v8i16) in1); \
  1379. out1 = (RTYPE) __msa_adds_s_h((v8i16) in2, (v8i16) in3); \
  1380. }
  1381. #define ADDS_SH2_SH(...) ADDS_SH2(v8i16, __VA_ARGS__)
  1382. #define ADDS_SH4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  1383. out0, out1, out2, out3) \
  1384. { \
  1385. ADDS_SH2(RTYPE, in0, in1, in2, in3, out0, out1); \
  1386. ADDS_SH2(RTYPE, in4, in5, in6, in7, out2, out3); \
  1387. }
  1388. #define ADDS_SH4_UH(...) ADDS_SH4(v8u16, __VA_ARGS__)
  1389. #define ADDS_SH4_SH(...) ADDS_SH4(v8i16, __VA_ARGS__)
  1390. /* Description : Shift left all elements of vector (generic for all data types)
  1391. Arguments : Inputs - in0, in1, in2, in3, shift
  1392. Outputs - in0, in1, in2, in3 (in place)
  1393. Return Type - as per input vector RTYPE
  1394. Details : Each element of vector 'in0' is left shifted by 'shift' and
  1395. result is in place written to 'in0'
  1396. Similar for other pairs
  1397. */
  1398. #define SLLI_4V(in0, in1, in2, in3, shift) \
  1399. { \
  1400. in0 = in0 << shift; \
  1401. in1 = in1 << shift; \
  1402. in2 = in2 << shift; \
  1403. in3 = in3 << shift; \
  1404. }
  1405. /* Description : Arithmetic shift right all elements of vector
  1406. (generic for all data types)
  1407. Arguments : Inputs - in0, in1, in2, in3, shift
  1408. Outputs - in0, in1, in2, in3 (in place)
  1409. Return Type - as per input vector RTYPE
  1410. Details : Each element of vector 'in0' is right shifted by 'shift' and
  1411. result is in place written to 'in0'
  1412. Here, 'shift' is GP variable passed in
  1413. Similar for other pairs
  1414. */
  1415. #define SRA_4V(in0, in1, in2, in3, shift) \
  1416. { \
  1417. in0 = in0 >> shift; \
  1418. in1 = in1 >> shift; \
  1419. in2 = in2 >> shift; \
  1420. in3 = in3 >> shift; \
  1421. }
  1422. /* Description : Shift right logical all halfword elements of vector
  1423. Arguments : Inputs - in0, in1, in2, in3, shift
  1424. Outputs - in0, in1, in2, in3 (in place)
  1425. Return Type - unsigned halfword
  1426. Details : Each element of vector 'in0' is shifted right logical by
  1427. number of bits respective element holds in vector 'shift' and
  1428. result is in place written to 'in0'
  1429. Here, 'shift' is a vector passed in
  1430. Similar for other pairs
  1431. */
  1432. #define SRL_H4(RTYPE, in0, in1, in2, in3, shift) \
  1433. { \
  1434. in0 = (RTYPE) __msa_srl_h((v8i16) in0, (v8i16) shift); \
  1435. in1 = (RTYPE) __msa_srl_h((v8i16) in1, (v8i16) shift); \
  1436. in2 = (RTYPE) __msa_srl_h((v8i16) in2, (v8i16) shift); \
  1437. in3 = (RTYPE) __msa_srl_h((v8i16) in3, (v8i16) shift); \
  1438. }
  1439. #define SRL_H4_UH(...) SRL_H4(v8u16, __VA_ARGS__)
  1440. /* Description : Shift right arithmetic rounded halfwords
  1441. Arguments : Inputs - in0, in1, shift
  1442. Outputs - in0, in1, (in place)
  1443. Return Type - unsigned halfword
  1444. Details : Each element of vector 'in0' is shifted right arithmetic by
  1445. number of bits respective element holds in vector 'shift'.
  1446. The last discarded bit is added to shifted value for rounding
  1447. and the result is in place written to 'in0'
  1448. Here, 'shift' is a vector passed in
  1449. Similar for other pairs
  1450. */
  1451. #define SRAR_H2(RTYPE, in0, in1, shift) \
  1452. { \
  1453. in0 = (RTYPE) __msa_srar_h((v8i16) in0, (v8i16) shift); \
  1454. in1 = (RTYPE) __msa_srar_h((v8i16) in1, (v8i16) shift); \
  1455. }
  1456. #define SRAR_H2_UH(...) SRAR_H2(v8u16, __VA_ARGS__)
  1457. #define SRAR_H2_SH(...) SRAR_H2(v8i16, __VA_ARGS__)
  1458. #define SRAR_H3(RTYPE, in0, in1, in2, shift) \
  1459. { \
  1460. SRAR_H2(RTYPE, in0, in1, shift) \
  1461. in2 = (RTYPE) __msa_srar_h((v8i16) in2, (v8i16) shift); \
  1462. }
  1463. #define SRAR_H3_SH(...) SRAR_H3(v8i16, __VA_ARGS__)
  1464. #define SRAR_H4(RTYPE, in0, in1, in2, in3, shift) \
  1465. { \
  1466. SRAR_H2(RTYPE, in0, in1, shift) \
  1467. SRAR_H2(RTYPE, in2, in3, shift) \
  1468. }
  1469. #define SRAR_H4_UH(...) SRAR_H4(v8u16, __VA_ARGS__)
  1470. #define SRAR_H4_SH(...) SRAR_H4(v8i16, __VA_ARGS__)
  1471. /* Description : Shift right arithmetic rounded words
  1472. Arguments : Inputs - in0, in1, shift
  1473. Outputs - in0, in1, (in place)
  1474. Return Type - as per RTYPE
  1475. Details : Each element of vector 'in0' is shifted right arithmetic by
  1476. number of bits respective element holds in vector 'shift'.
  1477. The last discarded bit is added to shifted value for rounding
  1478. and the result is in place written to 'in0'
  1479. Here, 'shift' is a vector passed in
  1480. Similar for other pairs
  1481. */
  1482. #define SRAR_W2(RTYPE, in0, in1, shift) \
  1483. { \
  1484. in0 = (RTYPE) __msa_srar_w((v4i32) in0, (v4i32) shift); \
  1485. in1 = (RTYPE) __msa_srar_w((v4i32) in1, (v4i32) shift); \
  1486. }
  1487. #define SRAR_W2_SW(...) SRAR_W2(v4i32, __VA_ARGS__)
  1488. #define SRAR_W4(RTYPE, in0, in1, in2, in3, shift) \
  1489. { \
  1490. SRAR_W2(RTYPE, in0, in1, shift) \
  1491. SRAR_W2(RTYPE, in2, in3, shift) \
  1492. }
  1493. #define SRAR_W4_SW(...) SRAR_W4(v4i32, __VA_ARGS__)
  1494. /* Description : Shift right arithmetic rounded (immediate)
  1495. Arguments : Inputs - in0, in1, in2, in3, shift
  1496. Outputs - in0, in1, in2, in3 (in place)
  1497. Return Type - as per RTYPE
  1498. Details : Each element of vector 'in0' is shifted right arithmetic by
  1499. value in 'shift'.
  1500. The last discarded bit is added to shifted value for rounding
  1501. and the result is in place written to 'in0'
  1502. Similar for other pairs
  1503. */
  1504. #define SRARI_H2(RTYPE, in0, in1, shift) \
  1505. { \
  1506. in0 = (RTYPE) __msa_srari_h((v8i16) in0, shift); \
  1507. in1 = (RTYPE) __msa_srari_h((v8i16) in1, shift); \
  1508. }
  1509. #define SRARI_H2_UH(...) SRARI_H2(v8u16, __VA_ARGS__)
  1510. #define SRARI_H2_SH(...) SRARI_H2(v8i16, __VA_ARGS__)
  1511. /* Description : Shift right arithmetic rounded (immediate)
  1512. Arguments : Inputs - in0, in1, shift
  1513. Outputs - in0, in1 (in place)
  1514. Return Type - as per RTYPE
  1515. Details : Each element of vector 'in0' is shifted right arithmetic by
  1516. value in 'shift'.
  1517. The last discarded bit is added to shifted value for rounding
  1518. and the result is in place written to 'in0'
  1519. Similar for other pairs
  1520. */
  1521. #define SRARI_W2(RTYPE, in0, in1, shift) \
  1522. { \
  1523. in0 = (RTYPE) __msa_srari_w((v4i32) in0, shift); \
  1524. in1 = (RTYPE) __msa_srari_w((v4i32) in1, shift); \
  1525. }
  1526. #define SRARI_W2_SW(...) SRARI_W2(v4i32, __VA_ARGS__)
  1527. #define SRARI_W4(RTYPE, in0, in1, in2, in3, shift) \
  1528. { \
  1529. SRARI_W2(RTYPE, in0, in1, shift); \
  1530. SRARI_W2(RTYPE, in2, in3, shift); \
  1531. }
  1532. #define SRARI_W4_SH(...) SRARI_W4(v8i16, __VA_ARGS__)
  1533. #define SRARI_W4_SW(...) SRARI_W4(v4i32, __VA_ARGS__)
  1534. /* Description : Multiplication of pairs of vectors
  1535. Arguments : Inputs - in0, in1, in2, in3
  1536. Outputs - out0, out1
  1537. Details : Each element from 'in0' is multiplied with elements from 'in1'
  1538. and result is written to 'out0'
  1539. Similar for other pairs
  1540. */
  1541. #define MUL2(in0, in1, in2, in3, out0, out1) \
  1542. { \
  1543. out0 = in0 * in1; \
  1544. out1 = in2 * in3; \
  1545. }
  1546. #define MUL4(in0, in1, in2, in3, in4, in5, in6, in7, out0, out1, out2, out3) \
  1547. { \
  1548. MUL2(in0, in1, in2, in3, out0, out1); \
  1549. MUL2(in4, in5, in6, in7, out2, out3); \
  1550. }
  1551. /* Description : Addition of 2 pairs of vectors
  1552. Arguments : Inputs - in0, in1, in2, in3
  1553. Outputs - out0, out1
  1554. Details : Each element from 2 pairs vectors is added and 2 results are
  1555. produced
  1556. */
  1557. #define ADD2(in0, in1, in2, in3, out0, out1) \
  1558. { \
  1559. out0 = in0 + in1; \
  1560. out1 = in2 + in3; \
  1561. }
  1562. #define ADD4(in0, in1, in2, in3, in4, in5, in6, in7, out0, out1, out2, out3) \
  1563. { \
  1564. ADD2(in0, in1, in2, in3, out0, out1); \
  1565. ADD2(in4, in5, in6, in7, out2, out3); \
  1566. }
  1567. /* Description : Zero extend unsigned byte elements to halfword elements
  1568. Arguments : Inputs - in (1 input unsigned byte vector)
  1569. Outputs - out0, out1 (unsigned 2 halfword vectors)
  1570. Return Type - signed halfword
  1571. Details : Zero extended right half of vector is returned in 'out0'
  1572. Zero extended left half of vector is returned in 'out1'
  1573. */
  1574. #define UNPCK_UB_SH(in, out0, out1) \
  1575. { \
  1576. v16i8 zero_m = { 0 }; \
  1577. \
  1578. ILVRL_B2_SH(zero_m, in, out0, out1); \
  1579. }
  1580. /* Description : Sign extend halfword elements from input vector and return
  1581. result in pair of vectors
  1582. Arguments : Inputs - in (1 input halfword vector)
  1583. Outputs - out0, out1 (sign extended 2 word vectors)
  1584. Return Type - signed word
  1585. Details : Sign bit of halfword elements from input vector 'in' is
  1586. extracted and interleaved right with same vector 'in0' to
  1587. generate 4 signed word elements in 'out0'
  1588. Then interleaved left with same vector 'in0' to
  1589. generate 4 signed word elements in 'out1'
  1590. */
  1591. #define UNPCK_SH_SW(in, out0, out1) \
  1592. { \
  1593. v8i16 tmp_m; \
  1594. \
  1595. tmp_m = __msa_clti_s_h((v8i16) in, 0); \
  1596. ILVRL_H2_SW(tmp_m, in, out0, out1); \
  1597. }
  1598. /* Description : Transposes input 4x4 byte block
  1599. Arguments : Inputs - in0, in1, in2, in3 (input 4x4 byte block)
  1600. Outputs - out0, out1, out2, out3 (output 4x4 byte block)
  1601. Return Type - unsigned byte
  1602. Details :
  1603. */
  1604. #define TRANSPOSE4x4_UB_UB(in0, in1, in2, in3, out0, out1, out2, out3) \
  1605. { \
  1606. v16i8 zero_m = { 0 }; \
  1607. v16i8 s0_m, s1_m, s2_m, s3_m; \
  1608. \
  1609. ILVR_D2_SB(in1, in0, in3, in2, s0_m, s1_m); \
  1610. ILVRL_B2_SB(s1_m, s0_m, s2_m, s3_m); \
  1611. \
  1612. out0 = (v16u8) __msa_ilvr_b(s3_m, s2_m); \
  1613. out1 = (v16u8) __msa_sldi_b(zero_m, (v16i8) out0, 4); \
  1614. out2 = (v16u8) __msa_sldi_b(zero_m, (v16i8) out1, 4); \
  1615. out3 = (v16u8) __msa_sldi_b(zero_m, (v16i8) out2, 4); \
  1616. }
  1617. /* Description : Transposes input 8x4 byte block into 4x8
  1618. Arguments : Inputs - in0, in1, in2, in3 (input 8x4 byte block)
  1619. Outputs - out0, out1, out2, out3 (output 4x8 byte block)
  1620. Return Type - unsigned byte
  1621. Details :
  1622. */
  1623. #define TRANSPOSE8x4_UB(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
  1624. out0, out1, out2, out3) \
  1625. { \
  1626. v16i8 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
  1627. \
  1628. ILVEV_W2_SB(in0, in4, in1, in5, tmp0_m, tmp1_m); \
  1629. tmp2_m = __msa_ilvr_b(tmp1_m, tmp0_m); \
  1630. ILVEV_W2_SB(in2, in6, in3, in7, tmp0_m, tmp1_m); \
  1631. \
  1632. tmp3_m = __msa_ilvr_b(tmp1_m, tmp0_m); \
  1633. ILVRL_H2_SB(tmp3_m, tmp2_m, tmp0_m, tmp1_m); \
  1634. \
  1635. ILVRL_W2(RTYPE, tmp1_m, tmp0_m, out0, out2); \
  1636. out1 = (RTYPE) __msa_ilvl_d((v2i64) out2, (v2i64) out0); \
  1637. out3 = (RTYPE) __msa_ilvl_d((v2i64) out0, (v2i64) out2); \
  1638. }
  1639. #define TRANSPOSE8x4_UB_UB(...) TRANSPOSE8x4_UB(v16u8, __VA_ARGS__)
  1640. /* Description : Transposes 16x8 block into 8x16 with byte elements in vectors
  1641. Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7,
  1642. in8, in9, in10, in11, in12, in13, in14, in15
  1643. Outputs - out0, out1, out2, out3, out4, out5, out6, out7
  1644. Return Type - unsigned byte
  1645. Details :
  1646. */
  1647. #define TRANSPOSE16x8_UB_UB(in0, in1, in2, in3, in4, in5, in6, in7, \
  1648. in8, in9, in10, in11, in12, in13, in14, in15, \
  1649. out0, out1, out2, out3, out4, out5, out6, out7) \
  1650. { \
  1651. v16u8 tmp0_m, tmp1_m, tmp2_m, tmp3_m; \
  1652. v16u8 tmp4_m, tmp5_m, tmp6_m, tmp7_m; \
  1653. \
  1654. ILVEV_D2_UB(in0, in8, in1, in9, out7, out6); \
  1655. ILVEV_D2_UB(in2, in10, in3, in11, out5, out4); \
  1656. ILVEV_D2_UB(in4, in12, in5, in13, out3, out2); \
  1657. ILVEV_D2_UB(in6, in14, in7, in15, out1, out0); \
  1658. \
  1659. tmp0_m = (v16u8) __msa_ilvev_b((v16i8) out6, (v16i8) out7); \
  1660. tmp4_m = (v16u8) __msa_ilvod_b((v16i8) out6, (v16i8) out7); \
  1661. tmp1_m = (v16u8) __msa_ilvev_b((v16i8) out4, (v16i8) out5); \
  1662. tmp5_m = (v16u8) __msa_ilvod_b((v16i8) out4, (v16i8) out5); \
  1663. out5 = (v16u8) __msa_ilvev_b((v16i8) out2, (v16i8) out3); \
  1664. tmp6_m = (v16u8) __msa_ilvod_b((v16i8) out2, (v16i8) out3); \
  1665. out7 = (v16u8) __msa_ilvev_b((v16i8) out0, (v16i8) out1); \
  1666. tmp7_m = (v16u8) __msa_ilvod_b((v16i8) out0, (v16i8) out1); \
  1667. \
  1668. ILVEV_H2_UB(tmp0_m, tmp1_m, out5, out7, tmp2_m, tmp3_m); \
  1669. out0 = (v16u8) __msa_ilvev_w((v4i32) tmp3_m, (v4i32) tmp2_m); \
  1670. out4 = (v16u8) __msa_ilvod_w((v4i32) tmp3_m, (v4i32) tmp2_m); \
  1671. \
  1672. tmp2_m = (v16u8) __msa_ilvod_h((v8i16) tmp1_m, (v8i16) tmp0_m); \
  1673. tmp3_m = (v16u8) __msa_ilvod_h((v8i16) out7, (v8i16) out5); \
  1674. out2 = (v16u8) __msa_ilvev_w((v4i32) tmp3_m, (v4i32) tmp2_m); \
  1675. out6 = (v16u8) __msa_ilvod_w((v4i32) tmp3_m, (v4i32) tmp2_m); \
  1676. \
  1677. ILVEV_H2_UB(tmp4_m, tmp5_m, tmp6_m, tmp7_m, tmp2_m, tmp3_m); \
  1678. out1 = (v16u8) __msa_ilvev_w((v4i32) tmp3_m, (v4i32) tmp2_m); \
  1679. out5 = (v16u8) __msa_ilvod_w((v4i32) tmp3_m, (v4i32) tmp2_m); \
  1680. \
  1681. tmp2_m = (v16u8) __msa_ilvod_h((v8i16) tmp5_m, (v8i16) tmp4_m); \
  1682. tmp2_m = (v16u8) __msa_ilvod_h((v8i16) tmp5_m, (v8i16) tmp4_m); \
  1683. tmp3_m = (v16u8) __msa_ilvod_h((v8i16) tmp7_m, (v8i16) tmp6_m); \
  1684. tmp3_m = (v16u8) __msa_ilvod_h((v8i16) tmp7_m, (v8i16) tmp6_m); \
  1685. out3 = (v16u8) __msa_ilvev_w((v4i32) tmp3_m, (v4i32) tmp2_m); \
  1686. out7 = (v16u8) __msa_ilvod_w((v4i32) tmp3_m, (v4i32) tmp2_m); \
  1687. }
  1688. /* Description : Pack even elements of input vectors & xor with 128
  1689. Arguments : Inputs - in0, in1
  1690. Outputs - out_m
  1691. Return Type - unsigned byte
  1692. Details : Signed byte even elements from 'in0' and 'in1' are packed
  1693. together in one vector and the resulted vector is xor'ed with
  1694. 128 to shift the range from signed to unsigned byte
  1695. */
  1696. #define PCKEV_XORI128_UB(in0, in1) \
  1697. ( { \
  1698. v16u8 out_m; \
  1699. out_m = (v16u8) __msa_pckev_b((v16i8) in1, (v16i8) in0); \
  1700. out_m = (v16u8) __msa_xori_b((v16u8) out_m, 128); \
  1701. out_m; \
  1702. } )
  1703. /* Description : Pack even byte elements, extract 0 & 2 index words from pair
  1704. of results and store 4 words in destination memory as per
  1705. stride
  1706. Arguments : Inputs - in0, in1, in2, in3, pdst, stride
  1707. */
  1708. #define PCKEV_ST4x4_UB(in0, in1, in2, in3, pdst, stride) \
  1709. { \
  1710. uint32_t out0_m, out1_m, out2_m, out3_m; \
  1711. v16i8 tmp0_m, tmp1_m; \
  1712. \
  1713. PCKEV_B2_SB(in1, in0, in3, in2, tmp0_m, tmp1_m); \
  1714. \
  1715. out0_m = __msa_copy_u_w((v4i32) tmp0_m, 0); \
  1716. out1_m = __msa_copy_u_w((v4i32) tmp0_m, 2); \
  1717. out2_m = __msa_copy_u_w((v4i32) tmp1_m, 0); \
  1718. out3_m = __msa_copy_u_w((v4i32) tmp1_m, 2); \
  1719. \
  1720. SW4(out0_m, out1_m, out2_m, out3_m, pdst, stride); \
  1721. }
  1722. #endif /* AVUTIL_MIPS_GENERIC_MACROS_MSA_H */