arm_or_q7.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_or_q7.c
  4. * Description: Q7 bitwise inclusive OR
  5. *
  6. * $Date: 14 November 2019
  7. * $Revision: V1.6.0
  8. *
  9. * Target Processor: Cortex-M cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the License); you may
  17. * not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  24. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. */
  28. #include "arm_math.h"
  29. /**
  30. @ingroup groupMath
  31. */
  32. /**
  33. @addtogroup Or
  34. @{
  35. */
  36. /**
  37. @brief Compute the logical bitwise OR of two fixed-point vectors.
  38. @param[in] pSrcA points to input vector A
  39. @param[in] pSrcB points to input vector B
  40. @param[out] pDst points to output vector
  41. @param[in] blockSize number of samples in each vector
  42. @return none
  43. */
  44. void arm_or_q7(
  45. const q7_t * pSrcA,
  46. const q7_t * pSrcB,
  47. q7_t * pDst,
  48. uint32_t blockSize)
  49. {
  50. uint32_t blkCnt; /* Loop counter */
  51. #if defined(ARM_MATH_NEON)
  52. int8x16_t vecA, vecB;
  53. /* Compute 16 outputs at a time */
  54. blkCnt = blockSize >> 4U;
  55. while (blkCnt > 0U)
  56. {
  57. vecA = vld1q_s8(pSrcA);
  58. vecB = vld1q_s8(pSrcB);
  59. vst1q_s8(pDst, vorrq_s8(vecA, vecB) );
  60. pSrcA += 16;
  61. pSrcB += 16;
  62. pDst += 16;
  63. /* Decrement the loop counter */
  64. blkCnt--;
  65. }
  66. /* Tail */
  67. blkCnt = blockSize & 0xF;
  68. #else
  69. /* Initialize blkCnt with number of samples */
  70. blkCnt = blockSize;
  71. #endif
  72. while (blkCnt > 0U)
  73. {
  74. *pDst++ = (*pSrcA++)|(*pSrcB++);
  75. /* Decrement the loop counter */
  76. blkCnt--;
  77. }
  78. }
  79. /**
  80. @} end of Or group
  81. */