Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | #if !defined(_x86_mmxloop_H) |
michael@0 | 2 | # define _x86_mmxloop_H (1) |
michael@0 | 3 | # include <stddef.h> |
michael@0 | 4 | # include "x86int.h" |
michael@0 | 5 | |
michael@0 | 6 | #if defined(OC_X86_ASM) |
michael@0 | 7 | |
michael@0 | 8 | /*On entry, mm0={a0,...,a7}, mm1={b0,...,b7}, mm2={c0,...,c7}, mm3={d0,...d7}. |
michael@0 | 9 | On exit, mm1={b0+lflim(R_0,L),...,b7+lflim(R_7,L)} and |
michael@0 | 10 | mm2={c0-lflim(R_0,L),...,c7-lflim(R_7,L)}; mm0 and mm3 are clobbered.*/ |
michael@0 | 11 | #define OC_LOOP_FILTER8_MMX \ |
michael@0 | 12 | "#OC_LOOP_FILTER8_MMX\n\t" \ |
michael@0 | 13 | /*mm7=0*/ \ |
michael@0 | 14 | "pxor %%mm7,%%mm7\n\t" \ |
michael@0 | 15 | /*mm6:mm0={a0,...,a7}*/ \ |
michael@0 | 16 | "movq %%mm0,%%mm6\n\t" \ |
michael@0 | 17 | "punpcklbw %%mm7,%%mm0\n\t" \ |
michael@0 | 18 | "punpckhbw %%mm7,%%mm6\n\t" \ |
michael@0 | 19 | /*mm3:mm5={d0,...,d7}*/ \ |
michael@0 | 20 | "movq %%mm3,%%mm5\n\t" \ |
michael@0 | 21 | "punpcklbw %%mm7,%%mm3\n\t" \ |
michael@0 | 22 | "punpckhbw %%mm7,%%mm5\n\t" \ |
michael@0 | 23 | /*mm6:mm0={a0-d0,...,a7-d7}*/ \ |
michael@0 | 24 | "psubw %%mm3,%%mm0\n\t" \ |
michael@0 | 25 | "psubw %%mm5,%%mm6\n\t" \ |
michael@0 | 26 | /*mm3:mm1={b0,...,b7}*/ \ |
michael@0 | 27 | "movq %%mm1,%%mm3\n\t" \ |
michael@0 | 28 | "punpcklbw %%mm7,%%mm1\n\t" \ |
michael@0 | 29 | "movq %%mm2,%%mm4\n\t" \ |
michael@0 | 30 | "punpckhbw %%mm7,%%mm3\n\t" \ |
michael@0 | 31 | /*mm5:mm4={c0,...,c7}*/ \ |
michael@0 | 32 | "movq %%mm2,%%mm5\n\t" \ |
michael@0 | 33 | "punpcklbw %%mm7,%%mm4\n\t" \ |
michael@0 | 34 | "punpckhbw %%mm7,%%mm5\n\t" \ |
michael@0 | 35 | /*mm7={3}x4 \ |
michael@0 | 36 | mm5:mm4={c0-b0,...,c7-b7}*/ \ |
michael@0 | 37 | "pcmpeqw %%mm7,%%mm7\n\t" \ |
michael@0 | 38 | "psubw %%mm1,%%mm4\n\t" \ |
michael@0 | 39 | "psrlw $14,%%mm7\n\t" \ |
michael@0 | 40 | "psubw %%mm3,%%mm5\n\t" \ |
michael@0 | 41 | /*Scale by 3.*/ \ |
michael@0 | 42 | "pmullw %%mm7,%%mm4\n\t" \ |
michael@0 | 43 | "pmullw %%mm7,%%mm5\n\t" \ |
michael@0 | 44 | /*mm7={4}x4 \ |
michael@0 | 45 | mm5:mm4=f={a0-d0+3*(c0-b0),...,a7-d7+3*(c7-b7)}*/ \ |
michael@0 | 46 | "psrlw $1,%%mm7\n\t" \ |
michael@0 | 47 | "paddw %%mm0,%%mm4\n\t" \ |
michael@0 | 48 | "psllw $2,%%mm7\n\t" \ |
michael@0 | 49 | "movq (%[ll]),%%mm0\n\t" \ |
michael@0 | 50 | "paddw %%mm6,%%mm5\n\t" \ |
michael@0 | 51 | /*R_i has the range [-127,128], so we compute -R_i instead. \ |
michael@0 | 52 | mm4=-R_i=-(f+4>>3)=0xFF^(f-4>>3)*/ \ |
michael@0 | 53 | "psubw %%mm7,%%mm4\n\t" \ |
michael@0 | 54 | "psubw %%mm7,%%mm5\n\t" \ |
michael@0 | 55 | "psraw $3,%%mm4\n\t" \ |
michael@0 | 56 | "psraw $3,%%mm5\n\t" \ |
michael@0 | 57 | "pcmpeqb %%mm7,%%mm7\n\t" \ |
michael@0 | 58 | "packsswb %%mm5,%%mm4\n\t" \ |
michael@0 | 59 | "pxor %%mm6,%%mm6\n\t" \ |
michael@0 | 60 | "pxor %%mm7,%%mm4\n\t" \ |
michael@0 | 61 | "packuswb %%mm3,%%mm1\n\t" \ |
michael@0 | 62 | /*Now compute lflim of -mm4 cf. Section 7.10 of the sepc.*/ \ |
michael@0 | 63 | /*There's no unsigned byte+signed byte with unsigned saturation op code, so \ |
michael@0 | 64 | we have to split things by sign (the other option is to work in 16 bits, \ |
michael@0 | 65 | but working in 8 bits gives much better parallelism). \ |
michael@0 | 66 | We compute abs(R_i), but save a mask of which terms were negative in mm6. \ |
michael@0 | 67 | Then we compute mm4=abs(lflim(R_i,L))=min(abs(R_i),max(2*L-abs(R_i),0)). \ |
michael@0 | 68 | Finally, we split mm4 into positive and negative pieces using the mask in \ |
michael@0 | 69 | mm6, and add and subtract them as appropriate.*/ \ |
michael@0 | 70 | /*mm4=abs(-R_i)*/ \ |
michael@0 | 71 | /*mm7=255-2*L*/ \ |
michael@0 | 72 | "pcmpgtb %%mm4,%%mm6\n\t" \ |
michael@0 | 73 | "psubb %%mm0,%%mm7\n\t" \ |
michael@0 | 74 | "pxor %%mm6,%%mm4\n\t" \ |
michael@0 | 75 | "psubb %%mm0,%%mm7\n\t" \ |
michael@0 | 76 | "psubb %%mm6,%%mm4\n\t" \ |
michael@0 | 77 | /*mm7=255-max(2*L-abs(R_i),0)*/ \ |
michael@0 | 78 | "paddusb %%mm4,%%mm7\n\t" \ |
michael@0 | 79 | /*mm4=min(abs(R_i),max(2*L-abs(R_i),0))*/ \ |
michael@0 | 80 | "paddusb %%mm7,%%mm4\n\t" \ |
michael@0 | 81 | "psubusb %%mm7,%%mm4\n\t" \ |
michael@0 | 82 | /*Now split mm4 by the original sign of -R_i.*/ \ |
michael@0 | 83 | "movq %%mm4,%%mm5\n\t" \ |
michael@0 | 84 | "pand %%mm6,%%mm4\n\t" \ |
michael@0 | 85 | "pandn %%mm5,%%mm6\n\t" \ |
michael@0 | 86 | /*mm1={b0+lflim(R_0,L),...,b7+lflim(R_7,L)}*/ \ |
michael@0 | 87 | /*mm2={c0-lflim(R_0,L),...,c7-lflim(R_7,L)}*/ \ |
michael@0 | 88 | "paddusb %%mm4,%%mm1\n\t" \ |
michael@0 | 89 | "psubusb %%mm4,%%mm2\n\t" \ |
michael@0 | 90 | "psubusb %%mm6,%%mm1\n\t" \ |
michael@0 | 91 | "paddusb %%mm6,%%mm2\n\t" \ |
michael@0 | 92 | |
michael@0 | 93 | /*On entry, mm0={a0,...,a7}, mm1={b0,...,b7}, mm2={c0,...,c7}, mm3={d0,...d7}. |
michael@0 | 94 | On exit, mm1={b0+lflim(R_0,L),...,b7+lflim(R_7,L)} and |
michael@0 | 95 | mm2={c0-lflim(R_0,L),...,c7-lflim(R_7,L)}. |
michael@0 | 96 | All other MMX registers are clobbered.*/ |
michael@0 | 97 | #define OC_LOOP_FILTER8_MMXEXT \ |
michael@0 | 98 | "#OC_LOOP_FILTER8_MMXEXT\n\t" \ |
michael@0 | 99 | /*R_i=(a_i-3*b_i+3*c_i-d_i+4>>3) has the range [-127,128], so we compute \ |
michael@0 | 100 | -R_i=(-a_i+3*b_i-3*c_i+d_i+3>>3) instead.*/ \ |
michael@0 | 101 | /*This first part is based on the transformation \ |
michael@0 | 102 | f = -(3*(c-b)+a-d+4>>3) \ |
michael@0 | 103 | = -(3*(c+255-b)+(a+255-d)+4-1020>>3) \ |
michael@0 | 104 | = -(3*(c+~b)+(a+~d)-1016>>3) \ |
michael@0 | 105 | = 127-(3*(c+~b)+(a+~d)>>3) \ |
michael@0 | 106 | = 128+~(3*(c+~b)+(a+~d)>>3) (mod 256). \ |
michael@0 | 107 | Although pavgb(a,b) = (a+b+1>>1) (biased up), we rely heavily on the \ |
michael@0 | 108 | fact that ~pavgb(~a,~b) = (a+b>>1) (biased down). \ |
michael@0 | 109 | Using this, the last expression above can be computed in 8 bits of working \ |
michael@0 | 110 | precision via: \ |
michael@0 | 111 | u = ~pavgb(~b,c); \ |
michael@0 | 112 | v = pavgb(b,~c); \ |
michael@0 | 113 | This mask is 0 or 0xFF, and controls whether t is biased up or down: \ |
michael@0 | 114 | m = u-v; \ |
michael@0 | 115 | t = m^pavgb(m^~a,m^d); \ |
michael@0 | 116 | f = 128+pavgb(pavgb(t,u),v); \ |
michael@0 | 117 | This required some careful analysis to ensure that carries are propagated \ |
michael@0 | 118 | correctly in all cases, but has been checked exhaustively.*/ \ |
michael@0 | 119 | /*input (a, b, c, d, ., ., ., .)*/ \ |
michael@0 | 120 | /*ff=0xFF; \ |
michael@0 | 121 | u=b; \ |
michael@0 | 122 | v=c; \ |
michael@0 | 123 | ll=255-2*L;*/ \ |
michael@0 | 124 | "pcmpeqb %%mm7,%%mm7\n\t" \ |
michael@0 | 125 | "movq %%mm1,%%mm4\n\t" \ |
michael@0 | 126 | "movq %%mm2,%%mm5\n\t" \ |
michael@0 | 127 | "movq (%[ll]),%%mm6\n\t" \ |
michael@0 | 128 | /*allocated u, v, ll, ff: (a, b, c, d, u, v, ll, ff)*/ \ |
michael@0 | 129 | /*u^=ff; \ |
michael@0 | 130 | v^=ff;*/ \ |
michael@0 | 131 | "pxor %%mm7,%%mm4\n\t" \ |
michael@0 | 132 | "pxor %%mm7,%%mm5\n\t" \ |
michael@0 | 133 | /*allocated ll: (a, b, c, d, u, v, ll, ff)*/ \ |
michael@0 | 134 | /*u=pavgb(u,c); \ |
michael@0 | 135 | v=pavgb(v,b);*/ \ |
michael@0 | 136 | "pavgb %%mm2,%%mm4\n\t" \ |
michael@0 | 137 | "pavgb %%mm1,%%mm5\n\t" \ |
michael@0 | 138 | /*u^=ff; \ |
michael@0 | 139 | a^=ff;*/ \ |
michael@0 | 140 | "pxor %%mm7,%%mm4\n\t" \ |
michael@0 | 141 | "pxor %%mm7,%%mm0\n\t" \ |
michael@0 | 142 | /*m=u-v;*/ \ |
michael@0 | 143 | "psubb %%mm5,%%mm4\n\t" \ |
michael@0 | 144 | /*freed u, allocated m: (a, b, c, d, m, v, ll, ff)*/ \ |
michael@0 | 145 | /*a^=m; \ |
michael@0 | 146 | d^=m;*/ \ |
michael@0 | 147 | "pxor %%mm4,%%mm0\n\t" \ |
michael@0 | 148 | "pxor %%mm4,%%mm3\n\t" \ |
michael@0 | 149 | /*t=pavgb(a,d);*/ \ |
michael@0 | 150 | "pavgb %%mm3,%%mm0\n\t" \ |
michael@0 | 151 | "psllw $7,%%mm7\n\t" \ |
michael@0 | 152 | /*freed a, d, ff, allocated t, of: (t, b, c, ., m, v, ll, of)*/ \ |
michael@0 | 153 | /*t^=m; \ |
michael@0 | 154 | u=m+v;*/ \ |
michael@0 | 155 | "pxor %%mm4,%%mm0\n\t" \ |
michael@0 | 156 | "paddb %%mm5,%%mm4\n\t" \ |
michael@0 | 157 | /*freed t, m, allocated f, u: (f, b, c, ., u, v, ll, of)*/ \ |
michael@0 | 158 | /*f=pavgb(f,u); \ |
michael@0 | 159 | of=128;*/ \ |
michael@0 | 160 | "pavgb %%mm4,%%mm0\n\t" \ |
michael@0 | 161 | "packsswb %%mm7,%%mm7\n\t" \ |
michael@0 | 162 | /*freed u, ff, allocated ll: (f, b, c, ., ll, v, ll, of)*/ \ |
michael@0 | 163 | /*f=pavgb(f,v);*/ \ |
michael@0 | 164 | "pavgb %%mm5,%%mm0\n\t" \ |
michael@0 | 165 | "movq %%mm7,%%mm3\n\t" \ |
michael@0 | 166 | "movq %%mm6,%%mm4\n\t" \ |
michael@0 | 167 | /*freed v, allocated of: (f, b, c, of, ll, ., ll, of)*/ \ |
michael@0 | 168 | /*Now compute lflim of R_i=-(128+mm0) cf. Section 7.10 of the sepc.*/ \ |
michael@0 | 169 | /*There's no unsigned byte+signed byte with unsigned saturation op code, so \ |
michael@0 | 170 | we have to split things by sign (the other option is to work in 16 bits, \ |
michael@0 | 171 | but staying in 8 bits gives much better parallelism).*/ \ |
michael@0 | 172 | /*Instead of adding the offset of 128 in mm3, we use it to split mm0. \ |
michael@0 | 173 | This is the same number of instructions as computing a mask and splitting \ |
michael@0 | 174 | after the lflim computation, but has shorter dependency chains.*/ \ |
michael@0 | 175 | /*mm0=R_i<0?-R_i:0 (denoted abs(R_i<0))\ |
michael@0 | 176 | mm3=R_i>0?R_i:0* (denoted abs(R_i>0))*/ \ |
michael@0 | 177 | "psubusb %%mm0,%%mm3\n\t" \ |
michael@0 | 178 | "psubusb %%mm7,%%mm0\n\t" \ |
michael@0 | 179 | /*mm6=255-max(2*L-abs(R_i<0),0) \ |
michael@0 | 180 | mm4=255-max(2*L-abs(R_i>0),0)*/ \ |
michael@0 | 181 | "paddusb %%mm3,%%mm4\n\t" \ |
michael@0 | 182 | "paddusb %%mm0,%%mm6\n\t" \ |
michael@0 | 183 | /*mm0=min(abs(R_i<0),max(2*L-abs(R_i<0),0)) \ |
michael@0 | 184 | mm3=min(abs(R_i>0),max(2*L-abs(R_i>0),0))*/ \ |
michael@0 | 185 | "paddusb %%mm4,%%mm3\n\t" \ |
michael@0 | 186 | "paddusb %%mm6,%%mm0\n\t" \ |
michael@0 | 187 | "psubusb %%mm4,%%mm3\n\t" \ |
michael@0 | 188 | "psubusb %%mm6,%%mm0\n\t" \ |
michael@0 | 189 | /*mm1={b0+lflim(R_0,L),...,b7+lflim(R_7,L)}*/ \ |
michael@0 | 190 | /*mm2={c0-lflim(R_0,L),...,c7-lflim(R_7,L)}*/ \ |
michael@0 | 191 | "paddusb %%mm3,%%mm1\n\t" \ |
michael@0 | 192 | "psubusb %%mm3,%%mm2\n\t" \ |
michael@0 | 193 | "psubusb %%mm0,%%mm1\n\t" \ |
michael@0 | 194 | "paddusb %%mm0,%%mm2\n\t" \ |
michael@0 | 195 | |
michael@0 | 196 | #define OC_LOOP_FILTER_V(_filter,_pix,_ystride,_ll) \ |
michael@0 | 197 | do{ \ |
michael@0 | 198 | ptrdiff_t ystride3__; \ |
michael@0 | 199 | __asm__ __volatile__( \ |
michael@0 | 200 | /*mm0={a0,...,a7}*/ \ |
michael@0 | 201 | "movq (%[pix]),%%mm0\n\t" \ |
michael@0 | 202 | /*ystride3=_ystride*3*/ \ |
michael@0 | 203 | "lea (%[ystride],%[ystride],2),%[ystride3]\n\t" \ |
michael@0 | 204 | /*mm3={d0,...,d7}*/ \ |
michael@0 | 205 | "movq (%[pix],%[ystride3]),%%mm3\n\t" \ |
michael@0 | 206 | /*mm1={b0,...,b7}*/ \ |
michael@0 | 207 | "movq (%[pix],%[ystride]),%%mm1\n\t" \ |
michael@0 | 208 | /*mm2={c0,...,c7}*/ \ |
michael@0 | 209 | "movq (%[pix],%[ystride],2),%%mm2\n\t" \ |
michael@0 | 210 | _filter \ |
michael@0 | 211 | /*Write it back out.*/ \ |
michael@0 | 212 | "movq %%mm1,(%[pix],%[ystride])\n\t" \ |
michael@0 | 213 | "movq %%mm2,(%[pix],%[ystride],2)\n\t" \ |
michael@0 | 214 | :[ystride3]"=&r"(ystride3__) \ |
michael@0 | 215 | :[pix]"r"(_pix-_ystride*2),[ystride]"r"((ptrdiff_t)(_ystride)), \ |
michael@0 | 216 | [ll]"r"(_ll) \ |
michael@0 | 217 | :"memory" \ |
michael@0 | 218 | ); \ |
michael@0 | 219 | } \ |
michael@0 | 220 | while(0) |
michael@0 | 221 | |
michael@0 | 222 | #define OC_LOOP_FILTER_H(_filter,_pix,_ystride,_ll) \ |
michael@0 | 223 | do{ \ |
michael@0 | 224 | unsigned char *pix__; \ |
michael@0 | 225 | ptrdiff_t ystride3__; \ |
michael@0 | 226 | ptrdiff_t d__; \ |
michael@0 | 227 | pix__=(_pix)-2; \ |
michael@0 | 228 | __asm__ __volatile__( \ |
michael@0 | 229 | /*x x x x d0 c0 b0 a0*/ \ |
michael@0 | 230 | "movd (%[pix]),%%mm0\n\t" \ |
michael@0 | 231 | /*x x x x d1 c1 b1 a1*/ \ |
michael@0 | 232 | "movd (%[pix],%[ystride]),%%mm1\n\t" \ |
michael@0 | 233 | /*ystride3=_ystride*3*/ \ |
michael@0 | 234 | "lea (%[ystride],%[ystride],2),%[ystride3]\n\t" \ |
michael@0 | 235 | /*x x x x d2 c2 b2 a2*/ \ |
michael@0 | 236 | "movd (%[pix],%[ystride],2),%%mm2\n\t" \ |
michael@0 | 237 | /*x x x x d3 c3 b3 a3*/ \ |
michael@0 | 238 | "lea (%[pix],%[ystride],4),%[d]\n\t" \ |
michael@0 | 239 | "movd (%[pix],%[ystride3]),%%mm3\n\t" \ |
michael@0 | 240 | /*x x x x d4 c4 b4 a4*/ \ |
michael@0 | 241 | "movd (%[d]),%%mm4\n\t" \ |
michael@0 | 242 | /*x x x x d5 c5 b5 a5*/ \ |
michael@0 | 243 | "movd (%[d],%[ystride]),%%mm5\n\t" \ |
michael@0 | 244 | /*x x x x d6 c6 b6 a6*/ \ |
michael@0 | 245 | "movd (%[d],%[ystride],2),%%mm6\n\t" \ |
michael@0 | 246 | /*x x x x d7 c7 b7 a7*/ \ |
michael@0 | 247 | "movd (%[d],%[ystride3]),%%mm7\n\t" \ |
michael@0 | 248 | /*mm0=d1 d0 c1 c0 b1 b0 a1 a0*/ \ |
michael@0 | 249 | "punpcklbw %%mm1,%%mm0\n\t" \ |
michael@0 | 250 | /*mm2=d3 d2 c3 c2 b3 b2 a3 a2*/ \ |
michael@0 | 251 | "punpcklbw %%mm3,%%mm2\n\t" \ |
michael@0 | 252 | /*mm3=d1 d0 c1 c0 b1 b0 a1 a0*/ \ |
michael@0 | 253 | "movq %%mm0,%%mm3\n\t" \ |
michael@0 | 254 | /*mm0=b3 b2 b1 b0 a3 a2 a1 a0*/ \ |
michael@0 | 255 | "punpcklwd %%mm2,%%mm0\n\t" \ |
michael@0 | 256 | /*mm3=d3 d2 d1 d0 c3 c2 c1 c0*/ \ |
michael@0 | 257 | "punpckhwd %%mm2,%%mm3\n\t" \ |
michael@0 | 258 | /*mm1=b3 b2 b1 b0 a3 a2 a1 a0*/ \ |
michael@0 | 259 | "movq %%mm0,%%mm1\n\t" \ |
michael@0 | 260 | /*mm4=d5 d4 c5 c4 b5 b4 a5 a4*/ \ |
michael@0 | 261 | "punpcklbw %%mm5,%%mm4\n\t" \ |
michael@0 | 262 | /*mm6=d7 d6 c7 c6 b7 b6 a7 a6*/ \ |
michael@0 | 263 | "punpcklbw %%mm7,%%mm6\n\t" \ |
michael@0 | 264 | /*mm5=d5 d4 c5 c4 b5 b4 a5 a4*/ \ |
michael@0 | 265 | "movq %%mm4,%%mm5\n\t" \ |
michael@0 | 266 | /*mm4=b7 b6 b5 b4 a7 a6 a5 a4*/ \ |
michael@0 | 267 | "punpcklwd %%mm6,%%mm4\n\t" \ |
michael@0 | 268 | /*mm5=d7 d6 d5 d4 c7 c6 c5 c4*/ \ |
michael@0 | 269 | "punpckhwd %%mm6,%%mm5\n\t" \ |
michael@0 | 270 | /*mm2=d3 d2 d1 d0 c3 c2 c1 c0*/ \ |
michael@0 | 271 | "movq %%mm3,%%mm2\n\t" \ |
michael@0 | 272 | /*mm0=a7 a6 a5 a4 a3 a2 a1 a0*/ \ |
michael@0 | 273 | "punpckldq %%mm4,%%mm0\n\t" \ |
michael@0 | 274 | /*mm1=b7 b6 b5 b4 b3 b2 b1 b0*/ \ |
michael@0 | 275 | "punpckhdq %%mm4,%%mm1\n\t" \ |
michael@0 | 276 | /*mm2=c7 c6 c5 c4 c3 c2 c1 c0*/ \ |
michael@0 | 277 | "punpckldq %%mm5,%%mm2\n\t" \ |
michael@0 | 278 | /*mm3=d7 d6 d5 d4 d3 d2 d1 d0*/ \ |
michael@0 | 279 | "punpckhdq %%mm5,%%mm3\n\t" \ |
michael@0 | 280 | _filter \ |
michael@0 | 281 | /*mm2={b0+R_0'',...,b7+R_7''}*/ \ |
michael@0 | 282 | "movq %%mm1,%%mm0\n\t" \ |
michael@0 | 283 | /*mm1={b0+R_0'',c0-R_0'',...,b3+R_3'',c3-R_3''}*/ \ |
michael@0 | 284 | "punpcklbw %%mm2,%%mm1\n\t" \ |
michael@0 | 285 | /*mm2={b4+R_4'',c4-R_4'',...,b7+R_7'',c7-R_7''}*/ \ |
michael@0 | 286 | "punpckhbw %%mm2,%%mm0\n\t" \ |
michael@0 | 287 | /*[d]=c1 b1 c0 b0*/ \ |
michael@0 | 288 | "movd %%mm1,%[d]\n\t" \ |
michael@0 | 289 | "movw %w[d],1(%[pix])\n\t" \ |
michael@0 | 290 | "psrlq $32,%%mm1\n\t" \ |
michael@0 | 291 | "shr $16,%[d]\n\t" \ |
michael@0 | 292 | "movw %w[d],1(%[pix],%[ystride])\n\t" \ |
michael@0 | 293 | /*[d]=c3 b3 c2 b2*/ \ |
michael@0 | 294 | "movd %%mm1,%[d]\n\t" \ |
michael@0 | 295 | "movw %w[d],1(%[pix],%[ystride],2)\n\t" \ |
michael@0 | 296 | "shr $16,%[d]\n\t" \ |
michael@0 | 297 | "movw %w[d],1(%[pix],%[ystride3])\n\t" \ |
michael@0 | 298 | "lea (%[pix],%[ystride],4),%[pix]\n\t" \ |
michael@0 | 299 | /*[d]=c5 b5 c4 b4*/ \ |
michael@0 | 300 | "movd %%mm0,%[d]\n\t" \ |
michael@0 | 301 | "movw %w[d],1(%[pix])\n\t" \ |
michael@0 | 302 | "psrlq $32,%%mm0\n\t" \ |
michael@0 | 303 | "shr $16,%[d]\n\t" \ |
michael@0 | 304 | "movw %w[d],1(%[pix],%[ystride])\n\t" \ |
michael@0 | 305 | /*[d]=c7 b7 c6 b6*/ \ |
michael@0 | 306 | "movd %%mm0,%[d]\n\t" \ |
michael@0 | 307 | "movw %w[d],1(%[pix],%[ystride],2)\n\t" \ |
michael@0 | 308 | "shr $16,%[d]\n\t" \ |
michael@0 | 309 | "movw %w[d],1(%[pix],%[ystride3])\n\t" \ |
michael@0 | 310 | :[pix]"+r"(pix__),[ystride3]"=&r"(ystride3__),[d]"=&r"(d__) \ |
michael@0 | 311 | :[ystride]"r"((ptrdiff_t)(_ystride)),[ll]"r"(_ll) \ |
michael@0 | 312 | :"memory" \ |
michael@0 | 313 | ); \ |
michael@0 | 314 | } \ |
michael@0 | 315 | while(0) |
michael@0 | 316 | |
michael@0 | 317 | # endif |
michael@0 | 318 | #endif |