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.

107 lines
4.1KB

  1. /*
  2. * Copyright (c) 2008 Siarhei Siamashka <ssvb@users.sourceforge.net>
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav 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. * Libav 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 Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "config.h"
  21. #include "libavutil/arm/asm.S"
  22. /*
  23. * VFP is a floating point coprocessor used in some ARM cores. VFP11 has 1 cycle
  24. * throughput for almost all the instructions (except for double precision
  25. * arithmetics), but rather high latency. Latency is 4 cycles for loads and 8 cycles
  26. * for arithmetic operations. Scheduling code to avoid pipeline stalls is very
  27. * important for performance. One more interesting feature is that VFP has
  28. * independent load/store and arithmetics pipelines, so it is possible to make
  29. * them work simultaneously and get more than 1 operation per cycle. Load/store
  30. * pipeline can process 2 single precision floating point values per cycle and
  31. * supports bulk loads and stores for large sets of registers. Arithmetic operations
  32. * can be done on vectors, which allows to keep the arithmetics pipeline busy,
  33. * while the processor may issue and execute other instructions. Detailed
  34. * optimization manuals can be found at http://www.arm.com
  35. */
  36. /**
  37. * ARM VFP optimized implementation of 'vector_fmul_reverse_c' function.
  38. * Assume that len is a positive number and is multiple of 8
  39. */
  40. @ void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
  41. @ const float *src1, int len)
  42. function ff_vector_fmul_reverse_vfp, export=1
  43. vpush {d8-d15}
  44. add r2, r2, r3, lsl #2
  45. vldmdb r2!, {s0-s3}
  46. vldmia r1!, {s8-s11}
  47. vldmdb r2!, {s4-s7}
  48. vldmia r1!, {s12-s15}
  49. vmul.f32 s8, s3, s8
  50. vmul.f32 s9, s2, s9
  51. vmul.f32 s10, s1, s10
  52. vmul.f32 s11, s0, s11
  53. 1:
  54. subs r3, r3, #16
  55. it ge
  56. vldmdbge r2!, {s16-s19}
  57. vmul.f32 s12, s7, s12
  58. it ge
  59. vldmiage r1!, {s24-s27}
  60. vmul.f32 s13, s6, s13
  61. it ge
  62. vldmdbge r2!, {s20-s23}
  63. vmul.f32 s14, s5, s14
  64. it ge
  65. vldmiage r1!, {s28-s31}
  66. vmul.f32 s15, s4, s15
  67. it ge
  68. vmulge.f32 s24, s19, s24
  69. it gt
  70. vldmdbgt r2!, {s0-s3}
  71. it ge
  72. vmulge.f32 s25, s18, s25
  73. vstmia r0!, {s8-s13}
  74. it ge
  75. vmulge.f32 s26, s17, s26
  76. it gt
  77. vldmiagt r1!, {s8-s11}
  78. itt ge
  79. vmulge.f32 s27, s16, s27
  80. vmulge.f32 s28, s23, s28
  81. it gt
  82. vldmdbgt r2!, {s4-s7}
  83. it ge
  84. vmulge.f32 s29, s22, s29
  85. vstmia r0!, {s14-s15}
  86. ittt ge
  87. vmulge.f32 s30, s21, s30
  88. vmulge.f32 s31, s20, s31
  89. vmulge.f32 s8, s3, s8
  90. it gt
  91. vldmiagt r1!, {s12-s15}
  92. itttt ge
  93. vmulge.f32 s9, s2, s9
  94. vmulge.f32 s10, s1, s10
  95. vstmiage r0!, {s24-s27}
  96. vmulge.f32 s11, s0, s11
  97. it ge
  98. vstmiage r0!, {s28-s31}
  99. bgt 1b
  100. vpop {d8-d15}
  101. bx lr
  102. endfunc