Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: source/libvpx/vp9/common/mips/msa/vp9_macros_msa.h

Issue 1217053002: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 Loads word in 'out2' from (psrc + 2 * stride) 237 Loads word in 'out2' from (psrc + 2 * stride)
238 Loads word in 'out3' from (psrc + 3 * stride) 238 Loads word in 'out3' from (psrc + 3 * stride)
239 */ 239 */
240 #define LW4(psrc, stride, out0, out1, out2, out3) { \ 240 #define LW4(psrc, stride, out0, out1, out2, out3) { \
241 out0 = LW((psrc)); \ 241 out0 = LW((psrc)); \
242 out1 = LW((psrc) + stride); \ 242 out1 = LW((psrc) + stride); \
243 out2 = LW((psrc) + 2 * stride); \ 243 out2 = LW((psrc) + 2 * stride); \
244 out3 = LW((psrc) + 3 * stride); \ 244 out3 = LW((psrc) + 3 * stride); \
245 } 245 }
246 246
247 /* Description : Load double words with stride
248 Arguments : Inputs - psrc (source pointer to load from)
249 - stride
250 Outputs - out0, out1
251 Details : Loads double word in 'out0' from (psrc)
252 Loads double word in 'out1' from (psrc + stride)
253 */
254 #define LD2(psrc, stride, out0, out1) { \
255 out0 = LD((psrc)); \
256 out1 = LD((psrc) + stride); \
257 }
258 #define LD4(psrc, stride, out0, out1, out2, out3) { \
259 LD2((psrc), stride, out0, out1); \
260 LD2((psrc) + 2 * stride, stride, out2, out3); \
261 }
262
247 /* Description : Store 4 words with stride 263 /* Description : Store 4 words with stride
248 Arguments : Inputs - in0, in1, in2, in3, pdst, stride 264 Arguments : Inputs - in0, in1, in2, in3, pdst, stride
249 Details : Stores word from 'in0' to (pdst) 265 Details : Stores word from 'in0' to (pdst)
250 Stores word from 'in1' to (pdst + stride) 266 Stores word from 'in1' to (pdst + stride)
251 Stores word from 'in2' to (pdst + 2 * stride) 267 Stores word from 'in2' to (pdst + 2 * stride)
252 Stores word from 'in3' to (pdst + 3 * stride) 268 Stores word from 'in3' to (pdst + 3 * stride)
253 */ 269 */
254 #define SW4(in0, in1, in2, in3, pdst, stride) { \ 270 #define SW4(in0, in1, in2, in3, pdst, stride) { \
255 SW(in0, (pdst)) \ 271 SW(in0, (pdst)) \
256 SW(in1, (pdst) + stride); \ 272 SW(in1, (pdst) + stride); \
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 Arguments : Inputs - psrc 373 Arguments : Inputs - psrc
358 Outputs - out0, out1, out2, out3 374 Outputs - out0, out1, out2, out3
359 */ 375 */
360 #define LD4x4_SH(psrc, out0, out1, out2, out3) { \ 376 #define LD4x4_SH(psrc, out0, out1, out2, out3) { \
361 out0 = LD_SH(psrc); \ 377 out0 = LD_SH(psrc); \
362 out2 = LD_SH(psrc + 8); \ 378 out2 = LD_SH(psrc + 8); \
363 out1 = (v8i16)__msa_ilvl_d((v2i64)out0, (v2i64)out0); \ 379 out1 = (v8i16)__msa_ilvl_d((v2i64)out0, (v2i64)out0); \
364 out3 = (v8i16)__msa_ilvl_d((v2i64)out2, (v2i64)out2); \ 380 out3 = (v8i16)__msa_ilvl_d((v2i64)out2, (v2i64)out2); \
365 } 381 }
366 382
383 /* Description : Load 2 vectors of signed word elements with stride
384 Arguments : Inputs - psrc (source pointer to load from)
385 - stride
386 Outputs - out0, out1
387 Return Type - signed word
388 */
389 #define LD_SW2(psrc, stride, out0, out1) { \
390 out0 = LD_SW((psrc)); \
391 out1 = LD_SW((psrc) + stride); \
392 }
393
367 /* Description : Store vectors of 16 byte elements with stride 394 /* Description : Store vectors of 16 byte elements with stride
368 Arguments : Inputs - in0, in1, stride 395 Arguments : Inputs - in0, in1, stride
369 Outputs - pdst (destination pointer to store to) 396 Outputs - pdst (destination pointer to store to)
370 Details : Stores 16 byte elements from 'in0' to (pdst) 397 Details : Stores 16 byte elements from 'in0' to (pdst)
371 Stores 16 byte elements from 'in1' to (pdst + stride) 398 Stores 16 byte elements from 'in1' to (pdst + stride)
372 */ 399 */
373 #define ST_B2(RTYPE, in0, in1, pdst, stride) { \ 400 #define ST_B2(RTYPE, in0, in1, pdst, stride) { \
374 ST_B(RTYPE, in0, (pdst)); \ 401 ST_B(RTYPE, in0, (pdst)); \
375 ST_B(RTYPE, in1, (pdst) + stride); \ 402 ST_B(RTYPE, in1, (pdst) + stride); \
376 } 403 }
(...skipping 29 matching lines...) Expand all
406 ST_H2(RTYPE, in2, in3, (pdst) + 2 * stride, stride); \ 433 ST_H2(RTYPE, in2, in3, (pdst) + 2 * stride, stride); \
407 } 434 }
408 #define ST_SH4(...) ST_H4(v8i16, __VA_ARGS__) 435 #define ST_SH4(...) ST_H4(v8i16, __VA_ARGS__)
409 436
410 #define ST_H8(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, pdst, stride) { \ 437 #define ST_H8(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, pdst, stride) { \
411 ST_H4(RTYPE, in0, in1, in2, in3, (pdst), stride); \ 438 ST_H4(RTYPE, in0, in1, in2, in3, (pdst), stride); \
412 ST_H4(RTYPE, in4, in5, in6, in7, (pdst) + 4 * stride, stride); \ 439 ST_H4(RTYPE, in4, in5, in6, in7, (pdst) + 4 * stride, stride); \
413 } 440 }
414 #define ST_SH8(...) ST_H8(v8i16, __VA_ARGS__) 441 #define ST_SH8(...) ST_H8(v8i16, __VA_ARGS__)
415 442
443 /* Description : Store vectors of word elements with stride
444 Arguments : Inputs - in0, in1, stride
445 - pdst (destination pointer to store to)
446 Details : Store 4 word elements from 'in0' to (pdst)
447 Store 4 word elements from 'in1' to (pdst + stride)
448 */
449 #define ST_SW2(in0, in1, pdst, stride) { \
450 ST_SW(in0, (pdst)); \
451 ST_SW(in1, (pdst) + stride); \
452 }
453
416 /* Description : Store as 2x4 byte block to destination memory from input vector 454 /* Description : Store as 2x4 byte block to destination memory from input vector
417 Arguments : Inputs - in, stidx, pdst, stride 455 Arguments : Inputs - in, stidx, pdst, stride
418 Return Type - unsigned byte 456 Return Type - unsigned byte
419 Details : Index stidx halfword element from 'in' vector is copied and 457 Details : Index stidx halfword element from 'in' vector is copied and
420 stored on first line 458 stored on first line
421 Index stidx+1 halfword element from 'in' vector is copied and 459 Index stidx+1 halfword element from 'in' vector is copied and
422 stored on second line 460 stored on second line
423 Index stidx+2 halfword element from 'in' vector is copied and 461 Index stidx+2 halfword element from 'in' vector is copied and
424 stored on third line 462 stored on third line
425 Index stidx+3 halfword element from 'in' vector is copied and 463 Index stidx+3 halfword element from 'in' vector is copied and
426 stored on fourth line 464 stored on fourth line
427 */ 465 */
428 #define ST2x4_UB(in, stidx, pdst, stride) { \ 466 #define ST2x4_UB(in, stidx, pdst, stride) { \
429 uint16_t out0_m, out1_m, out2_m, out3_m; \ 467 uint16_t out0_m, out1_m, out2_m, out3_m; \
430 uint8_t *pblk_2x4_m = (uint8_t *)(pdst); \ 468 uint8_t *pblk_2x4_m = (uint8_t *)(pdst); \
431 \ 469 \
432 out0_m = __msa_copy_u_h((v8i16)in, (stidx)); \ 470 out0_m = __msa_copy_u_h((v8i16)in, (stidx)); \
433 out1_m = __msa_copy_u_h((v8i16)in, (stidx + 1)); \ 471 out1_m = __msa_copy_u_h((v8i16)in, (stidx + 1)); \
434 out2_m = __msa_copy_u_h((v8i16)in, (stidx + 2)); \ 472 out2_m = __msa_copy_u_h((v8i16)in, (stidx + 2)); \
435 out3_m = __msa_copy_u_h((v8i16)in, (stidx + 3)); \ 473 out3_m = __msa_copy_u_h((v8i16)in, (stidx + 3)); \
436 \ 474 \
437 SH(out0_m, pblk_2x4_m); \ 475 SH(out0_m, pblk_2x4_m); \
438 SH(out1_m, pblk_2x4_m + stride); \ 476 SH(out1_m, pblk_2x4_m + stride); \
439 SH(out2_m, pblk_2x4_m + 2 * stride); \ 477 SH(out2_m, pblk_2x4_m + 2 * stride); \
440 SH(out3_m, pblk_2x4_m + 3 * stride); \ 478 SH(out3_m, pblk_2x4_m + 3 * stride); \
441 } 479 }
442 480
481 /* Description : Store 4x2 byte block to destination memory from input vector
482 Arguments : Inputs - in, pdst, stride
483 Details : Index 0 word element from 'in' vector is copied to a GP
484 register and stored to (pdst)
485 Index 1 word element from 'in' vector is copied to a GP
486 register and stored to (pdst + stride)
487 */
488 #define ST4x2_UB(in, pdst, stride) { \
489 uint32_t out0_m, out1_m; \
490 uint8_t *pblk_4x2_m = (uint8_t *)(pdst); \
491 \
492 out0_m = __msa_copy_u_w((v4i32)in, 0); \
493 out1_m = __msa_copy_u_w((v4i32)in, 1); \
494 \
495 SW(out0_m, pblk_4x2_m); \
496 SW(out1_m, pblk_4x2_m + stride); \
497 }
498
443 /* Description : Store as 4x4 byte block to destination memory from input vector 499 /* Description : Store as 4x4 byte block to destination memory from input vector
444 Arguments : Inputs - in0, in1, pdst, stride 500 Arguments : Inputs - in0, in1, pdst, stride
445 Return Type - unsigned byte 501 Return Type - unsigned byte
446 Details : Idx0 word element from input vector 'in0' is copied and stored 502 Details : Idx0 word element from input vector 'in0' is copied and stored
447 on first line 503 on first line
448 Idx1 word element from input vector 'in0' is copied and stored 504 Idx1 word element from input vector 'in0' is copied and stored
449 on second line 505 on second line
450 Idx2 word element from input vector 'in1' is copied and stored 506 Idx2 word element from input vector 'in1' is copied and stored
451 on third line 507 on third line
452 Idx3 word element from input vector 'in1' is copied and stored 508 Idx3 word element from input vector 'in1' is copied and stored
(...skipping 22 matching lines...) Expand all
475 Details : Index 0 double word element from input vector 'in' is copied 531 Details : Index 0 double word element from input vector 'in' is copied
476 and stored to destination memory at (pdst) 532 and stored to destination memory at (pdst)
477 */ 533 */
478 #define ST8x1_UB(in, pdst) { \ 534 #define ST8x1_UB(in, pdst) { \
479 uint64_t out0_m; \ 535 uint64_t out0_m; \
480 \ 536 \
481 out0_m = __msa_copy_u_d((v2i64)in, 0); \ 537 out0_m = __msa_copy_u_d((v2i64)in, 0); \
482 SD(out0_m, pdst); \ 538 SD(out0_m, pdst); \
483 } 539 }
484 540
541 /* Description : Store as 8x2 byte block to destination memory from input vector
542 Arguments : Inputs - in, pdst, stride
543 Details : Index 0 double word element from input vector 'in' is copied
544 and stored to destination memory at (pdst)
545 Index 1 double word element from input vector 'in' is copied
546 and stored to destination memory at (pdst + stride)
547 */
548 #define ST8x2_UB(in, pdst, stride) { \
549 uint64_t out0_m, out1_m; \
550 uint8_t *pblk_8x2_m = (uint8_t *)(pdst); \
551 \
552 out0_m = __msa_copy_u_d((v2i64)in, 0); \
553 out1_m = __msa_copy_u_d((v2i64)in, 1); \
554 \
555 SD(out0_m, pblk_8x2_m); \
556 SD(out1_m, pblk_8x2_m + stride); \
557 }
558
485 /* Description : Store as 8x4 byte block to destination memory from input 559 /* Description : Store as 8x4 byte block to destination memory from input
486 vectors 560 vectors
487 Arguments : Inputs - in0, in1, pdst, stride 561 Arguments : Inputs - in0, in1, pdst, stride
488 Details : Index 0 double word element from input vector 'in0' is copied 562 Details : Index 0 double word element from input vector 'in0' is copied
489 and stored to destination memory at (pblk_8x4_m) 563 and stored to destination memory at (pblk_8x4_m)
490 Index 1 double word element from input vector 'in0' is copied 564 Index 1 double word element from input vector 'in0' is copied
491 and stored to destination memory at (pblk_8x4_m + stride) 565 and stored to destination memory at (pblk_8x4_m + stride)
492 Index 0 double word element from input vector 'in1' is copied 566 Index 0 double word element from input vector 'in1' is copied
493 and stored to destination memory at (pblk_8x4_m + 2 * stride) 567 and stored to destination memory at (pblk_8x4_m + 2 * stride)
494 Index 1 double word element from input vector 'in1' is copied 568 Index 1 double word element from input vector 'in1' is copied
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 #define DOTP_SH2_SW(...) DOTP_SH2(v4i32, __VA_ARGS__) 742 #define DOTP_SH2_SW(...) DOTP_SH2(v4i32, __VA_ARGS__)
669 743
670 #define DOTP_SH4(RTYPE, mult0, mult1, mult2, mult3, \ 744 #define DOTP_SH4(RTYPE, mult0, mult1, mult2, mult3, \
671 cnst0, cnst1, cnst2, cnst3, \ 745 cnst0, cnst1, cnst2, cnst3, \
672 out0, out1, out2, out3) { \ 746 out0, out1, out2, out3) { \
673 DOTP_SH2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1); \ 747 DOTP_SH2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1); \
674 DOTP_SH2(RTYPE, mult2, mult3, cnst2, cnst3, out2, out3); \ 748 DOTP_SH2(RTYPE, mult2, mult3, cnst2, cnst3, out2, out3); \
675 } 749 }
676 #define DOTP_SH4_SW(...) DOTP_SH4(v4i32, __VA_ARGS__) 750 #define DOTP_SH4_SW(...) DOTP_SH4(v4i32, __VA_ARGS__)
677 751
752 /* Description : Dot product of word vector elements
753 Arguments : Inputs - mult0, mult1
754 cnst0, cnst1
755 Outputs - out0, out1
756 Return Type - signed word
757 Details : Signed word elements from mult0 are multiplied with
758 signed word elements from cnst0 producing a result
759 twice the size of input i.e. signed double word.
760 Then this multiplication results of adjacent odd-even elements
761 are added together and stored to the out vector
762 (2 signed double word results)
763 */
764 #define DOTP_SW2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) { \
765 out0 = (RTYPE)__msa_dotp_s_d((v4i32)mult0, (v4i32)cnst0); \
766 out1 = (RTYPE)__msa_dotp_s_d((v4i32)mult1, (v4i32)cnst1); \
767 }
768 #define DOTP_SW2_SD(...) DOTP_SW2(v2i64, __VA_ARGS__)
769
678 /* Description : Dot product & addition of byte vector elements 770 /* Description : Dot product & addition of byte vector elements
679 Arguments : Inputs - mult0, mult1 771 Arguments : Inputs - mult0, mult1
680 cnst0, cnst1 772 cnst0, cnst1
681 Outputs - out0, out1 773 Outputs - out0, out1
682 Return Type - signed halfword 774 Return Type - signed halfword
683 Details : Signed byte elements from mult0 are multiplied with 775 Details : Signed byte elements from mult0 are multiplied with
684 signed byte elements from cnst0 producing a result 776 signed byte elements from cnst0 producing a result
685 twice the size of input i.e. signed halfword. 777 twice the size of input i.e. signed halfword.
686 Then this multiplication results of adjacent odd-even elements 778 Then this multiplication results of adjacent odd-even elements
687 are added to the out vector 779 are added to the out vector
688 (2 signed halfword results) 780 (2 signed halfword results)
689 */ 781 */
690 #define DPADD_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) { \ 782 #define DPADD_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) { \
691 out0 = (RTYPE)__msa_dpadd_s_h((v8i16)out0, (v16i8)mult0, (v16i8)cnst0); \ 783 out0 = (RTYPE)__msa_dpadd_s_h((v8i16)out0, (v16i8)mult0, (v16i8)cnst0); \
692 out1 = (RTYPE)__msa_dpadd_s_h((v8i16)out1, (v16i8)mult1, (v16i8)cnst1); \ 784 out1 = (RTYPE)__msa_dpadd_s_h((v8i16)out1, (v16i8)mult1, (v16i8)cnst1); \
693 } 785 }
694 #define DPADD_SB2_SH(...) DPADD_SB2(v8i16, __VA_ARGS__) 786 #define DPADD_SB2_SH(...) DPADD_SB2(v8i16, __VA_ARGS__)
695 787
696 #define DPADD_SB4(RTYPE, mult0, mult1, mult2, mult3, \ 788 #define DPADD_SB4(RTYPE, mult0, mult1, mult2, mult3, \
697 cnst0, cnst1, cnst2, cnst3, out0, out1, out2, out3) { \ 789 cnst0, cnst1, cnst2, cnst3, out0, out1, out2, out3) { \
698 DPADD_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1); \ 790 DPADD_SB2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1); \
699 DPADD_SB2(RTYPE, mult2, mult3, cnst2, cnst3, out2, out3); \ 791 DPADD_SB2(RTYPE, mult2, mult3, cnst2, cnst3, out2, out3); \
700 } 792 }
701 #define DPADD_SB4_SH(...) DPADD_SB4(v8i16, __VA_ARGS__) 793 #define DPADD_SB4_SH(...) DPADD_SB4(v8i16, __VA_ARGS__)
702 794
795 /* Description : Dot product & addition of halfword vector elements
796 Arguments : Inputs - mult0, mult1
797 cnst0, cnst1
798 Outputs - out0, out1
799 Return Type - as per RTYPE
800 Details : Signed halfword elements from 'mult0' are multiplied with
801 signed halfword elements from 'cnst0' producing a result
802 twice the size of input i.e. signed word.
803 The multiplication result of adjacent odd-even elements
804 are added to the 'out0' vector
805 */
806 #define DPADD_SH2(RTYPE, mult0, mult1, cnst0, cnst1, out0, out1) { \
807 out0 = (RTYPE)__msa_dpadd_s_w((v4i32)out0, (v8i16)mult0, (v8i16)cnst0); \
808 out1 = (RTYPE)__msa_dpadd_s_w((v4i32)out1, (v8i16)mult1, (v8i16)cnst1); \
809 }
810 #define DPADD_SH2_SW(...) DPADD_SH2(v4i32, __VA_ARGS__)
811
812 /* Description : Dot product & addition of double word vector elements
813 Arguments : Inputs - mult0, mult1
814 Outputs - out0, out1
815 Return Type - as per RTYPE
816 Details : Each signed word element from 'mult0' is multiplied with itself
817 producing an intermediate result twice the size of input
818 i.e. signed double word
819 The multiplication result of adjacent odd-even elements
820 are added to the 'out0' vector
821 */
822 #define DPADD_SD2(RTYPE, mult0, mult1, out0, out1) { \
823 out0 = (RTYPE)__msa_dpadd_s_d((v2i64)out0, (v4i32)mult0, (v4i32)mult0); \
824 out1 = (RTYPE)__msa_dpadd_s_d((v2i64)out1, (v4i32)mult1, (v4i32)mult1); \
825 }
826 #define DPADD_SD2_SD(...) DPADD_SD2(v2i64, __VA_ARGS__)
827
703 /* Description : Minimum values between unsigned elements of 828 /* Description : Minimum values between unsigned elements of
704 either vector are copied to the output vector 829 either vector are copied to the output vector
705 Arguments : Inputs - in0, in1, min_vec 830 Arguments : Inputs - in0, in1, min_vec
706 Outputs - in0, in1, (in place) 831 Outputs - in0, in1, (in place)
707 Return Type - unsigned halfword 832 Return Type - unsigned halfword
708 Details : Minimum of unsigned halfword element values from 'in0' and 833 Details : Minimum of unsigned halfword element values from 'in0' and
709 'min_value' are written to output vector 'in0' 834 'min_value' are written to output vector 'in0'
710 */ 835 */
711 #define MIN_UH2(RTYPE, in0, in1, min_vec) { \ 836 #define MIN_UH2(RTYPE, in0, in1, min_vec) { \
712 in0 = (RTYPE)__msa_min_u_h((v8u16)in0, min_vec); \ 837 in0 = (RTYPE)__msa_min_u_h((v8u16)in0, min_vec); \
(...skipping 23 matching lines...) Expand all
736 }) 861 })
737 #define CLIP_SH2_0_255(in0, in1) { \ 862 #define CLIP_SH2_0_255(in0, in1) { \
738 in0 = CLIP_SH_0_255(in0); \ 863 in0 = CLIP_SH_0_255(in0); \
739 in1 = CLIP_SH_0_255(in1); \ 864 in1 = CLIP_SH_0_255(in1); \
740 } 865 }
741 #define CLIP_SH4_0_255(in0, in1, in2, in3) { \ 866 #define CLIP_SH4_0_255(in0, in1, in2, in3) { \
742 CLIP_SH2_0_255(in0, in1); \ 867 CLIP_SH2_0_255(in0, in1); \
743 CLIP_SH2_0_255(in2, in3); \ 868 CLIP_SH2_0_255(in2, in3); \
744 } 869 }
745 870
871 /* Description : Addition of 4 signed word elements
872 4 signed word elements of input vector are added together and
873 the resulting integer sum is returned
874 Arguments : Inputs - in (signed word vector)
875 Outputs - sum_m (i32 sum)
876 Return Type - signed word
877 */
878 #define HADD_SW_S32(in) ({ \
879 v2i64 res0_m, res1_m; \
880 int32_t sum_m; \
881 \
882 res0_m = __msa_hadd_s_d((v4i32)in, (v4i32)in); \
883 res1_m = __msa_splati_d(res0_m, 1); \
884 res0_m = res0_m + res1_m; \
885 sum_m = __msa_copy_s_w((v4i32)res0_m, 0); \
886 sum_m; \
887 })
888
889 /* Description : Horizontal addition of unsigned byte vector elements
890 Arguments : Inputs - in0, in1
891 Outputs - out0, out1
892 Return Type - as per RTYPE
893 Details : Each unsigned odd byte element from 'in0' is added to
894 even unsigned byte element from 'in0' (pairwise) and the
895 halfword result is stored in 'out0'
896 */
897 #define HADD_UB2(RTYPE, in0, in1, out0, out1) { \
898 out0 = (RTYPE)__msa_hadd_u_h((v16u8)in0, (v16u8)in0); \
899 out1 = (RTYPE)__msa_hadd_u_h((v16u8)in1, (v16u8)in1); \
900 }
901 #define HADD_UB2_UH(...) HADD_UB2(v8u16, __VA_ARGS__)
902
903 #define HADD_UB4(RTYPE, in0, in1, in2, in3, out0, out1, out2, out3) { \
904 HADD_UB2(RTYPE, in0, in1, out0, out1); \
905 HADD_UB2(RTYPE, in2, in3, out2, out3); \
906 }
907 #define HADD_UB4_UH(...) HADD_UB4(v8u16, __VA_ARGS__)
908
909 /* Description : Horizontal subtraction of unsigned byte vector elements
910 Arguments : Inputs - in0, in1
911 Outputs - out0, out1
912 Return Type - as per RTYPE
913 Details : Each unsigned odd byte element from 'in0' is subtracted from
914 even unsigned byte element from 'in0' (pairwise) and the
915 halfword result is written to 'out0'
916 */
917 #define HSUB_UB2(RTYPE, in0, in1, out0, out1) { \
918 out0 = (RTYPE)__msa_hsub_u_h((v16u8)in0, (v16u8)in0); \
919 out1 = (RTYPE)__msa_hsub_u_h((v16u8)in1, (v16u8)in1); \
920 }
921 #define HSUB_UB2_SH(...) HSUB_UB2(v8i16, __VA_ARGS__)
922
923 /* Description : Horizontal subtraction of signed halfword vector elements
924 Arguments : Inputs - in0, in1
925 Outputs - out0, out1
926 Return Type - as per RTYPE
927 Details : Each signed odd halfword element from 'in0' is subtracted from
928 even signed halfword element from 'in0' (pairwise) and the
929 word result is written to 'out0'
930 */
931 #define HSUB_UH2(RTYPE, in0, in1, out0, out1) { \
932 out0 = (RTYPE)__msa_hsub_s_w((v8i16)in0, (v8i16)in0); \
933 out1 = (RTYPE)__msa_hsub_s_w((v8i16)in1, (v8i16)in1); \
934 }
935 #define HSUB_UH2_SW(...) HSUB_UH2(v4i32, __VA_ARGS__)
936
746 /* Description : Insert specified word elements from input vectors to 1 937 /* Description : Insert specified word elements from input vectors to 1
747 destination vector 938 destination vector
748 Arguments : Inputs - in0, in1, in2, in3 (4 input vectors) 939 Arguments : Inputs - in0, in1, in2, in3 (4 input vectors)
749 Outputs - out (output vector) 940 Outputs - out (output vector)
750 Return Type - as per RTYPE 941 Return Type - as per RTYPE
751 */ 942 */
752 #define INSERT_W2(RTYPE, in0, in1, out) { \ 943 #define INSERT_W2(RTYPE, in0, in1, out) { \
753 out = (RTYPE)__msa_insert_w((v4i32)out, 0, in0); \ 944 out = (RTYPE)__msa_insert_w((v4i32)out, 0, in0); \
754 out = (RTYPE)__msa_insert_w((v4i32)out, 1, in1); \ 945 out = (RTYPE)__msa_insert_w((v4i32)out, 1, in1); \
755 } 946 }
756 #define INSERT_W2_SB(...) INSERT_W2(v16i8, __VA_ARGS__) 947 #define INSERT_W2_SB(...) INSERT_W2(v16i8, __VA_ARGS__)
757 948
949 #define INSERT_W4(RTYPE, in0, in1, in2, in3, out) { \
950 out = (RTYPE)__msa_insert_w((v4i32)out, 0, in0); \
951 out = (RTYPE)__msa_insert_w((v4i32)out, 1, in1); \
952 out = (RTYPE)__msa_insert_w((v4i32)out, 2, in2); \
953 out = (RTYPE)__msa_insert_w((v4i32)out, 3, in3); \
954 }
955 #define INSERT_W4_UB(...) INSERT_W4(v16u8, __VA_ARGS__)
956 #define INSERT_W4_SB(...) INSERT_W4(v16i8, __VA_ARGS__)
957
958 /* Description : Insert specified double word elements from input vectors to 1
959 destination vector
960 Arguments : Inputs - in0, in1 (2 input vectors)
961 Outputs - out (output vector)
962 Return Type - as per RTYPE
963 */
964 #define INSERT_D2(RTYPE, in0, in1, out) { \
965 out = (RTYPE)__msa_insert_d((v2i64)out, 0, in0); \
966 out = (RTYPE)__msa_insert_d((v2i64)out, 1, in1); \
967 }
968 #define INSERT_D2_UB(...) INSERT_D2(v16u8, __VA_ARGS__)
969 #define INSERT_D2_SB(...) INSERT_D2(v16i8, __VA_ARGS__)
970
758 /* Description : Interleave even byte elements from vectors 971 /* Description : Interleave even byte elements from vectors
759 Arguments : Inputs - in0, in1, in2, in3 972 Arguments : Inputs - in0, in1, in2, in3
760 Outputs - out0, out1 973 Outputs - out0, out1
761 Return Type - as per RTYPE 974 Return Type - as per RTYPE
762 Details : Even byte elements of 'in0' and even byte 975 Details : Even byte elements of 'in0' and even byte
763 elements of 'in1' are interleaved and copied to 'out0' 976 elements of 'in1' are interleaved and copied to 'out0'
764 Even byte elements of 'in2' and even byte 977 Even byte elements of 'in2' and even byte
765 elements of 'in3' are interleaved and copied to 'out1' 978 elements of 'in3' are interleaved and copied to 'out1'
766 */ 979 */
767 #define ILVEV_B2(RTYPE, in0, in1, in2, in3, out0, out1) { \ 980 #define ILVEV_B2(RTYPE, in0, in1, in2, in3, out0, out1) { \
(...skipping 13 matching lines...) Expand all
781 elements of 'in3' are interleaved and copied to 'out1' 994 elements of 'in3' are interleaved and copied to 'out1'
782 */ 995 */
783 #define ILVEV_H2(RTYPE, in0, in1, in2, in3, out0, out1) { \ 996 #define ILVEV_H2(RTYPE, in0, in1, in2, in3, out0, out1) { \
784 out0 = (RTYPE)__msa_ilvev_h((v8i16)in1, (v8i16)in0); \ 997 out0 = (RTYPE)__msa_ilvev_h((v8i16)in1, (v8i16)in0); \
785 out1 = (RTYPE)__msa_ilvev_h((v8i16)in3, (v8i16)in2); \ 998 out1 = (RTYPE)__msa_ilvev_h((v8i16)in3, (v8i16)in2); \
786 } 999 }
787 #define ILVEV_H2_UB(...) ILVEV_H2(v16u8, __VA_ARGS__) 1000 #define ILVEV_H2_UB(...) ILVEV_H2(v16u8, __VA_ARGS__)
788 #define ILVEV_H2_SH(...) ILVEV_H2(v8i16, __VA_ARGS__) 1001 #define ILVEV_H2_SH(...) ILVEV_H2(v8i16, __VA_ARGS__)
789 #define ILVEV_H2_SW(...) ILVEV_H2(v4i32, __VA_ARGS__) 1002 #define ILVEV_H2_SW(...) ILVEV_H2(v4i32, __VA_ARGS__)
790 1003
1004 /* Description : Interleave even word elements from vectors
1005 Arguments : Inputs - in0, in1, in2, in3
1006 Outputs - out0, out1
1007 Return Type - as per RTYPE
1008 Details : Even word elements of 'in0' and 'in1' are interleaved
1009 and written to 'out0'
1010 */
1011 #define ILVEV_W2(RTYPE, in0, in1, in2, in3, out0, out1) { \
1012 out0 = (RTYPE)__msa_ilvev_w((v4i32)in1, (v4i32)in0); \
1013 out1 = (RTYPE)__msa_ilvev_w((v4i32)in3, (v4i32)in2); \
1014 }
1015 #define ILVEV_W2_SB(...) ILVEV_W2(v16i8, __VA_ARGS__)
1016
791 /* Description : Interleave even double word elements from vectors 1017 /* Description : Interleave even double word elements from vectors
792 Arguments : Inputs - in0, in1, in2, in3 1018 Arguments : Inputs - in0, in1, in2, in3
793 Outputs - out0, out1 1019 Outputs - out0, out1
794 Return Type - as per RTYPE 1020 Return Type - as per RTYPE
795 Details : Even double word elements of 'in0' and even double word 1021 Details : Even double word elements of 'in0' and even double word
796 elements of 'in1' are interleaved and copied to 'out0' 1022 elements of 'in1' are interleaved and copied to 'out0'
797 Even double word elements of 'in2' and even double word 1023 Even double word elements of 'in2' and even double word
798 elements of 'in3' are interleaved and copied to 'out1' 1024 elements of 'in3' are interleaved and copied to 'out1'
799 */ 1025 */
800 #define ILVEV_D2(RTYPE, in0, in1, in2, in3, out0, out1) { \ 1026 #define ILVEV_D2(RTYPE, in0, in1, in2, in3, out0, out1) { \
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 #define ILVRL_W2_SH(...) ILVRL_W2(v8i16, __VA_ARGS__) 1225 #define ILVRL_W2_SH(...) ILVRL_W2(v8i16, __VA_ARGS__)
1000 #define ILVRL_W2_SW(...) ILVRL_W2(v4i32, __VA_ARGS__) 1226 #define ILVRL_W2_SW(...) ILVRL_W2(v4i32, __VA_ARGS__)
1001 1227
1002 /* Description : Saturate the halfword element values to the max 1228 /* Description : Saturate the halfword element values to the max
1003 unsigned value of (sat_val+1 bits) 1229 unsigned value of (sat_val+1 bits)
1004 The element data width remains unchanged 1230 The element data width remains unchanged
1005 Arguments : Inputs - in0, in1, in2, in3, sat_val 1231 Arguments : Inputs - in0, in1, in2, in3, sat_val
1006 Outputs - in0, in1, in2, in3 (in place) 1232 Outputs - in0, in1, in2, in3 (in place)
1007 Return Type - unsigned halfword 1233 Return Type - unsigned halfword
1008 Details : Each unsigned halfword element from 'in0' is saturated to the 1234 Details : Each unsigned halfword element from 'in0' is saturated to the
1009 value generated with (sat_val+1) bit range 1235 value generated with (sat_val+1) bit range.
1010 Results are in placed to original vectors 1236 The results are stored in place
1011 */ 1237 */
1012 #define SAT_UH2(RTYPE, in0, in1, sat_val) { \ 1238 #define SAT_UH2(RTYPE, in0, in1, sat_val) { \
1013 in0 = (RTYPE)__msa_sat_u_h((v8u16)in0, sat_val); \ 1239 in0 = (RTYPE)__msa_sat_u_h((v8u16)in0, sat_val); \
1014 in1 = (RTYPE)__msa_sat_u_h((v8u16)in1, sat_val); \ 1240 in1 = (RTYPE)__msa_sat_u_h((v8u16)in1, sat_val); \
1015 } 1241 }
1016 #define SAT_UH2_UH(...) SAT_UH2(v8u16, __VA_ARGS__) 1242 #define SAT_UH2_UH(...) SAT_UH2(v8u16, __VA_ARGS__)
1017 1243
1018 #define SAT_UH4(RTYPE, in0, in1, in2, in3, sat_val) { \ 1244 #define SAT_UH4(RTYPE, in0, in1, in2, in3, sat_val) { \
1019 SAT_UH2(RTYPE, in0, in1, sat_val); \ 1245 SAT_UH2(RTYPE, in0, in1, sat_val); \
1020 SAT_UH2(RTYPE, in2, in3, sat_val) \ 1246 SAT_UH2(RTYPE, in2, in3, sat_val) \
1021 } 1247 }
1022 #define SAT_UH4_UH(...) SAT_UH4(v8u16, __VA_ARGS__) 1248 #define SAT_UH4_UH(...) SAT_UH4(v8u16, __VA_ARGS__)
1023 1249
1024 /* Description : Saturate the halfword element values to the max 1250 /* Description : Saturate the halfword element values to the max
1025 unsigned value of (sat_val+1 bits) 1251 unsigned value of (sat_val+1 bits)
1026 The element data width remains unchanged 1252 The element data width remains unchanged
1027 Arguments : Inputs - in0, in1, in2, in3, sat_val 1253 Arguments : Inputs - in0, in1, in2, in3, sat_val
1028 Outputs - in0, in1, in2, in3 (in place) 1254 Outputs - in0, in1, in2, in3 (in place)
1029 Return Type - unsigned halfword 1255 Return Type - unsigned halfword
1030 Details : Each unsigned halfword element from 'in0' is saturated to the 1256 Details : Each unsigned halfword element from 'in0' is saturated to the
1031 value generated with (sat_val+1) bit range 1257 value generated with (sat_val+1) bit range
1032 Results are in placed to original vectors 1258 The results are stored in place
1033 */ 1259 */
1034 #define SAT_SH2(RTYPE, in0, in1, sat_val) { \ 1260 #define SAT_SH2(RTYPE, in0, in1, sat_val) { \
1035 in0 = (RTYPE)__msa_sat_s_h((v8i16)in0, sat_val); \ 1261 in0 = (RTYPE)__msa_sat_s_h((v8i16)in0, sat_val); \
1036 in1 = (RTYPE)__msa_sat_s_h((v8i16)in1, sat_val); \ 1262 in1 = (RTYPE)__msa_sat_s_h((v8i16)in1, sat_val); \
1037 } 1263 }
1038 #define SAT_SH2_SH(...) SAT_SH2(v8i16, __VA_ARGS__) 1264 #define SAT_SH2_SH(...) SAT_SH2(v8i16, __VA_ARGS__)
1039 1265
1040 #define SAT_SH4(RTYPE, in0, in1, in2, in3, sat_val) { \ 1266 #define SAT_SH4(RTYPE, in0, in1, in2, in3, sat_val) { \
1041 SAT_SH2(RTYPE, in0, in1, sat_val); \ 1267 SAT_SH2(RTYPE, in0, in1, sat_val); \
1042 SAT_SH2(RTYPE, in2, in3, sat_val); \ 1268 SAT_SH2(RTYPE, in2, in3, sat_val); \
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 PCKEV_D2(RTYPE, in0, in1, in2, in3, out0, out1); \ 1368 PCKEV_D2(RTYPE, in0, in1, in2, in3, out0, out1); \
1143 PCKEV_D2(RTYPE, in4, in5, in6, in7, out2, out3); \ 1369 PCKEV_D2(RTYPE, in4, in5, in6, in7, out2, out3); \
1144 } 1370 }
1145 #define PCKEV_D4_UB(...) PCKEV_D4(v16u8, __VA_ARGS__) 1371 #define PCKEV_D4_UB(...) PCKEV_D4(v16u8, __VA_ARGS__)
1146 1372
1147 /* Description : Each byte element is logically xor'ed with immediate 128 1373 /* Description : Each byte element is logically xor'ed with immediate 128
1148 Arguments : Inputs - in0, in1 1374 Arguments : Inputs - in0, in1
1149 Outputs - in0, in1 (in-place) 1375 Outputs - in0, in1 (in-place)
1150 Return Type - as per RTYPE 1376 Return Type - as per RTYPE
1151 Details : Each unsigned byte element from input vector 'in0' is 1377 Details : Each unsigned byte element from input vector 'in0' is
1152 logically xor'ed with 128 and result is in-place stored in 1378 logically xor'ed with 128 and the result is in-place stored in
1153 'in0' vector 1379 'in0' vector
1154 Each unsigned byte element from input vector 'in1' is 1380 Each unsigned byte element from input vector 'in1' is
1155 logically xor'ed with 128 and result is in-place stored in 1381 logically xor'ed with 128 and the result is in-place stored in
1156 'in1' vector 1382 'in1' vector
1157 Similar for other pairs 1383 Similar for other pairs
1158 */ 1384 */
1159 #define XORI_B2_128(RTYPE, in0, in1) { \ 1385 #define XORI_B2_128(RTYPE, in0, in1) { \
1160 in0 = (RTYPE)__msa_xori_b((v16u8)in0, 128); \ 1386 in0 = (RTYPE)__msa_xori_b((v16u8)in0, 128); \
1161 in1 = (RTYPE)__msa_xori_b((v16u8)in1, 128); \ 1387 in1 = (RTYPE)__msa_xori_b((v16u8)in1, 128); \
1162 } 1388 }
1163 #define XORI_B2_128_UB(...) XORI_B2_128(v16u8, __VA_ARGS__) 1389 #define XORI_B2_128_UB(...) XORI_B2_128(v16u8, __VA_ARGS__)
1164 #define XORI_B2_128_SB(...) XORI_B2_128(v16i8, __VA_ARGS__) 1390 #define XORI_B2_128_SB(...) XORI_B2_128(v16i8, __VA_ARGS__)
1165 1391
1166 #define XORI_B3_128(RTYPE, in0, in1, in2) { \ 1392 #define XORI_B3_128(RTYPE, in0, in1, in2) { \
1167 XORI_B2_128(RTYPE, in0, in1); \ 1393 XORI_B2_128(RTYPE, in0, in1); \
1168 in2 = (RTYPE)__msa_xori_b((v16u8)in2, 128); \ 1394 in2 = (RTYPE)__msa_xori_b((v16u8)in2, 128); \
1169 } 1395 }
1170 #define XORI_B3_128_SB(...) XORI_B3_128(v16i8, __VA_ARGS__) 1396 #define XORI_B3_128_SB(...) XORI_B3_128(v16i8, __VA_ARGS__)
1171 1397
1172 #define XORI_B4_128(RTYPE, in0, in1, in2, in3) { \ 1398 #define XORI_B4_128(RTYPE, in0, in1, in2, in3) { \
1173 XORI_B2_128(RTYPE, in0, in1); \ 1399 XORI_B2_128(RTYPE, in0, in1); \
1174 XORI_B2_128(RTYPE, in2, in3); \ 1400 XORI_B2_128(RTYPE, in2, in3); \
1175 } 1401 }
1176 #define XORI_B4_128_UB(...) XORI_B4_128(v16u8, __VA_ARGS__) 1402 #define XORI_B4_128_UB(...) XORI_B4_128(v16u8, __VA_ARGS__)
1177 #define XORI_B4_128_SB(...) XORI_B4_128(v16i8, __VA_ARGS__) 1403 #define XORI_B4_128_SB(...) XORI_B4_128(v16i8, __VA_ARGS__)
1178 1404
1179 #define XORI_B7_128(RTYPE, in0, in1, in2, in3, in4, in5, in6) { \ 1405 #define XORI_B7_128(RTYPE, in0, in1, in2, in3, in4, in5, in6) { \
1180 XORI_B4_128(RTYPE, in0, in1, in2, in3); \ 1406 XORI_B4_128(RTYPE, in0, in1, in2, in3); \
1181 XORI_B3_128(RTYPE, in4, in5, in6); \ 1407 XORI_B3_128(RTYPE, in4, in5, in6); \
1182 } 1408 }
1183 #define XORI_B7_128_SB(...) XORI_B7_128(v16i8, __VA_ARGS__) 1409 #define XORI_B7_128_SB(...) XORI_B7_128(v16i8, __VA_ARGS__)
1184 1410
1411 /* Description : Average of signed halfword elements -> (a + b) / 2
1412 Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
1413 Outputs - out0, out1, out2, out3
1414 Return Type - as per RTYPE
1415 Details : Each signed halfword element from 'in0' is added to each
1416 signed halfword element of 'in1' with full precision resulting
1417 in one extra bit in the result. The result is then divided by
1418 2 and written to 'out0'
1419 */
1420 #define AVE_SH4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
1421 out0, out1, out2, out3) { \
1422 out0 = (RTYPE)__msa_ave_s_h((v8i16)in0, (v8i16)in1); \
1423 out1 = (RTYPE)__msa_ave_s_h((v8i16)in2, (v8i16)in3); \
1424 out2 = (RTYPE)__msa_ave_s_h((v8i16)in4, (v8i16)in5); \
1425 out3 = (RTYPE)__msa_ave_s_h((v8i16)in6, (v8i16)in7); \
1426 }
1427 #define AVE_SH4_SH(...) AVE_SH4(v8i16, __VA_ARGS__)
1428
1185 /* Description : Addition of signed halfword elements and signed saturation 1429 /* Description : Addition of signed halfword elements and signed saturation
1186 Arguments : Inputs - in0, in1, in2, in3 1430 Arguments : Inputs - in0, in1, in2, in3
1187 Outputs - out0, out1 1431 Outputs - out0, out1
1188 Return Type - as per RTYPE 1432 Return Type - as per RTYPE
1189 Details : Signed halfword elements from 'in0' are added to signed 1433 Details : Signed halfword elements from 'in0' are added to signed
1190 halfword elements of 'in1'. The result is then signed saturated 1434 halfword elements of 'in1'. The result is then signed saturated
1191 between -32768 to +32767 (as per halfword data type) 1435 between -32768 to +32767 (as per halfword data type)
1192 Similar for other pairs 1436 Similar for other pairs
1193 */ 1437 */
1194 #define ADDS_SH2(RTYPE, in0, in1, in2, in3, out0, out1) { \ 1438 #define ADDS_SH2(RTYPE, in0, in1, in2, in3, out0, out1) { \
1195 out0 = (RTYPE)__msa_adds_s_h((v8i16)in0, (v8i16)in1); \ 1439 out0 = (RTYPE)__msa_adds_s_h((v8i16)in0, (v8i16)in1); \
1196 out1 = (RTYPE)__msa_adds_s_h((v8i16)in2, (v8i16)in3); \ 1440 out1 = (RTYPE)__msa_adds_s_h((v8i16)in2, (v8i16)in3); \
1197 } 1441 }
1198 #define ADDS_SH2_SH(...) ADDS_SH2(v8i16, __VA_ARGS__) 1442 #define ADDS_SH2_SH(...) ADDS_SH2(v8i16, __VA_ARGS__)
1199 1443
1200 #define ADDS_SH4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ 1444 #define ADDS_SH4(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
1201 out0, out1, out2, out3) { \ 1445 out0, out1, out2, out3) { \
1202 ADDS_SH2(RTYPE, in0, in1, in2, in3, out0, out1); \ 1446 ADDS_SH2(RTYPE, in0, in1, in2, in3, out0, out1); \
1203 ADDS_SH2(RTYPE, in4, in5, in6, in7, out2, out3); \ 1447 ADDS_SH2(RTYPE, in4, in5, in6, in7, out2, out3); \
1204 } 1448 }
1205 #define ADDS_SH4_SH(...) ADDS_SH4(v8i16, __VA_ARGS__) 1449 #define ADDS_SH4_SH(...) ADDS_SH4(v8i16, __VA_ARGS__)
1206 1450
1451 /* Description : Shift left all elements of vector (generic for all data types)
1452 Arguments : Inputs - in0, in1, in2, in3, shift
1453 Outputs - in0, in1, in2, in3 (in place)
1454 Return Type - as per input vector RTYPE
1455 Details : Each element of vector 'in0' is left shifted by 'shift' and
1456 the result is in place written to 'in0'
1457 Similar for other pairs
1458 */
1459 #define SLLI_4V(in0, in1, in2, in3, shift) { \
1460 in0 = in0 << shift; \
1461 in1 = in1 << shift; \
1462 in2 = in2 << shift; \
1463 in3 = in3 << shift; \
1464 }
1465
1207 /* Description : Arithmetic shift right all elements of vector 1466 /* Description : Arithmetic shift right all elements of vector
1208 (generic for all data types) 1467 (generic for all data types)
1209 Arguments : Inputs - in0, in1, in2, in3, shift 1468 Arguments : Inputs - in0, in1, in2, in3, shift
1210 Outputs - in0, in1, in2, in3 (in place) 1469 Outputs - in0, in1, in2, in3 (in place)
1211 Return Type - as per input vector RTYPE 1470 Return Type - as per input vector RTYPE
1212 Details : Each element of vector 'in0' is right shifted by 'shift' and 1471 Details : Each element of vector 'in0' is right shifted by 'shift' and
1213 result is in place written to 'in0' 1472 the result is in place written to 'in0'
1214 Here, 'shift' is GP variable passed in 1473 Here, 'shift' is GP variable passed in
1215 Similar for other pairs 1474 Similar for other pairs
1216 */ 1475 */
1217 #define SRA_4V(in0, in1, in2, in3, shift) { \ 1476 #define SRA_4V(in0, in1, in2, in3, shift) { \
1218 in0 = in0 >> shift; \ 1477 in0 = in0 >> shift; \
1219 in1 = in1 >> shift; \ 1478 in1 = in1 >> shift; \
1220 in2 = in2 >> shift; \ 1479 in2 = in2 >> shift; \
1221 in3 = in3 >> shift; \ 1480 in3 = in3 >> shift; \
1222 } 1481 }
1223 1482
1483 /* Description : Shift right arithmetic rounded words
1484 Arguments : Inputs - in0, in1, shift
1485 Outputs - in place operation
1486 Return Type - as per RTYPE
1487 Details : Each element of vector 'in0' is shifted right arithmetically by
1488 the number of bits in the corresponding element in the vector
1489 'shift'. The last discarded bit is added to shifted value for
1490 rounding and the result is written in-place.
1491 'shift' is a vector.
1492 */
1493 #define SRAR_W2(RTYPE, in0, in1, shift) { \
1494 in0 = (RTYPE)__msa_srar_w((v4i32)in0, (v4i32)shift); \
1495 in1 = (RTYPE)__msa_srar_w((v4i32)in1, (v4i32)shift); \
1496 }
1497
1498 #define SRAR_W4(RTYPE, in0, in1, in2, in3, shift) { \
1499 SRAR_W2(RTYPE, in0, in1, shift) \
1500 SRAR_W2(RTYPE, in2, in3, shift) \
1501 }
1502 #define SRAR_W4_SW(...) SRAR_W4(v4i32, __VA_ARGS__)
1503
1224 /* Description : Shift right arithmetic rounded (immediate) 1504 /* Description : Shift right arithmetic rounded (immediate)
1225 Arguments : Inputs - in0, in1, in2, in3, shift 1505 Arguments : Inputs - in0, in1, in2, in3, shift
1226 Outputs - in0, in1, in2, in3 (in place) 1506 Outputs - in0, in1, in2, in3 (in place)
1227 Return Type - as per RTYPE 1507 Return Type - as per RTYPE
1228 Details : Each element of vector 'in0' is shifted right arithmetic by 1508 Details : Each element of vector 'in0' is shifted right arithmetic by
1229 value in 'shift'. 1509 value in 'shift'.
1230 The last discarded bit is added to shifted value for rounding 1510 The last discarded bit is added to shifted value for rounding
1231 and the result is in place written to 'in0' 1511 and the result is in place written to 'in0'
1232 Similar for other pairs 1512 Similar for other pairs
1233 */ 1513 */
(...skipping 26 matching lines...) Expand all
1260 in1 = (RTYPE)__msa_srari_w((v4i32)in1, shift); \ 1540 in1 = (RTYPE)__msa_srari_w((v4i32)in1, shift); \
1261 } 1541 }
1262 #define SRARI_W2_SW(...) SRARI_W2(v4i32, __VA_ARGS__) 1542 #define SRARI_W2_SW(...) SRARI_W2(v4i32, __VA_ARGS__)
1263 1543
1264 #define SRARI_W4(RTYPE, in0, in1, in2, in3, shift) { \ 1544 #define SRARI_W4(RTYPE, in0, in1, in2, in3, shift) { \
1265 SRARI_W2(RTYPE, in0, in1, shift); \ 1545 SRARI_W2(RTYPE, in0, in1, shift); \
1266 SRARI_W2(RTYPE, in2, in3, shift); \ 1546 SRARI_W2(RTYPE, in2, in3, shift); \
1267 } 1547 }
1268 #define SRARI_W4_SW(...) SRARI_W4(v4i32, __VA_ARGS__) 1548 #define SRARI_W4_SW(...) SRARI_W4(v4i32, __VA_ARGS__)
1269 1549
1550 /* Description : Logical shift right all elements of vector (immediate)
1551 Arguments : Inputs - in0, in1, in2, in3, shift
1552 Outputs - out0, out1, out2, out3
1553 Return Type - as per RTYPE
1554 Details : Each element of vector 'in0' is right shifted by 'shift' and
1555 the result is written in-place. 'shift' is an immediate value.
1556 */
1557 #define SRLI_H4(RTYPE, in0, in1, in2, in3, out0, out1, out2, out3, shift) { \
1558 out0 = (RTYPE)__msa_srli_h((v8i16)in0, shift); \
1559 out1 = (RTYPE)__msa_srli_h((v8i16)in1, shift); \
1560 out2 = (RTYPE)__msa_srli_h((v8i16)in2, shift); \
1561 out3 = (RTYPE)__msa_srli_h((v8i16)in3, shift); \
1562 }
1563 #define SRLI_H4_SH(...) SRLI_H4(v8i16, __VA_ARGS__)
1564
1565 /* Description : Multiplication of pairs of vectors
1566 Arguments : Inputs - in0, in1, in2, in3
1567 Outputs - out0, out1
1568 Details : Each element from 'in0' is multiplied with elements from 'in1'
1569 and the result is written to 'out0'
1570 */
1571 #define MUL2(in0, in1, in2, in3, out0, out1) { \
1572 out0 = in0 * in1; \
1573 out1 = in2 * in3; \
1574 }
1575 #define MUL4(in0, in1, in2, in3, in4, in5, in6, in7, \
1576 out0, out1, out2, out3) { \
1577 MUL2(in0, in1, in2, in3, out0, out1); \
1578 MUL2(in4, in5, in6, in7, out2, out3); \
1579 }
1580
1270 /* Description : Addition of 2 pairs of vectors 1581 /* Description : Addition of 2 pairs of vectors
1271 Arguments : Inputs - in0, in1, in2, in3 1582 Arguments : Inputs - in0, in1, in2, in3
1272 Outputs - out0, out1 1583 Outputs - out0, out1
1273 Details : Each element from 2 pairs vectors is added and 2 results are 1584 Details : Each element from 2 pairs vectors is added and 2 results are
1274 produced 1585 produced
1275 */ 1586 */
1276 #define ADD2(in0, in1, in2, in3, out0, out1) { \ 1587 #define ADD2(in0, in1, in2, in3, out0, out1) { \
1277 out0 = in0 + in1; \ 1588 out0 = in0 + in1; \
1278 out1 = in2 + in3; \ 1589 out1 = in2 + in3; \
1279 } 1590 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 Return Type - signed halfword 1633 Return Type - signed halfword
1323 Details : Zero extended right half of vector is returned in 'out0' 1634 Details : Zero extended right half of vector is returned in 'out0'
1324 Zero extended left half of vector is returned in 'out1' 1635 Zero extended left half of vector is returned in 'out1'
1325 */ 1636 */
1326 #define UNPCK_UB_SH(in, out0, out1) { \ 1637 #define UNPCK_UB_SH(in, out0, out1) { \
1327 v16i8 zero_m = { 0 }; \ 1638 v16i8 zero_m = { 0 }; \
1328 \ 1639 \
1329 ILVRL_B2_SH(zero_m, in, out0, out1); \ 1640 ILVRL_B2_SH(zero_m, in, out0, out1); \
1330 } 1641 }
1331 1642
1643 /* Description : Sign extend halfword elements from input vector and return
1644 result in pair of vectors
1645 Arguments : Inputs - in (1 input halfword vector)
1646 Outputs - out0, out1 (sign extended 2 word vectors)
1647 Return Type - signed word
1648 Details : Sign bit of halfword elements from input vector 'in' is
1649 extracted and interleaved right with same vector 'in0' to
1650 generate 4 signed word elements in 'out0'
1651 Then interleaved left with same vector 'in0' to
1652 generate 4 signed word elements in 'out1'
1653 */
1654 #define UNPCK_SH_SW(in, out0, out1) { \
1655 v8i16 tmp_m; \
1656 \
1657 tmp_m = __msa_clti_s_h((v8i16)in, 0); \
1658 ILVRL_H2_SW(tmp_m, in, out0, out1); \
1659 }
1660
1332 /* Description : Butterfly of 4 input vectors 1661 /* Description : Butterfly of 4 input vectors
1333 Arguments : Inputs - in0, in1, in2, in3 1662 Arguments : Inputs - in0, in1, in2, in3
1334 Outputs - out0, out1, out2, out3 1663 Outputs - out0, out1, out2, out3
1335 Details : Butterfly operation 1664 Details : Butterfly operation
1336 */ 1665 */
1337 #define BUTTERFLY_4(in0, in1, in2, in3, out0, out1, out2, out3) { \ 1666 #define BUTTERFLY_4(in0, in1, in2, in3, out0, out1, out2, out3) { \
1338 out0 = in0 + in3; \ 1667 out0 = in0 + in3; \
1339 out1 = in1 + in2; \ 1668 out1 = in1 + in2; \
1340 \ 1669 \
1341 out2 = in1 - in2; \ 1670 out2 = in1 - in2; \
(...skipping 11 matching lines...) Expand all
1353 out1 = in1 + in6; \ 1682 out1 = in1 + in6; \
1354 out2 = in2 + in5; \ 1683 out2 = in2 + in5; \
1355 out3 = in3 + in4; \ 1684 out3 = in3 + in4; \
1356 \ 1685 \
1357 out4 = in3 - in4; \ 1686 out4 = in3 - in4; \
1358 out5 = in2 - in5; \ 1687 out5 = in2 - in5; \
1359 out6 = in1 - in6; \ 1688 out6 = in1 - in6; \
1360 out7 = in0 - in7; \ 1689 out7 = in0 - in7; \
1361 } 1690 }
1362 1691
1692 /* Description : Butterfly of 16 input vectors
1693 Arguments : Inputs - in0 ... in15
1694 Outputs - out0 .. out15
1695 Details : Butterfly operation
1696 */
1697 #define BUTTERFLY_16(in0, in1, in2, in3, in4, in5, in6, in7, \
1698 in8, in9, in10, in11, in12, in13, in14, in15, \
1699 out0, out1, out2, out3, out4, out5, out6, out7, \
1700 out8, out9, out10, out11, out12, out13, out14, out15) { \
1701 out0 = in0 + in15; \
1702 out1 = in1 + in14; \
1703 out2 = in2 + in13; \
1704 out3 = in3 + in12; \
1705 out4 = in4 + in11; \
1706 out5 = in5 + in10; \
1707 out6 = in6 + in9; \
1708 out7 = in7 + in8; \
1709 \
1710 out8 = in7 - in8; \
1711 out9 = in6 - in9; \
1712 out10 = in5 - in10; \
1713 out11 = in4 - in11; \
1714 out12 = in3 - in12; \
1715 out13 = in2 - in13; \
1716 out14 = in1 - in14; \
1717 out15 = in0 - in15; \
1718 }
1719
1363 /* Description : Transposes input 8x8 byte block 1720 /* Description : Transposes input 8x8 byte block
1364 Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7 1721 Arguments : Inputs - in0, in1, in2, in3, in4, in5, in6, in7
1365 (input 8x8 byte block) 1722 (input 8x8 byte block)
1366 Outputs - out0, out1, out2, out3, out4, out5, out6, out7 1723 Outputs - out0, out1, out2, out3, out4, out5, out6, out7
1367 (output 8x8 byte block) 1724 (output 8x8 byte block)
1368 Return Type - unsigned byte 1725 Return Type - unsigned byte
1369 Details : 1726 Details :
1370 */ 1727 */
1371 #define TRANSPOSE8x8_UB(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \ 1728 #define TRANSPOSE8x8_UB(RTYPE, in0, in1, in2, in3, in4, in5, in6, in7, \
1372 out0, out1, out2, out3, out4, out5, out6, out7) { \ 1729 out0, out1, out2, out3, out4, out5, out6, out7) { \
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 out2_m = __msa_copy_u_w((v4i32)dst1_m, 0); \ 1923 out2_m = __msa_copy_u_w((v4i32)dst1_m, 0); \
1567 out3_m = __msa_copy_u_w((v4i32)dst1_m, 1); \ 1924 out3_m = __msa_copy_u_w((v4i32)dst1_m, 1); \
1568 SW4(out0_m, out1_m, out2_m, out3_m, pdst, stride); \ 1925 SW4(out0_m, out1_m, out2_m, out3_m, pdst, stride); \
1569 } 1926 }
1570 1927
1571 /* Description : Pack even elements of input vectors & xor with 128 1928 /* Description : Pack even elements of input vectors & xor with 128
1572 Arguments : Inputs - in0, in1 1929 Arguments : Inputs - in0, in1
1573 Outputs - out_m 1930 Outputs - out_m
1574 Return Type - unsigned byte 1931 Return Type - unsigned byte
1575 Details : Signed byte even elements from 'in0' and 'in1' are packed 1932 Details : Signed byte even elements from 'in0' and 'in1' are packed
1576 together in one vector and the resulted vector is xor'ed with 1933 together in one vector and the resulting vector is xor'ed with
1577 128 to shift the range from signed to unsigned byte 1934 128 to shift the range from signed to unsigned byte
1578 */ 1935 */
1579 #define PCKEV_XORI128_UB(in0, in1) ({ \ 1936 #define PCKEV_XORI128_UB(in0, in1) ({ \
1580 v16u8 out_m; \ 1937 v16u8 out_m; \
1581 \ 1938 \
1582 out_m = (v16u8)__msa_pckev_b((v16i8)in1, (v16i8)in0); \ 1939 out_m = (v16u8)__msa_pckev_b((v16i8)in1, (v16i8)in0); \
1583 out_m = (v16u8)__msa_xori_b((v16u8)out_m, 128); \ 1940 out_m = (v16u8)__msa_xori_b((v16u8)out_m, 128); \
1584 out_m; \ 1941 out_m; \
1585 }) 1942 })
1586 1943
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 v8u16 tmp1_m; \ 1977 v8u16 tmp1_m; \
1621 \ 1978 \
1622 tmp0_m = __msa_vshf_b((v16i8)mask, (v16i8)in1, (v16i8)in0); \ 1979 tmp0_m = __msa_vshf_b((v16i8)mask, (v16i8)in1, (v16i8)in0); \
1623 tmp1_m = __msa_dotp_u_h((v16u8)tmp0_m, (v16u8)coeff); \ 1980 tmp1_m = __msa_dotp_u_h((v16u8)tmp0_m, (v16u8)coeff); \
1624 tmp1_m = (v8u16)__msa_srari_h((v8i16)tmp1_m, shift); \ 1981 tmp1_m = (v8u16)__msa_srari_h((v8i16)tmp1_m, shift); \
1625 tmp1_m = __msa_sat_u_h(tmp1_m, shift); \ 1982 tmp1_m = __msa_sat_u_h(tmp1_m, shift); \
1626 \ 1983 \
1627 tmp1_m; \ 1984 tmp1_m; \
1628 }) 1985 })
1629 #endif /* VP9_COMMON_MIPS_MSA_VP9_MACROS_MSA_H_ */ 1986 #endif /* VP9_COMMON_MIPS_MSA_VP9_MACROS_MSA_H_ */
OLDNEW
« no previous file with comments | « source/libvpx/vp9/common/mips/msa/vp9_intra_predict_msa.c ('k') | source/libvpx/vp9/common/mips/msa/vp9_mfqe_msa.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698