copymem_mmi.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (c) 2017 The WebM project authors. All Rights Reserved.
  3. *
  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
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include "./vp8_rtcd.h"
  11. #include "vpx_ports/asmdefs_mmi.h"
  12. #define COPY_MEM_16X2 \
  13. "gsldlc1 %[ftmp0], 0x07(%[src]) \n\t" \
  14. "gsldrc1 %[ftmp0], 0x00(%[src]) \n\t" \
  15. "ldl %[tmp0], 0x0f(%[src]) \n\t" \
  16. "ldr %[tmp0], 0x08(%[src]) \n\t" \
  17. MMI_ADDU(%[src], %[src], %[src_stride]) \
  18. "gssdlc1 %[ftmp0], 0x07(%[dst]) \n\t" \
  19. "gssdrc1 %[ftmp0], 0x00(%[dst]) \n\t" \
  20. "sdl %[tmp0], 0x0f(%[dst]) \n\t" \
  21. "sdr %[tmp0], 0x08(%[dst]) \n\t" \
  22. MMI_ADDU(%[dst], %[dst], %[dst_stride]) \
  23. "gsldlc1 %[ftmp1], 0x07(%[src]) \n\t" \
  24. "gsldrc1 %[ftmp1], 0x00(%[src]) \n\t" \
  25. "ldl %[tmp1], 0x0f(%[src]) \n\t" \
  26. "ldr %[tmp1], 0x08(%[src]) \n\t" \
  27. MMI_ADDU(%[src], %[src], %[src_stride]) \
  28. "gssdlc1 %[ftmp1], 0x07(%[dst]) \n\t" \
  29. "gssdrc1 %[ftmp1], 0x00(%[dst]) \n\t" \
  30. "sdl %[tmp1], 0x0f(%[dst]) \n\t" \
  31. "sdr %[tmp1], 0x08(%[dst]) \n\t" \
  32. MMI_ADDU(%[dst], %[dst], %[dst_stride])
  33. #define COPY_MEM_8X2 \
  34. "gsldlc1 %[ftmp0], 0x07(%[src]) \n\t" \
  35. "gsldrc1 %[ftmp0], 0x00(%[src]) \n\t" \
  36. MMI_ADDU(%[src], %[src], %[src_stride]) \
  37. "ldl %[tmp0], 0x07(%[src]) \n\t" \
  38. "ldr %[tmp0], 0x00(%[src]) \n\t" \
  39. MMI_ADDU(%[src], %[src], %[src_stride]) \
  40. \
  41. "gssdlc1 %[ftmp0], 0x07(%[dst]) \n\t" \
  42. "gssdrc1 %[ftmp0], 0x00(%[dst]) \n\t" \
  43. MMI_ADDU(%[dst], %[dst], %[dst_stride]) \
  44. "sdl %[tmp0], 0x07(%[dst]) \n\t" \
  45. "sdr %[tmp0], 0x00(%[dst]) \n\t" \
  46. MMI_ADDU(%[dst], %[dst], %[dst_stride])
  47. void vp8_copy_mem16x16_mmi(unsigned char *src, int src_stride,
  48. unsigned char *dst, int dst_stride) {
  49. double ftmp[2];
  50. uint64_t tmp[2];
  51. uint8_t loop_count = 4;
  52. /* clang-format off */
  53. __asm__ volatile (
  54. "1: \n\t"
  55. COPY_MEM_16X2
  56. COPY_MEM_16X2
  57. MMI_ADDIU(%[loop_count], %[loop_count], -0x01)
  58. "bnez %[loop_count], 1b \n\t"
  59. : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
  60. [tmp0]"=&r"(tmp[0]), [tmp1]"=&r"(tmp[1]),
  61. [loop_count]"+&r"(loop_count),
  62. [dst]"+&r"(dst), [src]"+&r"(src)
  63. : [src_stride]"r"((mips_reg)src_stride),
  64. [dst_stride]"r"((mips_reg)dst_stride)
  65. : "memory"
  66. );
  67. /* clang-format on */
  68. }
  69. void vp8_copy_mem8x8_mmi(unsigned char *src, int src_stride, unsigned char *dst,
  70. int dst_stride) {
  71. double ftmp[2];
  72. uint64_t tmp[1];
  73. uint8_t loop_count = 4;
  74. /* clang-format off */
  75. __asm__ volatile (
  76. "1: \n\t"
  77. COPY_MEM_8X2
  78. MMI_ADDIU(%[loop_count], %[loop_count], -0x01)
  79. "bnez %[loop_count], 1b \n\t"
  80. : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
  81. [tmp0]"=&r"(tmp[0]), [loop_count]"+&r"(loop_count),
  82. [dst]"+&r"(dst), [src]"+&r"(src)
  83. : [src_stride]"r"((mips_reg)src_stride),
  84. [dst_stride]"r"((mips_reg)dst_stride)
  85. : "memory"
  86. );
  87. /* clang-format on */
  88. }
  89. void vp8_copy_mem8x4_mmi(unsigned char *src, int src_stride, unsigned char *dst,
  90. int dst_stride) {
  91. double ftmp[2];
  92. uint64_t tmp[1];
  93. /* clang-format off */
  94. __asm__ volatile (
  95. COPY_MEM_8X2
  96. COPY_MEM_8X2
  97. : [ftmp0]"=&f"(ftmp[0]), [ftmp1]"=&f"(ftmp[1]),
  98. [tmp0]"=&r"(tmp[0]),
  99. [dst]"+&r"(dst), [src]"+&r"(src)
  100. : [src_stride]"r"((mips_reg)src_stride),
  101. [dst_stride]"r"((mips_reg)dst_stride)
  102. : "memory"
  103. );
  104. /* clang-format on */
  105. }