float_dsp_neon.S 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * ARM NEON optimised Float DSP functions
  3. * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * Libav is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "config.h"
  22. #include "asm.S"
  23. preserve8
  24. function ff_vector_fmul_neon, export=1
  25. subs r3, r3, #8
  26. vld1.32 {d0-d3}, [r1,:128]!
  27. vld1.32 {d4-d7}, [r2,:128]!
  28. vmul.f32 q8, q0, q2
  29. vmul.f32 q9, q1, q3
  30. beq 3f
  31. bics ip, r3, #15
  32. beq 2f
  33. 1: subs ip, ip, #16
  34. vld1.32 {d0-d1}, [r1,:128]!
  35. vld1.32 {d4-d5}, [r2,:128]!
  36. vmul.f32 q10, q0, q2
  37. vld1.32 {d2-d3}, [r1,:128]!
  38. vld1.32 {d6-d7}, [r2,:128]!
  39. vmul.f32 q11, q1, q3
  40. vst1.32 {d16-d19},[r0,:128]!
  41. vld1.32 {d0-d1}, [r1,:128]!
  42. vld1.32 {d4-d5}, [r2,:128]!
  43. vmul.f32 q8, q0, q2
  44. vld1.32 {d2-d3}, [r1,:128]!
  45. vld1.32 {d6-d7}, [r2,:128]!
  46. vmul.f32 q9, q1, q3
  47. vst1.32 {d20-d23},[r0,:128]!
  48. bne 1b
  49. ands r3, r3, #15
  50. beq 3f
  51. 2: vld1.32 {d0-d1}, [r1,:128]!
  52. vld1.32 {d4-d5}, [r2,:128]!
  53. vst1.32 {d16-d17},[r0,:128]!
  54. vmul.f32 q8, q0, q2
  55. vld1.32 {d2-d3}, [r1,:128]!
  56. vld1.32 {d6-d7}, [r2,:128]!
  57. vst1.32 {d18-d19},[r0,:128]!
  58. vmul.f32 q9, q1, q3
  59. 3: vst1.32 {d16-d19},[r0,:128]!
  60. bx lr
  61. endfunc
  62. function ff_vector_fmac_scalar_neon, export=1
  63. VFP len .req r2
  64. VFP acc .req r3
  65. NOVFP len .req r3
  66. NOVFP acc .req r2
  67. VFP vdup.32 q15, d0[0]
  68. NOVFP vdup.32 q15, r2
  69. bics r12, len, #15
  70. mov acc, r0
  71. beq 3f
  72. vld1.32 {q0}, [r1,:128]!
  73. vld1.32 {q8}, [acc,:128]!
  74. vld1.32 {q1}, [r1,:128]!
  75. vld1.32 {q9}, [acc,:128]!
  76. 1: vmla.f32 q8, q0, q15
  77. vld1.32 {q2}, [r1,:128]!
  78. vld1.32 {q10}, [acc,:128]!
  79. vmla.f32 q9, q1, q15
  80. vld1.32 {q3}, [r1,:128]!
  81. vld1.32 {q11}, [acc,:128]!
  82. vmla.f32 q10, q2, q15
  83. vst1.32 {q8}, [r0,:128]!
  84. vmla.f32 q11, q3, q15
  85. vst1.32 {q9}, [r0,:128]!
  86. subs r12, r12, #16
  87. beq 2f
  88. vld1.32 {q0}, [r1,:128]!
  89. vld1.32 {q8}, [acc,:128]!
  90. vst1.32 {q10}, [r0,:128]!
  91. vld1.32 {q1}, [r1,:128]!
  92. vld1.32 {q9}, [acc,:128]!
  93. vst1.32 {q11}, [r0,:128]!
  94. b 1b
  95. 2: vst1.32 {q10}, [r0,:128]!
  96. vst1.32 {q11}, [r0,:128]!
  97. ands len, len, #15
  98. it eq
  99. bxeq lr
  100. 3: vld1.32 {q0}, [r1,:128]!
  101. vld1.32 {q8}, [acc,:128]!
  102. vmla.f32 q8, q0, q15
  103. vst1.32 {q8}, [r0,:128]!
  104. subs len, len, #4
  105. bgt 3b
  106. bx lr
  107. .unreq len
  108. endfunc