comparison i386/vp3dsp_sse2.c @ 7884:4077df298ba2 libavcodec

Remove duplication of TRANSPOSE8 macro, also removing some redundant load/stores
author conrad
date Thu, 18 Sep 2008 03:08:33 +0000
parents 6f77eda89813
children eebc7209c47f
comparison
equal deleted inserted replaced
7883:6f77eda89813 7884:4077df298ba2
149 "movdqa " #r4 ", " O(4) "\n\t" \ 149 "movdqa " #r4 ", " O(4) "\n\t" \
150 "movdqa " #r5 ", " O(5) "\n\t" \ 150 "movdqa " #r5 ", " O(5) "\n\t" \
151 "movdqa " #r6 ", " O(6) "\n\t" \ 151 "movdqa " #r6 ", " O(6) "\n\t" \
152 "movdqa " #r7 ", " O(7) "\n\t" 152 "movdqa " #r7 ", " O(7) "\n\t"
153 153
154 #define SSE2_Transpose() \
155 "movdqa "I(4)", %%xmm4 \n\t" /* xmm4=e7e6e5e4e3e2e1e0 */ \
156 "movdqa "I(5)", %%xmm0 \n\t" /* xmm4=f7f6f5f4f3f2f1f0 */ \
157 "movdqa %%xmm4, %%xmm5 \n\t" /* make a copy */ \
158 "punpcklwd %%xmm0, %%xmm4 \n\t" /* xmm4=f3e3f2e2f1e1f0e0 */ \
159 "punpckhwd %%xmm0, %%xmm5 \n\t" /* xmm5=f7e7f6e6f5e5f4e4 */ \
160 "movdqa "I(6)", %%xmm6 \n\t" /* xmm6=g7g6g5g4g3g2g1g0 */ \
161 "movdqa "I(7)", %%xmm0 \n\t" /* xmm0=h7h6h5h4h3h2h1h0 */ \
162 "movdqa %%xmm6, %%xmm7 \n\t" /* make a copy */ \
163 "punpcklwd %%xmm0, %%xmm6 \n\t" /* xmm6=h3g3h3g2h1g1h0g0 */ \
164 "punpckhwd %%xmm0, %%xmm7 \n\t" /* xmm7=h7g7h6g6h5g5h4g4 */ \
165 "movdqa %%xmm4, %%xmm3 \n\t" /* make a copy */ \
166 "punpckldq %%xmm6, %%xmm4 \n\t" /* xmm4=h1g1f1e1h0g0f0e0 */ \
167 "punpckhdq %%xmm6, %%xmm3 \n\t" /* xmm3=h3g3g3e3h2g2f2e2 */ \
168 "movdqa %%xmm3, "I(6)" \n\t" /* save h3g3g3e3h2g2f2e2 */ \
169 "movdqa %%xmm5, %%xmm6 \n\t" /* make a copy */ \
170 "punpckldq %%xmm7, %%xmm5 \n\t" /* xmm5=h5g5f5e5h4g4f4e4 */ \
171 "punpckhdq %%xmm7, %%xmm6 \n\t" /* xmm6=h7g7f7e7h6g6f6e6 */ \
172 "movdqa "I(0)", %%xmm0 \n\t" /* xmm0=a7a6a5a4a3a2a1a0 */ \
173 "movdqa "I(1)", %%xmm1 \n\t" /* xmm1=b7b6b5b4b3b2b1b0 */ \
174 "movdqa %%xmm0, %%xmm7 \n\t" /* make a copy */ \
175 "punpcklwd %%xmm1, %%xmm0 \n\t" /* xmm0=b3a3b2a2b1a1b0a0 */ \
176 "punpckhwd %%xmm1, %%xmm7 \n\t" /* xmm7=b7a7b6a6b5a5b4a4 */ \
177 "movdqa "I(2)", %%xmm2 \n\t" /* xmm2=c7c6c5c4c3c2c1c0 */ \
178 "movdqa "I(3)", %%xmm3 \n\t" /* xmm3=d7d6d5d4d3d2d1d0 */ \
179 "movdqa %%xmm2, %%xmm1 \n\t" /* make a copy */ \
180 "punpcklwd %%xmm3, %%xmm2 \n\t" /* xmm2=d3c3d2c2d1c1d0c0 */ \
181 "punpckhwd %%xmm3, %%xmm1 \n\t" /* xmm1=d7c7d6c6d5c5d4c4 */ \
182 "movdqa %%xmm0, %%xmm3 \n\t" /* make a copy */ \
183 "punpckldq %%xmm2, %%xmm0 \n\t" /* xmm0=d1c1b1a1d0c0b0a0 */ \
184 "punpckhdq %%xmm2, %%xmm3 \n\t" /* xmm3=d3c3b3a3d2c2b2a2 */ \
185 "movdqa %%xmm7, %%xmm2 \n\t" /* make a copy */ \
186 "punpckldq %%xmm1, %%xmm2 \n\t" /* xmm2=d5c5b5a5d4c4b4a4 */ \
187 "punpckhdq %%xmm1, %%xmm7 \n\t" /* xmm7=d7c7b7a7d6c6b6a6 */ \
188 "movdqa %%xmm0, %%xmm1 \n\t" /* make a copy */ \
189 "punpcklqdq %%xmm4, %%xmm0 \n\t" /* xmm0=h0g0f0e0d0c0b0a0 */ \
190 "punpckhqdq %%xmm4, %%xmm1 \n\t" /* xmm1=h1g1g1e1d1c1b1a1 */ \
191 "movdqa %%xmm0, "I(0)" \n\t" /* save I(0) */ \
192 "movdqa %%xmm1, "I(1)" \n\t" /* save I(1) */ \
193 "movdqa "I(6)", %%xmm0 \n\t" /* load h3g3g3e3h2g2f2e2 */ \
194 "movdqa %%xmm3, %%xmm1 \n\t" /* make a copy */ \
195 "punpcklqdq %%xmm0, %%xmm1 \n\t" /* xmm1=h2g2f2e2d2c2b2a2 */ \
196 "punpckhqdq %%xmm0, %%xmm3 \n\t" /* xmm3=h3g3f3e3d3c3b3a3 */ \
197 "movdqa %%xmm2, %%xmm4 \n\t" /* make a copy */ \
198 "punpcklqdq %%xmm5, %%xmm4 \n\t" /* xmm4=h4g4f4e4d4c4b4a4 */ \
199 "punpckhqdq %%xmm5, %%xmm2 \n\t" /* xmm2=h5g5f5e5d5c5b5a5 */ \
200 "movdqa %%xmm1, "I(2)" \n\t" /* save I(2) */ \
201 "movdqa %%xmm3, "I(3)" \n\t" /* save I(3) */ \
202 "movdqa %%xmm4, "I(4)" \n\t" /* save I(4) */ \
203 "movdqa %%xmm2, "I(5)" \n\t" /* save I(5) */ \
204 "movdqa %%xmm7, %%xmm5 \n\t" /* make a copy */ \
205 "punpcklqdq %%xmm6, %%xmm5 \n\t" /* xmm5=h6g6f6e6d6c6b6a6 */ \
206 "punpckhqdq %%xmm6, %%xmm7 \n\t" /* xmm7=h7g7f7e7d7c7b7a7 */ \
207 "movdqa %%xmm5, "I(6)" \n\t" /* save I(6) */ \
208 "movdqa %%xmm7, "I(7)" \n\t" /* save I(7) */
209
210 #define NOP(xmm) 154 #define NOP(xmm)
211 #define SHIFT4(xmm) "psraw $4, "#xmm"\n\t" 155 #define SHIFT4(xmm) "psraw $4, "#xmm"\n\t"
212 #define ADD8(xmm) "paddsw %2, "#xmm"\n\t" 156 #define ADD8(xmm) "paddsw %2, "#xmm"\n\t"
213 157
214 void ff_vp3_idct_sse2(int16_t *input_data) 158 void ff_vp3_idct_sse2(int16_t *input_data)
217 #define O(x) I(x) 161 #define O(x) I(x)
218 #define C(x) AV_STRINGIFY(16*(x-1))"(%1)" 162 #define C(x) AV_STRINGIFY(16*(x-1))"(%1)"
219 163
220 asm volatile ( 164 asm volatile (
221 VP3_1D_IDCT_SSE2(NOP, NOP) 165 VP3_1D_IDCT_SSE2(NOP, NOP)
222 PUT_BLOCK(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)
223 166
224 SSE2_Transpose() 167 TRANSPOSE8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7, (%0))
168 PUT_BLOCK(%%xmm0, %%xmm5, %%xmm7, %%xmm3, %%xmm6, %%xmm4, %%xmm2, %%xmm1)
225 169
226 VP3_1D_IDCT_SSE2(ADD8, SHIFT4) 170 VP3_1D_IDCT_SSE2(ADD8, SHIFT4)
227 PUT_BLOCK(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7) 171 PUT_BLOCK(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)
228 :: "r"(input_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8) 172 :: "r"(input_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8)
229 ); 173 );