Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "arm_math.h"
00025
00049 void arm_sub_q31(
00050 q31_t * pSrcA,
00051 q31_t * pSrcB,
00052 q31_t * pDst,
00053 uint32_t blockSize)
00054 {
00055 uint32_t blkCnt;
00056 q31_t inA1, inA2, inA3, inA4;
00057 q31_t inB1, inB2, inB3, inB4;
00058 q31_t out1, out2, out3, out4;
00059 q63_t inA, inB, inC, inD;
00060
00061
00062 blkCnt = blockSize >> 3u;
00063
00064
00065
00066 while(blkCnt > 0u)
00067 {
00068
00069
00070 #ifndef ARM_MATH_BIG_ENDIAN
00071
00072 inA = _SIMD64_OFFSET(pSrcA);
00073 inA1 = (q31_t)inA;
00074 inA2 = (q31_t)(inA >> 32);
00075 inB = _SIMD64_OFFSET(pSrcB);
00076 inB1 = (q31_t)inB;
00077 inB2 = (q31_t)(inB >> 32);
00078
00079 #else
00080
00081 inA = _SIMD64_OFFSET(pSrcA);
00082 inA1 = (q31_t)(inA >> 32);
00083 inA2 = (q31_t)inA;
00084 inB = _SIMD64_OFFSET(pSrcB);
00085 inB1 = (q31_t)(inB >> 32);
00086 inB2 = (q31_t)inB;
00087
00088 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00089
00090
00091 out1 = __QSUB(inA1, inB1);
00092
00093 #ifndef ARM_MATH_BIG_ENDIAN
00094
00095 inC = _SIMD64_OFFSET(pSrcA + 2);
00096 inA3 = (q31_t)inC;
00097 inA4 = (q31_t)(inC >> 32);
00098
00099 #else
00100
00101 inC = _SIMD64_OFFSET(pSrcA + 2);
00102 inA3 = (q31_t)(inC >> 32);
00103 inA4 = (q31_t)inC;
00104
00105 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00106
00107
00108 out2 = __QSUB(inA2, inB2);
00109
00110 #ifndef ARM_MATH_BIG_ENDIAN
00111
00112 inD = _SIMD64_OFFSET(pSrcB + 2);
00113 inB3 = (q31_t)inD;
00114 inB4 = (q31_t)(inD >> 32);
00115
00116 #else
00117
00118 inD = _SIMD64_OFFSET(pSrcB + 2);
00119 inB3 = (q31_t)(inD >> 32);
00120 inB4 = (q31_t)inD;
00121
00122 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00123
00124
00125 out3 = __QSUB(inA3, inB3);
00126
00127
00128 *pDst = out1;
00129 *(pDst + 1) = out2;
00130
00131
00132 out4 = __QSUB(inA4, inB4);
00133
00134 #ifndef ARM_MATH_BIG_ENDIAN
00135
00136 inA = _SIMD64_OFFSET(pSrcA+4);
00137 inA1 = (q31_t)inA;
00138 inA2 = (q31_t)(inA >> 32);
00139
00140 #else
00141
00142 inA = _SIMD64_OFFSET(pSrcA+4);
00143 inA1 = (q31_t)(inA >> 32);
00144 inA2 = (q31_t)inA;
00145
00146 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00147
00148
00149 *(pDst + 2) = out3;
00150 *(pDst + 3) = out4;
00151
00152 #ifndef ARM_MATH_BIG_ENDIAN
00153
00154 inB = _SIMD64_OFFSET(pSrcB+4);
00155 inB1 = (q31_t)inB;
00156 inB2 = (q31_t)(inB >> 32);
00157
00158 #else
00159
00160 inB = _SIMD64_OFFSET(pSrcB+4);
00161 inB1 = (q31_t)(inB >> 32);
00162 inB2 = (q31_t)inB;
00163
00164 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00165
00166
00167 out1 = __QSUB(inA1, inB1);
00168
00169 #ifndef ARM_MATH_BIG_ENDIAN
00170
00171 inC = _SIMD64_OFFSET(pSrcA+6);
00172 inA3 = (q31_t)inC;
00173 inA4 = (q31_t)(inC >> 32);
00174
00175
00176 inD = _SIMD64_OFFSET(pSrcB+6);
00177 inB3 = (q31_t)inD;
00178 inB4 = (q31_t)(inD >> 32);
00179
00180 #else
00181
00182 inC = _SIMD64_OFFSET(pSrcA+6);
00183 inA3 = (q31_t)(inC >> 32);
00184 inA4 = (q31_t)inC;
00185
00186
00187 inD = _SIMD64_OFFSET(pSrcB+6);
00188 inB3 = (q31_t)(inD >> 32);
00189 inB4 = (q31_t)inD;
00190
00191
00192 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00193
00194
00195 out2 = __QSUB(inA2, inB2);
00196
00197
00198 *(pDst + 4) = out1;
00199
00200
00201 out3 = __QSUB(inA3, inB3);
00202
00203
00204 pSrcA += 8u;
00205
00206
00207 *(pDst + 5) = out2;
00208
00209
00210 out4 = __QSUB(inA4, inB4);
00211
00212
00213 *(pDst + 6) = out3;
00214
00215
00216 pSrcB += 8u;
00217
00218
00219 *(pDst + 7) = out4;
00220
00221
00222 pDst += 8u;
00223
00224
00225 blkCnt--;
00226 }
00227
00228
00229
00230 blkCnt = blockSize % 0x8u;
00231
00232 while(blkCnt > 0u)
00233 {
00234
00235
00236 inA1 = *pSrcA++;
00237 inB1 = *pSrcB++;
00238
00239 *pDst++ = __QSUB(inA1, inB1);
00240
00241
00242 blkCnt--;
00243 }
00244 }
00245