gfx/cairo/libpixman/src/pixman-mips-dspr2-asm.S

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (c) 2012
michael@0 3 * MIPS Technologies, Inc., California.
michael@0 4 *
michael@0 5 * Redistribution and use in source and binary forms, with or without
michael@0 6 * modification, are permitted provided that the following conditions
michael@0 7 * are met:
michael@0 8 * 1. Redistributions of source code must retain the above copyright
michael@0 9 * notice, this list of conditions and the following disclaimer.
michael@0 10 * 2. Redistributions in binary form must reproduce the above copyright
michael@0 11 * notice, this list of conditions and the following disclaimer in the
michael@0 12 * documentation and/or other materials provided with the distribution.
michael@0 13 * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
michael@0 14 * contributors may be used to endorse or promote products derived from
michael@0 15 * this software without specific prior written permission.
michael@0 16 *
michael@0 17 * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
michael@0 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
michael@0 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
michael@0 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
michael@0 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
michael@0 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
michael@0 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
michael@0 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
michael@0 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
michael@0 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@0 27 * SUCH DAMAGE.
michael@0 28 *
michael@0 29 * Author: Nemanja Lukic (nlukic@mips.com)
michael@0 30 */
michael@0 31
michael@0 32 #include "pixman-private.h"
michael@0 33 #include "pixman-mips-dspr2-asm.h"
michael@0 34
michael@0 35 LEAF_MIPS_DSPR2(pixman_fill_buff16_mips)
michael@0 36 /*
michael@0 37 * a0 - *dest
michael@0 38 * a1 - count (bytes)
michael@0 39 * a2 - value to fill buffer with
michael@0 40 */
michael@0 41
michael@0 42 beqz a1, 3f
michael@0 43 andi t1, a0, 0x0002
michael@0 44 beqz t1, 0f /* check if address is 4-byte aligned */
michael@0 45 nop
michael@0 46 sh a2, 0(a0)
michael@0 47 addiu a0, a0, 2
michael@0 48 addiu a1, a1, -2
michael@0 49 0:
michael@0 50 srl t1, a1, 5 /* t1 how many multiples of 32 bytes */
michael@0 51 replv.ph a2, a2 /* replicate fill value (16bit) in a2 */
michael@0 52 beqz t1, 2f
michael@0 53 nop
michael@0 54 1:
michael@0 55 addiu t1, t1, -1
michael@0 56 beqz t1, 11f
michael@0 57 addiu a1, a1, -32
michael@0 58 pref 30, 32(a0)
michael@0 59 sw a2, 0(a0)
michael@0 60 sw a2, 4(a0)
michael@0 61 sw a2, 8(a0)
michael@0 62 sw a2, 12(a0)
michael@0 63 sw a2, 16(a0)
michael@0 64 sw a2, 20(a0)
michael@0 65 sw a2, 24(a0)
michael@0 66 sw a2, 28(a0)
michael@0 67 b 1b
michael@0 68 addiu a0, a0, 32
michael@0 69 11:
michael@0 70 sw a2, 0(a0)
michael@0 71 sw a2, 4(a0)
michael@0 72 sw a2, 8(a0)
michael@0 73 sw a2, 12(a0)
michael@0 74 sw a2, 16(a0)
michael@0 75 sw a2, 20(a0)
michael@0 76 sw a2, 24(a0)
michael@0 77 sw a2, 28(a0)
michael@0 78 addiu a0, a0, 32
michael@0 79 2:
michael@0 80 blez a1, 3f
michael@0 81 addiu a1, a1, -2
michael@0 82 sh a2, 0(a0)
michael@0 83 b 2b
michael@0 84 addiu a0, a0, 2
michael@0 85 3:
michael@0 86 jr ra
michael@0 87 nop
michael@0 88
michael@0 89 END(pixman_fill_buff16_mips)
michael@0 90
michael@0 91 LEAF_MIPS32R2(pixman_fill_buff32_mips)
michael@0 92 /*
michael@0 93 * a0 - *dest
michael@0 94 * a1 - count (bytes)
michael@0 95 * a2 - value to fill buffer with
michael@0 96 */
michael@0 97
michael@0 98 beqz a1, 3f
michael@0 99 nop
michael@0 100 srl t1, a1, 5 /* t1 how many multiples of 32 bytes */
michael@0 101 beqz t1, 2f
michael@0 102 nop
michael@0 103 1:
michael@0 104 addiu t1, t1, -1
michael@0 105 beqz t1, 11f
michael@0 106 addiu a1, a1, -32
michael@0 107 pref 30, 32(a0)
michael@0 108 sw a2, 0(a0)
michael@0 109 sw a2, 4(a0)
michael@0 110 sw a2, 8(a0)
michael@0 111 sw a2, 12(a0)
michael@0 112 sw a2, 16(a0)
michael@0 113 sw a2, 20(a0)
michael@0 114 sw a2, 24(a0)
michael@0 115 sw a2, 28(a0)
michael@0 116 b 1b
michael@0 117 addiu a0, a0, 32
michael@0 118 11:
michael@0 119 sw a2, 0(a0)
michael@0 120 sw a2, 4(a0)
michael@0 121 sw a2, 8(a0)
michael@0 122 sw a2, 12(a0)
michael@0 123 sw a2, 16(a0)
michael@0 124 sw a2, 20(a0)
michael@0 125 sw a2, 24(a0)
michael@0 126 sw a2, 28(a0)
michael@0 127 addiu a0, a0, 32
michael@0 128 2:
michael@0 129 blez a1, 3f
michael@0 130 addiu a1, a1, -4
michael@0 131 sw a2, 0(a0)
michael@0 132 b 2b
michael@0 133 addiu a0, a0, 4
michael@0 134 3:
michael@0 135 jr ra
michael@0 136 nop
michael@0 137
michael@0 138 END(pixman_fill_buff32_mips)
michael@0 139
michael@0 140 LEAF_MIPS_DSPR2(pixman_composite_src_8888_0565_asm_mips)
michael@0 141 /*
michael@0 142 * a0 - dst (r5g6b5)
michael@0 143 * a1 - src (a8r8g8b8)
michael@0 144 * a2 - w
michael@0 145 */
michael@0 146
michael@0 147 beqz a2, 3f
michael@0 148 nop
michael@0 149 addiu t1, a2, -1
michael@0 150 beqz t1, 2f
michael@0 151 nop
michael@0 152 li t4, 0xf800f800
michael@0 153 li t5, 0x07e007e0
michael@0 154 li t6, 0x001f001f
michael@0 155 1:
michael@0 156 lw t0, 0(a1)
michael@0 157 lw t1, 4(a1)
michael@0 158 addiu a1, a1, 8
michael@0 159 addiu a2, a2, -2
michael@0 160
michael@0 161 CONVERT_2x8888_TO_2x0565 t0, t1, t2, t3, t4, t5, t6, t7, t8
michael@0 162
michael@0 163 sh t2, 0(a0)
michael@0 164 sh t3, 2(a0)
michael@0 165
michael@0 166 addiu t2, a2, -1
michael@0 167 bgtz t2, 1b
michael@0 168 addiu a0, a0, 4
michael@0 169 2:
michael@0 170 beqz a2, 3f
michael@0 171 nop
michael@0 172 lw t0, 0(a1)
michael@0 173
michael@0 174 CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3
michael@0 175
michael@0 176 sh t1, 0(a0)
michael@0 177 3:
michael@0 178 j ra
michael@0 179 nop
michael@0 180
michael@0 181 END(pixman_composite_src_8888_0565_asm_mips)
michael@0 182
michael@0 183 LEAF_MIPS_DSPR2(pixman_composite_src_0565_8888_asm_mips)
michael@0 184 /*
michael@0 185 * a0 - dst (a8r8g8b8)
michael@0 186 * a1 - src (r5g6b5)
michael@0 187 * a2 - w
michael@0 188 */
michael@0 189
michael@0 190 beqz a2, 3f
michael@0 191 nop
michael@0 192 addiu t1, a2, -1
michael@0 193 beqz t1, 2f
michael@0 194 nop
michael@0 195 li t4, 0x07e007e0
michael@0 196 li t5, 0x001F001F
michael@0 197 1:
michael@0 198 lhu t0, 0(a1)
michael@0 199 lhu t1, 2(a1)
michael@0 200 addiu a1, a1, 4
michael@0 201 addiu a2, a2, -2
michael@0 202
michael@0 203 CONVERT_2x0565_TO_2x8888 t0, t1, t2, t3, t4, t5, t6, t7, t8, t9
michael@0 204
michael@0 205 sw t2, 0(a0)
michael@0 206 sw t3, 4(a0)
michael@0 207
michael@0 208 addiu t2, a2, -1
michael@0 209 bgtz t2, 1b
michael@0 210 addiu a0, a0, 8
michael@0 211 2:
michael@0 212 beqz a2, 3f
michael@0 213 nop
michael@0 214 lhu t0, 0(a1)
michael@0 215
michael@0 216 CONVERT_1x0565_TO_1x8888 t0, t1, t2, t3
michael@0 217
michael@0 218 sw t1, 0(a0)
michael@0 219 3:
michael@0 220 j ra
michael@0 221 nop
michael@0 222
michael@0 223 END(pixman_composite_src_0565_8888_asm_mips)
michael@0 224
michael@0 225 LEAF_MIPS_DSPR2(pixman_composite_src_x888_8888_asm_mips)
michael@0 226 /*
michael@0 227 * a0 - dst (a8r8g8b8)
michael@0 228 * a1 - src (x8r8g8b8)
michael@0 229 * a2 - w
michael@0 230 */
michael@0 231
michael@0 232 beqz a2, 4f
michael@0 233 nop
michael@0 234 li t9, 0xff000000
michael@0 235 srl t8, a2, 3 /* t1 = how many multiples of 8 src pixels */
michael@0 236 beqz t8, 3f /* branch if less than 8 src pixels */
michael@0 237 nop
michael@0 238 1:
michael@0 239 addiu t8, t8, -1
michael@0 240 beqz t8, 2f
michael@0 241 addiu a2, a2, -8
michael@0 242 pref 0, 32(a1)
michael@0 243 lw t0, 0(a1)
michael@0 244 lw t1, 4(a1)
michael@0 245 lw t2, 8(a1)
michael@0 246 lw t3, 12(a1)
michael@0 247 lw t4, 16(a1)
michael@0 248 lw t5, 20(a1)
michael@0 249 lw t6, 24(a1)
michael@0 250 lw t7, 28(a1)
michael@0 251 addiu a1, a1, 32
michael@0 252 or t0, t0, t9
michael@0 253 or t1, t1, t9
michael@0 254 or t2, t2, t9
michael@0 255 or t3, t3, t9
michael@0 256 or t4, t4, t9
michael@0 257 or t5, t5, t9
michael@0 258 or t6, t6, t9
michael@0 259 or t7, t7, t9
michael@0 260 pref 30, 32(a0)
michael@0 261 sw t0, 0(a0)
michael@0 262 sw t1, 4(a0)
michael@0 263 sw t2, 8(a0)
michael@0 264 sw t3, 12(a0)
michael@0 265 sw t4, 16(a0)
michael@0 266 sw t5, 20(a0)
michael@0 267 sw t6, 24(a0)
michael@0 268 sw t7, 28(a0)
michael@0 269 b 1b
michael@0 270 addiu a0, a0, 32
michael@0 271 2:
michael@0 272 lw t0, 0(a1)
michael@0 273 lw t1, 4(a1)
michael@0 274 lw t2, 8(a1)
michael@0 275 lw t3, 12(a1)
michael@0 276 lw t4, 16(a1)
michael@0 277 lw t5, 20(a1)
michael@0 278 lw t6, 24(a1)
michael@0 279 lw t7, 28(a1)
michael@0 280 addiu a1, a1, 32
michael@0 281 or t0, t0, t9
michael@0 282 or t1, t1, t9
michael@0 283 or t2, t2, t9
michael@0 284 or t3, t3, t9
michael@0 285 or t4, t4, t9
michael@0 286 or t5, t5, t9
michael@0 287 or t6, t6, t9
michael@0 288 or t7, t7, t9
michael@0 289 sw t0, 0(a0)
michael@0 290 sw t1, 4(a0)
michael@0 291 sw t2, 8(a0)
michael@0 292 sw t3, 12(a0)
michael@0 293 sw t4, 16(a0)
michael@0 294 sw t5, 20(a0)
michael@0 295 sw t6, 24(a0)
michael@0 296 sw t7, 28(a0)
michael@0 297 beqz a2, 4f
michael@0 298 addiu a0, a0, 32
michael@0 299 3:
michael@0 300 lw t0, 0(a1)
michael@0 301 addiu a1, a1, 4
michael@0 302 addiu a2, a2, -1
michael@0 303 or t1, t0, t9
michael@0 304 sw t1, 0(a0)
michael@0 305 bnez a2, 3b
michael@0 306 addiu a0, a0, 4
michael@0 307 4:
michael@0 308 jr ra
michael@0 309 nop
michael@0 310
michael@0 311 END(pixman_composite_src_x888_8888_asm_mips)
michael@0 312
michael@0 313 LEAF_MIPS_DSPR2(pixman_composite_src_n_8_8888_asm_mips)
michael@0 314 /*
michael@0 315 * a0 - dst (a8r8g8b8)
michael@0 316 * a1 - src (32bit constant)
michael@0 317 * a2 - mask (a8)
michael@0 318 * a3 - w
michael@0 319 */
michael@0 320
michael@0 321
michael@0 322 SAVE_REGS_ON_STACK 0, v0
michael@0 323 li v0, 0x00ff00ff
michael@0 324
michael@0 325 beqz a3, 3f
michael@0 326 nop
michael@0 327 addiu t1, a3, -1
michael@0 328 beqz t1, 2f
michael@0 329 nop
michael@0 330
michael@0 331 1:
michael@0 332 /* a1 = source (32bit constant) */
michael@0 333 lbu t0, 0(a2) /* t2 = mask (a8) */
michael@0 334 lbu t1, 1(a2) /* t3 = mask (a8) */
michael@0 335 addiu a2, a2, 2
michael@0 336
michael@0 337 MIPS_2xUN8x4_MUL_2xUN8 a1, a1, t0, t1, t2, t3, v0, t4, t5, t6, t7, t8, t9
michael@0 338
michael@0 339 sw t2, 0(a0)
michael@0 340 sw t3, 4(a0)
michael@0 341 addiu a3, a3, -2
michael@0 342 addiu t2, a3, -1
michael@0 343 bgtz t2, 1b
michael@0 344 addiu a0, a0, 8
michael@0 345
michael@0 346 beqz a3, 3f
michael@0 347 nop
michael@0 348
michael@0 349 2:
michael@0 350 lbu t0, 0(a2)
michael@0 351 addiu a2, a2, 1
michael@0 352
michael@0 353 MIPS_UN8x4_MUL_UN8 a1, t0, t1, v0, t3, t4, t5
michael@0 354
michael@0 355 sw t1, 0(a0)
michael@0 356 addiu a3, a3, -1
michael@0 357 addiu a0, a0, 4
michael@0 358
michael@0 359 3:
michael@0 360 RESTORE_REGS_FROM_STACK 0, v0
michael@0 361 j ra
michael@0 362 nop
michael@0 363
michael@0 364 END(pixman_composite_src_n_8_8888_asm_mips)
michael@0 365
michael@0 366 LEAF_MIPS_DSPR2(pixman_composite_src_n_8_8_asm_mips)
michael@0 367 /*
michael@0 368 * a0 - dst (a8)
michael@0 369 * a1 - src (32bit constant)
michael@0 370 * a2 - mask (a8)
michael@0 371 * a3 - w
michael@0 372 */
michael@0 373
michael@0 374 li t9, 0x00ff00ff
michael@0 375 beqz a3, 3f
michael@0 376 nop
michael@0 377 srl t7, a3, 2 /* t7 = how many multiples of 4 dst pixels */
michael@0 378 beqz t7, 1f /* branch if less than 4 src pixels */
michael@0 379 nop
michael@0 380
michael@0 381 srl t8, a1, 24
michael@0 382 replv.ph t8, t8
michael@0 383
michael@0 384 0:
michael@0 385 beqz t7, 1f
michael@0 386 addiu t7, t7, -1
michael@0 387 lbu t0, 0(a2)
michael@0 388 lbu t1, 1(a2)
michael@0 389 lbu t2, 2(a2)
michael@0 390 lbu t3, 3(a2)
michael@0 391
michael@0 392 addiu a2, a2, 4
michael@0 393
michael@0 394 precr_sra.ph.w t1, t0, 0
michael@0 395 precr_sra.ph.w t3, t2, 0
michael@0 396 precr.qb.ph t0, t3, t1
michael@0 397
michael@0 398 muleu_s.ph.qbl t2, t0, t8
michael@0 399 muleu_s.ph.qbr t3, t0, t8
michael@0 400 shra_r.ph t4, t2, 8
michael@0 401 shra_r.ph t5, t3, 8
michael@0 402 and t4, t4, t9
michael@0 403 and t5, t5, t9
michael@0 404 addq.ph t2, t2, t4
michael@0 405 addq.ph t3, t3, t5
michael@0 406 shra_r.ph t2, t2, 8
michael@0 407 shra_r.ph t3, t3, 8
michael@0 408 precr.qb.ph t2, t2, t3
michael@0 409
michael@0 410 sb t2, 0(a0)
michael@0 411 srl t2, t2, 8
michael@0 412 sb t2, 1(a0)
michael@0 413 srl t2, t2, 8
michael@0 414 sb t2, 2(a0)
michael@0 415 srl t2, t2, 8
michael@0 416 sb t2, 3(a0)
michael@0 417 addiu a3, a3, -4
michael@0 418 b 0b
michael@0 419 addiu a0, a0, 4
michael@0 420
michael@0 421 1:
michael@0 422 beqz a3, 3f
michael@0 423 nop
michael@0 424 srl t8, a1, 24
michael@0 425 2:
michael@0 426 lbu t0, 0(a2)
michael@0 427 addiu a2, a2, 1
michael@0 428
michael@0 429 mul t2, t0, t8
michael@0 430 shra_r.ph t3, t2, 8
michael@0 431 andi t3, t3, 0x00ff
michael@0 432 addq.ph t2, t2, t3
michael@0 433 shra_r.ph t2, t2, 8
michael@0 434
michael@0 435 sb t2, 0(a0)
michael@0 436 addiu a3, a3, -1
michael@0 437 bnez a3, 2b
michael@0 438 addiu a0, a0, 1
michael@0 439
michael@0 440 3:
michael@0 441 j ra
michael@0 442 nop
michael@0 443
michael@0 444 END(pixman_composite_src_n_8_8_asm_mips)
michael@0 445
michael@0 446 LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_8888_ca_asm_mips)
michael@0 447 /*
michael@0 448 * a0 - dst (a8r8g8b8)
michael@0 449 * a1 - src (32bit constant)
michael@0 450 * a2 - mask (a8r8g8b8)
michael@0 451 * a3 - w
michael@0 452 */
michael@0 453
michael@0 454 SAVE_REGS_ON_STACK 8, s0, s1, s2, s3, s4, s5
michael@0 455 beqz a3, 4f
michael@0 456 nop
michael@0 457 li t6, 0xff
michael@0 458 addiu t7, zero, -1 /* t7 = 0xffffffff */
michael@0 459 srl t8, a1, 24 /* t8 = srca */
michael@0 460 li t9, 0x00ff00ff
michael@0 461 addiu t1, a3, -1
michael@0 462 beqz t1, 3f /* last pixel */
michael@0 463 nop
michael@0 464 beq t8, t6, 2f /* if (srca == 0xff) */
michael@0 465 nop
michael@0 466 1:
michael@0 467 /* a1 = src */
michael@0 468 lw t0, 0(a2) /* t0 = mask */
michael@0 469 lw t1, 4(a2) /* t1 = mask */
michael@0 470 or t2, t0, t1
michael@0 471 beqz t2, 12f /* if (t0 == 0) && (t1 == 0) */
michael@0 472 addiu a2, a2, 8
michael@0 473 and t3, t0, t1
michael@0 474 move t4, a1 /* t4 = src */
michael@0 475 move t5, a1 /* t5 = src */
michael@0 476 lw t2, 0(a0) /* t2 = dst */
michael@0 477 beq t3, t7, 11f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */
michael@0 478 lw t3, 4(a0) /* t3 = dst */
michael@0 479 MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, t4, t5, t9, s0, s1, s2, s3, s4, s5
michael@0 480 MIPS_2xUN8x4_MUL_2xUN8 t0, t1, t8, t8, t0, t1, t9, s0, s1, s2, s3, s4, s5
michael@0 481 11:
michael@0 482 not t0, t0
michael@0 483 not t1, t1
michael@0 484 MIPS_2xUN8x4_MUL_2xUN8x4 t2, t3, t0, t1, t2, t3, t9, s0, s1, s2, s3, s4, s5
michael@0 485 addu_s.qb t2, t4, t2
michael@0 486 addu_s.qb t3, t5, t3
michael@0 487 sw t2, 0(a0)
michael@0 488 sw t3, 4(a0)
michael@0 489 12:
michael@0 490 addiu a3, a3, -2
michael@0 491 addiu t1, a3, -1
michael@0 492 bgtz t1, 1b
michael@0 493 addiu a0, a0, 8
michael@0 494 b 3f
michael@0 495 nop
michael@0 496 2:
michael@0 497 /* a1 = src */
michael@0 498 lw t0, 0(a2) /* t0 = mask */
michael@0 499 lw t1, 4(a2) /* t1 = mask */
michael@0 500 or t2, t0, t1
michael@0 501 beqz t2, 22f /* if (t0 == 0) & (t1 == 0) */
michael@0 502 addiu a2, a2, 8
michael@0 503 and t2, t0, t1
michael@0 504 move t4, a1
michael@0 505 beq t2, t7, 21f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */
michael@0 506 move t5, a1
michael@0 507 lw t2, 0(a0) /* t2 = dst */
michael@0 508 lw t3, 4(a0) /* t3 = dst */
michael@0 509 MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, t4, t5, t9, s0, s1, s2, s3, s4, s5
michael@0 510 not t0, t0
michael@0 511 not t1, t1
michael@0 512 MIPS_2xUN8x4_MUL_2xUN8x4 t2, t3, t0, t1, t2, t3, t9, s0, s1, s2, s3, s4, s5
michael@0 513 addu_s.qb t4, t4, t2
michael@0 514 addu_s.qb t5, t5, t3
michael@0 515 21:
michael@0 516 sw t4, 0(a0)
michael@0 517 sw t5, 4(a0)
michael@0 518 22:
michael@0 519 addiu a3, a3, -2
michael@0 520 addiu t1, a3, -1
michael@0 521 bgtz t1, 2b
michael@0 522 addiu a0, a0, 8
michael@0 523 3:
michael@0 524 blez a3, 4f
michael@0 525 nop
michael@0 526 /* a1 = src */
michael@0 527 lw t1, 0(a2) /* t1 = mask */
michael@0 528 beqz t1, 4f
michael@0 529 nop
michael@0 530 move t2, a1 /* t2 = src */
michael@0 531 beq t1, t7, 31f
michael@0 532 lw t0, 0(a0) /* t0 = dst */
michael@0 533
michael@0 534 MIPS_UN8x4_MUL_UN8x4 a1, t1, t2, t9, t3, t4, t5, t6
michael@0 535 MIPS_UN8x4_MUL_UN8 t1, t8, t1, t9, t3, t4, t5
michael@0 536 31:
michael@0 537 not t1, t1
michael@0 538 MIPS_UN8x4_MUL_UN8x4 t0, t1, t0, t9, t3, t4, t5, t6
michael@0 539 addu_s.qb t0, t2, t0
michael@0 540 sw t0, 0(a0)
michael@0 541 4:
michael@0 542 RESTORE_REGS_FROM_STACK 8, s0, s1, s2, s3, s4, s5
michael@0 543 j ra
michael@0 544 nop
michael@0 545
michael@0 546 END(pixman_composite_over_n_8888_8888_ca_asm_mips)
michael@0 547
michael@0 548 LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_0565_ca_asm_mips)
michael@0 549 /*
michael@0 550 * a0 - dst (r5g6b5)
michael@0 551 * a1 - src (32bit constant)
michael@0 552 * a2 - mask (a8r8g8b8)
michael@0 553 * a3 - w
michael@0 554 */
michael@0 555
michael@0 556 SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 557 beqz a3, 4f
michael@0 558 nop
michael@0 559 li t5, 0xf800f800
michael@0 560 li t6, 0x07e007e0
michael@0 561 li t7, 0x001F001F
michael@0 562 li t9, 0x00ff00ff
michael@0 563
michael@0 564 srl t8, a1, 24 /* t8 = srca */
michael@0 565 addiu t1, a3, -1
michael@0 566 beqz t1, 3f /* last pixel */
michael@0 567 nop
michael@0 568 li s0, 0xff /* s0 = 0xff */
michael@0 569 addiu s1, zero, -1 /* s1 = 0xffffffff */
michael@0 570
michael@0 571 beq t8, s0, 2f /* if (srca == 0xff) */
michael@0 572 nop
michael@0 573 1:
michael@0 574 /* a1 = src */
michael@0 575 lw t0, 0(a2) /* t0 = mask */
michael@0 576 lw t1, 4(a2) /* t1 = mask */
michael@0 577 or t2, t0, t1
michael@0 578 beqz t2, 12f /* if (t0 == 0) && (t1 == 0) */
michael@0 579 addiu a2, a2, 8
michael@0 580 and t3, t0, t1
michael@0 581 move s2, a1 /* s2 = src */
michael@0 582 move s3, a1 /* s3 = src */
michael@0 583 lhu t2, 0(a0) /* t2 = dst */
michael@0 584 beq t3, s1, 11f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */
michael@0 585 lhu t3, 2(a0) /* t3 = dst */
michael@0 586 MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, s2, s3, t9, t4, s4, s5, s6, s7, s8
michael@0 587 MIPS_2xUN8x4_MUL_2xUN8 t0, t1, t8, t8, t0, t1, t9, t4, s4, s5, s6, s7, s8
michael@0 588 11:
michael@0 589 not t0, t0
michael@0 590 not t1, t1
michael@0 591 CONVERT_2x0565_TO_2x8888 t2, t3, s4, s5, t6, t7, t4, s6, s7, s8
michael@0 592 MIPS_2xUN8x4_MUL_2xUN8x4 s4, s5, t0, t1, s4, s5, t9, t4, s6, s7, s8, t0, t1
michael@0 593 addu_s.qb s2, s2, s4
michael@0 594 addu_s.qb s3, s3, s5
michael@0 595 CONVERT_2x8888_TO_2x0565 s2, s3, t2, t3, t5, t6, t7, s4, s5
michael@0 596 sh t2, 0(a0)
michael@0 597 sh t3, 2(a0)
michael@0 598 12:
michael@0 599 addiu a3, a3, -2
michael@0 600 addiu t1, a3, -1
michael@0 601 bgtz t1, 1b
michael@0 602 addiu a0, a0, 4
michael@0 603 b 3f
michael@0 604 nop
michael@0 605 2:
michael@0 606 /* a1 = src */
michael@0 607 lw t0, 0(a2) /* t0 = mask */
michael@0 608 lw t1, 4(a2) /* t1 = mask */
michael@0 609 or t2, t0, t1
michael@0 610 beqz t2, 22f /* if (t0 == 0) & (t1 == 0) */
michael@0 611 addiu a2, a2, 8
michael@0 612 and t3, t0, t1
michael@0 613 move t2, a1
michael@0 614 beq t3, s1, 21f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */
michael@0 615 move t3, a1
michael@0 616 lhu t2, 0(a0) /* t2 = dst */
michael@0 617 lhu t3, 2(a0) /* t3 = dst */
michael@0 618 MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, s2, s3, t9, t4, s4, s5, s6, s7, s8
michael@0 619 not t0, t0
michael@0 620 not t1, t1
michael@0 621 CONVERT_2x0565_TO_2x8888 t2, t3, s4, s5, t6, t7, t4, s6, s7, s8
michael@0 622 MIPS_2xUN8x4_MUL_2xUN8x4 s4, s5, t0, t1, s4, s5, t9, t4, s6, s7, s8, t2, t3
michael@0 623 addu_s.qb t2, s2, s4
michael@0 624 addu_s.qb t3, s3, s5
michael@0 625 21:
michael@0 626 CONVERT_2x8888_TO_2x0565 t2, t3, t0, t1, t5, t6, t7, s2, s3
michael@0 627 sh t0, 0(a0)
michael@0 628 sh t1, 2(a0)
michael@0 629 22:
michael@0 630 addiu a3, a3, -2
michael@0 631 addiu t1, a3, -1
michael@0 632 bgtz t1, 2b
michael@0 633 addiu a0, a0, 4
michael@0 634 3:
michael@0 635 blez a3, 4f
michael@0 636 nop
michael@0 637 /* a1 = src */
michael@0 638 lw t1, 0(a2) /* t1 = mask */
michael@0 639 beqz t1, 4f
michael@0 640 nop
michael@0 641 move t2, a1 /* t2 = src */
michael@0 642 beq t1, t7, 31f
michael@0 643 lhu t0, 0(a0) /* t0 = dst */
michael@0 644
michael@0 645 MIPS_UN8x4_MUL_UN8x4 a1, t1, t2, t9, t3, t4, t5, t6
michael@0 646 MIPS_UN8x4_MUL_UN8 t1, t8, t1, t9, t3, t4, t5
michael@0 647 31:
michael@0 648 not t1, t1
michael@0 649 CONVERT_1x0565_TO_1x8888 t0, s1, s2, s3
michael@0 650 MIPS_UN8x4_MUL_UN8x4 s1, t1, t3, t9, t4, t5, t6, t7
michael@0 651 addu_s.qb t0, t2, t3
michael@0 652 CONVERT_1x8888_TO_1x0565 t0, s1, s2, s3
michael@0 653 sh s1, 0(a0)
michael@0 654 4:
michael@0 655 RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 656 j ra
michael@0 657 nop
michael@0 658
michael@0 659 END(pixman_composite_over_n_8888_0565_ca_asm_mips)
michael@0 660
michael@0 661 LEAF_MIPS_DSPR2(pixman_composite_over_n_8_8888_asm_mips)
michael@0 662 /*
michael@0 663 * a0 - dst (a8r8g8b8)
michael@0 664 * a1 - src (32bit constant)
michael@0 665 * a2 - mask (a8)
michael@0 666 * a3 - w
michael@0 667 */
michael@0 668
michael@0 669 SAVE_REGS_ON_STACK 4, s0, s1, s2, s3, s4
michael@0 670 beqz a3, 4f
michael@0 671 nop
michael@0 672 li t4, 0x00ff00ff
michael@0 673 li t5, 0xff
michael@0 674 addiu t0, a3, -1
michael@0 675 beqz t0, 3f /* last pixel */
michael@0 676 srl t6, a1, 24 /* t6 = srca */
michael@0 677 not s4, a1
michael@0 678 beq t5, t6, 2f /* if (srca == 0xff) */
michael@0 679 srl s4, s4, 24
michael@0 680 1:
michael@0 681 /* a1 = src */
michael@0 682 lbu t0, 0(a2) /* t0 = mask */
michael@0 683 lbu t1, 1(a2) /* t1 = mask */
michael@0 684 or t2, t0, t1
michael@0 685 beqz t2, 111f /* if (t0 == 0) && (t1 == 0) */
michael@0 686 addiu a2, a2, 2
michael@0 687 and t3, t0, t1
michael@0 688
michael@0 689 lw t2, 0(a0) /* t2 = dst */
michael@0 690 beq t3, t5, 11f /* if (t0 == 0xff) && (t1 == 0xff) */
michael@0 691 lw t3, 4(a0) /* t3 = dst */
michael@0 692
michael@0 693 MIPS_2xUN8x4_MUL_2xUN8 a1, a1, t0, t1, s0, s1, t4, t6, t7, t8, t9, s2, s3
michael@0 694 not s2, s0
michael@0 695 not s3, s1
michael@0 696 srl s2, s2, 24
michael@0 697 srl s3, s3, 24
michael@0 698 MIPS_2xUN8x4_MUL_2xUN8 t2, t3, s2, s3, t2, t3, t4, t0, t1, t6, t7, t8, t9
michael@0 699 addu_s.qb s2, t2, s0
michael@0 700 addu_s.qb s3, t3, s1
michael@0 701 sw s2, 0(a0)
michael@0 702 b 111f
michael@0 703 sw s3, 4(a0)
michael@0 704 11:
michael@0 705 MIPS_2xUN8x4_MUL_2xUN8 t2, t3, s4, s4, t2, t3, t4, t0, t1, t6, t7, t8, t9
michael@0 706 addu_s.qb s2, t2, a1
michael@0 707 addu_s.qb s3, t3, a1
michael@0 708 sw s2, 0(a0)
michael@0 709 sw s3, 4(a0)
michael@0 710
michael@0 711 111:
michael@0 712 addiu a3, a3, -2
michael@0 713 addiu t0, a3, -1
michael@0 714 bgtz t0, 1b
michael@0 715 addiu a0, a0, 8
michael@0 716 b 3f
michael@0 717 nop
michael@0 718 2:
michael@0 719 /* a1 = src */
michael@0 720 lbu t0, 0(a2) /* t0 = mask */
michael@0 721 lbu t1, 1(a2) /* t1 = mask */
michael@0 722 or t2, t0, t1
michael@0 723 beqz t2, 222f /* if (t0 == 0) && (t1 == 0) */
michael@0 724 addiu a2, a2, 2
michael@0 725 and t3, t0, t1
michael@0 726 beq t3, t5, 22f /* if (t0 == 0xff) && (t1 == 0xff) */
michael@0 727 nop
michael@0 728 lw t2, 0(a0) /* t2 = dst */
michael@0 729 lw t3, 4(a0) /* t3 = dst */
michael@0 730
michael@0 731 OVER_2x8888_2x8_2x8888 a1, a1, t0, t1, t2, t3, \
michael@0 732 t6, t7, t4, t8, t9, s0, s1, s2, s3
michael@0 733 sw t6, 0(a0)
michael@0 734 b 222f
michael@0 735 sw t7, 4(a0)
michael@0 736 22:
michael@0 737 sw a1, 0(a0)
michael@0 738 sw a1, 4(a0)
michael@0 739 222:
michael@0 740 addiu a3, a3, -2
michael@0 741 addiu t0, a3, -1
michael@0 742 bgtz t0, 2b
michael@0 743 addiu a0, a0, 8
michael@0 744 3:
michael@0 745 blez a3, 4f
michael@0 746 nop
michael@0 747 /* a1 = src */
michael@0 748 lbu t0, 0(a2) /* t0 = mask */
michael@0 749 beqz t0, 4f /* if (t0 == 0) */
michael@0 750 addiu a2, a2, 1
michael@0 751 move t3, a1
michael@0 752 beq t0, t5, 31f /* if (t0 == 0xff) */
michael@0 753 lw t1, 0(a0) /* t1 = dst */
michael@0 754
michael@0 755 MIPS_UN8x4_MUL_UN8 a1, t0, t3, t4, t6, t7, t8
michael@0 756 31:
michael@0 757 not t2, t3
michael@0 758 srl t2, t2, 24
michael@0 759 MIPS_UN8x4_MUL_UN8 t1, t2, t1, t4, t6, t7, t8
michael@0 760 addu_s.qb t2, t1, t3
michael@0 761 sw t2, 0(a0)
michael@0 762 4:
michael@0 763 RESTORE_REGS_FROM_STACK 4, s0, s1, s2, s3, s4
michael@0 764 j ra
michael@0 765 nop
michael@0 766
michael@0 767 END(pixman_composite_over_n_8_8888_asm_mips)
michael@0 768
michael@0 769 LEAF_MIPS_DSPR2(pixman_composite_over_n_8_0565_asm_mips)
michael@0 770 /*
michael@0 771 * a0 - dst (r5g6b5)
michael@0 772 * a1 - src (32bit constant)
michael@0 773 * a2 - mask (a8)
michael@0 774 * a3 - w
michael@0 775 */
michael@0 776 SAVE_REGS_ON_STACK 24, v0, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 777 beqz a3, 4f
michael@0 778 nop
michael@0 779 li t4, 0x00ff00ff
michael@0 780 li t5, 0xff
michael@0 781 li t6, 0xf800f800
michael@0 782 li t7, 0x07e007e0
michael@0 783 li t8, 0x001F001F
michael@0 784 addiu t1, a3, -1
michael@0 785 beqz t1, 3f /* last pixel */
michael@0 786 srl t0, a1, 24 /* t0 = srca */
michael@0 787 not v0, a1
michael@0 788 beq t0, t5, 2f /* if (srca == 0xff) */
michael@0 789 srl v0, v0, 24
michael@0 790 1:
michael@0 791 /* a1 = src */
michael@0 792 lbu t0, 0(a2) /* t0 = mask */
michael@0 793 lbu t1, 1(a2) /* t1 = mask */
michael@0 794 or t2, t0, t1
michael@0 795 beqz t2, 111f /* if (t0 == 0) && (t1 == 0) */
michael@0 796 addiu a2, a2, 2
michael@0 797 lhu t2, 0(a0) /* t2 = dst */
michael@0 798 lhu t3, 2(a0) /* t3 = dst */
michael@0 799 CONVERT_2x0565_TO_2x8888 t2, t3, s0, s1, t7, t8, t9, s2, s3, s4
michael@0 800 and t9, t0, t1
michael@0 801 beq t9, t5, 11f /* if (t0 == 0xff) && (t1 == 0xff) */
michael@0 802 nop
michael@0 803
michael@0 804 MIPS_2xUN8x4_MUL_2xUN8 a1, a1, t0, t1, s2, s3, t4, t9, s4, s5, s6, s7, s8
michael@0 805 not s4, s2
michael@0 806 not s5, s3
michael@0 807 srl s4, s4, 24
michael@0 808 srl s5, s5, 24
michael@0 809 MIPS_2xUN8x4_MUL_2xUN8 s0, s1, s4, s5, s0, s1, t4, t9, t0, t1, s6, s7, s8
michael@0 810 addu_s.qb s4, s2, s0
michael@0 811 addu_s.qb s5, s3, s1
michael@0 812 CONVERT_2x8888_TO_2x0565 s4, s5, t2, t3, t6, t7, t8, s0, s1
michael@0 813 sh t2, 0(a0)
michael@0 814 b 111f
michael@0 815 sh t3, 2(a0)
michael@0 816 11:
michael@0 817 MIPS_2xUN8x4_MUL_2xUN8 s0, s1, v0, v0, s0, s1, t4, t9, t0, t1, s6, s7, s8
michael@0 818 addu_s.qb s4, a1, s0
michael@0 819 addu_s.qb s5, a1, s1
michael@0 820 CONVERT_2x8888_TO_2x0565 s4, s5, t2, t3, t6, t7, t8, s0, s1
michael@0 821 sh t2, 0(a0)
michael@0 822 sh t3, 2(a0)
michael@0 823 111:
michael@0 824 addiu a3, a3, -2
michael@0 825 addiu t0, a3, -1
michael@0 826 bgtz t0, 1b
michael@0 827 addiu a0, a0, 4
michael@0 828 b 3f
michael@0 829 nop
michael@0 830 2:
michael@0 831 CONVERT_1x8888_TO_1x0565 a1, s0, s1, s2
michael@0 832 21:
michael@0 833 /* a1 = src */
michael@0 834 lbu t0, 0(a2) /* t0 = mask */
michael@0 835 lbu t1, 1(a2) /* t1 = mask */
michael@0 836 or t2, t0, t1
michael@0 837 beqz t2, 222f /* if (t0 == 0) && (t1 == 0) */
michael@0 838 addiu a2, a2, 2
michael@0 839 and t9, t0, t1
michael@0 840 move s2, s0
michael@0 841 beq t9, t5, 22f /* if (t0 == 0xff) && (t2 == 0xff) */
michael@0 842 move s3, s0
michael@0 843 lhu t2, 0(a0) /* t2 = dst */
michael@0 844 lhu t3, 2(a0) /* t3 = dst */
michael@0 845
michael@0 846 CONVERT_2x0565_TO_2x8888 t2, t3, s2, s3, t7, t8, s4, s5, s6, s7
michael@0 847 OVER_2x8888_2x8_2x8888 a1, a1, t0, t1, s2, s3, \
michael@0 848 t2, t3, t4, t9, s4, s5, s6, s7, s8
michael@0 849 CONVERT_2x8888_TO_2x0565 t2, t3, s2, s3, t6, t7, t8, s4, s5
michael@0 850 22:
michael@0 851 sh s2, 0(a0)
michael@0 852 sh s3, 2(a0)
michael@0 853 222:
michael@0 854 addiu a3, a3, -2
michael@0 855 addiu t0, a3, -1
michael@0 856 bgtz t0, 21b
michael@0 857 addiu a0, a0, 4
michael@0 858 3:
michael@0 859 blez a3, 4f
michael@0 860 nop
michael@0 861 /* a1 = src */
michael@0 862 lbu t0, 0(a2) /* t0 = mask */
michael@0 863 beqz t0, 4f /* if (t0 == 0) */
michael@0 864 nop
michael@0 865 lhu t1, 0(a0) /* t1 = dst */
michael@0 866 CONVERT_1x0565_TO_1x8888 t1, t2, t3, t7
michael@0 867 beq t0, t5, 31f /* if (t0 == 0xff) */
michael@0 868 move t3, a1
michael@0 869
michael@0 870 MIPS_UN8x4_MUL_UN8 a1, t0, t3, t4, t7, t8, t9
michael@0 871 31:
michael@0 872 not t6, t3
michael@0 873 srl t6, t6, 24
michael@0 874 MIPS_UN8x4_MUL_UN8 t2, t6, t2, t4, t7, t8, t9
michael@0 875 addu_s.qb t1, t2, t3
michael@0 876 CONVERT_1x8888_TO_1x0565 t1, t2, t3, t7
michael@0 877 sh t2, 0(a0)
michael@0 878 4:
michael@0 879 RESTORE_REGS_FROM_STACK 24, v0, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 880 j ra
michael@0 881 nop
michael@0 882
michael@0 883 END(pixman_composite_over_n_8_0565_asm_mips)
michael@0 884
michael@0 885 LEAF_MIPS_DSPR2(pixman_composite_over_8888_n_8888_asm_mips)
michael@0 886 /*
michael@0 887 * a0 - dst (a8r8g8b8)
michael@0 888 * a1 - src (a8r8g8b8)
michael@0 889 * a2 - mask (32bit constant)
michael@0 890 * a3 - w
michael@0 891 */
michael@0 892
michael@0 893 SAVE_REGS_ON_STACK 0, s0
michael@0 894 li t4, 0x00ff00ff
michael@0 895 beqz a3, 3f
michael@0 896 nop
michael@0 897 addiu t1, a3, -1
michael@0 898 srl a2, a2, 24
michael@0 899 beqz t1, 2f
michael@0 900 nop
michael@0 901
michael@0 902 1:
michael@0 903 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 904 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 905 /* a2 = mask (32bit constant) */
michael@0 906 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 907 lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */
michael@0 908 addiu a1, a1, 8
michael@0 909
michael@0 910 OVER_2x8888_2x8_2x8888 t0, t1, a2, a2, t2, t3, \
michael@0 911 t5, t6, t4, t7, t8, t9, t0, t1, s0
michael@0 912
michael@0 913 sw t5, 0(a0)
michael@0 914 sw t6, 4(a0)
michael@0 915 addiu a3, a3, -2
michael@0 916 addiu t1, a3, -1
michael@0 917 bgtz t1, 1b
michael@0 918 addiu a0, a0, 8
michael@0 919 2:
michael@0 920 beqz a3, 3f
michael@0 921 nop
michael@0 922 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 923 /* a2 = mask (32bit constant) */
michael@0 924 lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */
michael@0 925
michael@0 926 OVER_8888_8_8888 t0, a2, t1, t3, t4, t5, t6, t7, t8
michael@0 927
michael@0 928 sw t3, 0(a0)
michael@0 929 3:
michael@0 930 RESTORE_REGS_FROM_STACK 0, s0
michael@0 931 j ra
michael@0 932 nop
michael@0 933
michael@0 934 END(pixman_composite_over_8888_n_8888_asm_mips)
michael@0 935
michael@0 936 LEAF_MIPS_DSPR2(pixman_composite_over_8888_n_0565_asm_mips)
michael@0 937 /*
michael@0 938 * a0 - dst (r5g6b5)
michael@0 939 * a1 - src (a8r8g8b8)
michael@0 940 * a2 - mask (32bit constant)
michael@0 941 * a3 - w
michael@0 942 */
michael@0 943
michael@0 944 SAVE_REGS_ON_STACK 0, s0, s1, s2, s3
michael@0 945 li t6, 0x00ff00ff
michael@0 946 li t7, 0xf800f800
michael@0 947 li t8, 0x07e007e0
michael@0 948 li t9, 0x001F001F
michael@0 949 beqz a3, 3f
michael@0 950 nop
michael@0 951 srl a2, a2, 24
michael@0 952 addiu t1, a3, -1
michael@0 953 beqz t1, 2f
michael@0 954 nop
michael@0 955 1:
michael@0 956 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 957 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 958 /* a2 = mask (32bit constant) */
michael@0 959 lhu t2, 0(a0) /* t2 = destination (r5g6b5) */
michael@0 960 lhu t3, 2(a0) /* t2 = destination (r5g6b5) */
michael@0 961 addiu a1, a1, 8
michael@0 962
michael@0 963 CONVERT_2x0565_TO_2x8888 t2, t3, t4, t5, t8, t9, s0, s1, t2, t3
michael@0 964 OVER_2x8888_2x8_2x8888 t0, t1, a2, a2, t4, t5, \
michael@0 965 t2, t3, t6, t0, t1, s0, s1, s2, s3
michael@0 966 CONVERT_2x8888_TO_2x0565 t2, t3, t4, t5, t7, t8, t9, s0, s1
michael@0 967
michael@0 968 sh t4, 0(a0)
michael@0 969 sh t5, 2(a0)
michael@0 970 addiu a3, a3, -2
michael@0 971 addiu t1, a3, -1
michael@0 972 bgtz t1, 1b
michael@0 973 addiu a0, a0, 4
michael@0 974 2:
michael@0 975 beqz a3, 3f
michael@0 976 nop
michael@0 977 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 978 /* a2 = mask (32bit constant) */
michael@0 979 lhu t1, 0(a0) /* t1 = destination (r5g6b5) */
michael@0 980
michael@0 981 CONVERT_1x0565_TO_1x8888 t1, t2, t4, t5
michael@0 982 OVER_8888_8_8888 t0, a2, t2, t1, t6, t3, t4, t5, t7
michael@0 983 CONVERT_1x8888_TO_1x0565 t1, t3, t4, t5
michael@0 984
michael@0 985 sh t3, 0(a0)
michael@0 986 3:
michael@0 987 RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3
michael@0 988 j ra
michael@0 989 nop
michael@0 990
michael@0 991 END(pixman_composite_over_8888_n_0565_asm_mips)
michael@0 992
michael@0 993 LEAF_MIPS_DSPR2(pixman_composite_over_0565_n_0565_asm_mips)
michael@0 994 /*
michael@0 995 * a0 - dst (r5g6b5)
michael@0 996 * a1 - src (r5g6b5)
michael@0 997 * a2 - mask (32bit constant)
michael@0 998 * a3 - w
michael@0 999 */
michael@0 1000
michael@0 1001 SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5
michael@0 1002 li t6, 0x00ff00ff
michael@0 1003 li t7, 0xf800f800
michael@0 1004 li t8, 0x07e007e0
michael@0 1005 li t9, 0x001F001F
michael@0 1006 beqz a3, 3f
michael@0 1007 nop
michael@0 1008 srl a2, a2, 24
michael@0 1009 addiu t1, a3, -1
michael@0 1010 beqz t1, 2f
michael@0 1011 nop
michael@0 1012 1:
michael@0 1013 lhu t0, 0(a1) /* t0 = source (r5g6b5) */
michael@0 1014 lhu t1, 2(a1) /* t1 = source (r5g6b5) */
michael@0 1015 /* a2 = mask (32bit constant) */
michael@0 1016 lhu t2, 0(a0) /* t2 = destination (r5g6b5) */
michael@0 1017 lhu t3, 2(a0) /* t3 = destination (r5g6b5) */
michael@0 1018 addiu a1, a1, 4
michael@0 1019
michael@0 1020 CONVERT_2x0565_TO_2x8888 t0, t1, t4, t5, t8, t9, s0, s1, s2, s3
michael@0 1021 CONVERT_2x0565_TO_2x8888 t2, t3, s0, s1, t8, t9, s2, s3, s4, s5
michael@0 1022 OVER_2x8888_2x8_2x8888 t4, t5, a2, a2, s0, s1, \
michael@0 1023 t0, t1, t6, s2, s3, s4, s5, t4, t5
michael@0 1024 CONVERT_2x8888_TO_2x0565 t0, t1, s0, s1, t7, t8, t9, s2, s3
michael@0 1025
michael@0 1026 sh s0, 0(a0)
michael@0 1027 sh s1, 2(a0)
michael@0 1028 addiu a3, a3, -2
michael@0 1029 addiu t1, a3, -1
michael@0 1030 bgtz t1, 1b
michael@0 1031 addiu a0, a0, 4
michael@0 1032 2:
michael@0 1033 beqz a3, 3f
michael@0 1034 nop
michael@0 1035 lhu t0, 0(a1) /* t0 = source (r5g6b5) */
michael@0 1036 /* a2 = mask (32bit constant) */
michael@0 1037 lhu t1, 0(a0) /* t1 = destination (r5g6b5) */
michael@0 1038
michael@0 1039 CONVERT_1x0565_TO_1x8888 t0, t2, t4, t5
michael@0 1040 CONVERT_1x0565_TO_1x8888 t1, t3, t4, t5
michael@0 1041 OVER_8888_8_8888 t2, a2, t3, t0, t6, t1, t4, t5, t7
michael@0 1042 CONVERT_1x8888_TO_1x0565 t0, t3, t4, t5
michael@0 1043
michael@0 1044 sh t3, 0(a0)
michael@0 1045 3:
michael@0 1046 RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5
michael@0 1047 j ra
michael@0 1048 nop
michael@0 1049
michael@0 1050 END(pixman_composite_over_0565_n_0565_asm_mips)
michael@0 1051
michael@0 1052 LEAF_MIPS_DSPR2(pixman_composite_over_8888_8_8888_asm_mips)
michael@0 1053 /*
michael@0 1054 * a0 - dst (a8r8g8b8)
michael@0 1055 * a1 - src (a8r8g8b8)
michael@0 1056 * a2 - mask (a8)
michael@0 1057 * a3 - w
michael@0 1058 */
michael@0 1059
michael@0 1060 SAVE_REGS_ON_STACK 0, s0, s1
michael@0 1061 li t4, 0x00ff00ff
michael@0 1062 beqz a3, 3f
michael@0 1063 nop
michael@0 1064 addiu t1, a3, -1
michael@0 1065 beqz t1, 2f
michael@0 1066 nop
michael@0 1067 1:
michael@0 1068 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1069 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 1070 lbu t2, 0(a2) /* t2 = mask (a8) */
michael@0 1071 lbu t3, 1(a2) /* t3 = mask (a8) */
michael@0 1072 lw t5, 0(a0) /* t5 = destination (a8r8g8b8) */
michael@0 1073 lw t6, 4(a0) /* t6 = destination (a8r8g8b8) */
michael@0 1074 addiu a1, a1, 8
michael@0 1075 addiu a2, a2, 2
michael@0 1076
michael@0 1077 OVER_2x8888_2x8_2x8888 t0, t1, t2, t3, t5, t6, \
michael@0 1078 t7, t8, t4, t9, s0, s1, t0, t1, t2
michael@0 1079
michael@0 1080 sw t7, 0(a0)
michael@0 1081 sw t8, 4(a0)
michael@0 1082 addiu a3, a3, -2
michael@0 1083 addiu t1, a3, -1
michael@0 1084 bgtz t1, 1b
michael@0 1085 addiu a0, a0, 8
michael@0 1086 2:
michael@0 1087 beqz a3, 3f
michael@0 1088 nop
michael@0 1089 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1090 lbu t1, 0(a2) /* t1 = mask (a8) */
michael@0 1091 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 1092
michael@0 1093 OVER_8888_8_8888 t0, t1, t2, t3, t4, t5, t6, t7, t8
michael@0 1094
michael@0 1095 sw t3, 0(a0)
michael@0 1096 3:
michael@0 1097 RESTORE_REGS_FROM_STACK 0, s0, s1
michael@0 1098 j ra
michael@0 1099 nop
michael@0 1100
michael@0 1101 END(pixman_composite_over_8888_8_8888_asm_mips)
michael@0 1102
michael@0 1103 LEAF_MIPS_DSPR2(pixman_composite_over_8888_8_0565_asm_mips)
michael@0 1104 /*
michael@0 1105 * a0 - dst (r5g6b5)
michael@0 1106 * a1 - src (a8r8g8b8)
michael@0 1107 * a2 - mask (a8)
michael@0 1108 * a3 - w
michael@0 1109 */
michael@0 1110
michael@0 1111 SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5
michael@0 1112 li t6, 0x00ff00ff
michael@0 1113 li t7, 0xf800f800
michael@0 1114 li t8, 0x07e007e0
michael@0 1115 li t9, 0x001F001F
michael@0 1116 beqz a3, 3f
michael@0 1117 nop
michael@0 1118 addiu t1, a3, -1
michael@0 1119 beqz t1, 2f
michael@0 1120 nop
michael@0 1121 1:
michael@0 1122 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1123 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 1124 lbu t2, 0(a2) /* t2 = mask (a8) */
michael@0 1125 lbu t3, 1(a2) /* t3 = mask (a8) */
michael@0 1126 lhu t4, 0(a0) /* t4 = destination (r5g6b5) */
michael@0 1127 lhu t5, 2(a0) /* t5 = destination (r5g6b5) */
michael@0 1128 addiu a1, a1, 8
michael@0 1129 addiu a2, a2, 2
michael@0 1130
michael@0 1131 CONVERT_2x0565_TO_2x8888 t4, t5, s0, s1, t8, t9, s2, s3, s4, s5
michael@0 1132 OVER_2x8888_2x8_2x8888 t0, t1, t2, t3, s0, s1, \
michael@0 1133 t4, t5, t6, s2, s3, s4, s5, t0, t1
michael@0 1134 CONVERT_2x8888_TO_2x0565 t4, t5, s0, s1, t7, t8, t9, s2, s3
michael@0 1135
michael@0 1136 sh s0, 0(a0)
michael@0 1137 sh s1, 2(a0)
michael@0 1138 addiu a3, a3, -2
michael@0 1139 addiu t1, a3, -1
michael@0 1140 bgtz t1, 1b
michael@0 1141 addiu a0, a0, 4
michael@0 1142 2:
michael@0 1143 beqz a3, 3f
michael@0 1144 nop
michael@0 1145 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1146 lbu t1, 0(a2) /* t1 = mask (a8) */
michael@0 1147 lhu t2, 0(a0) /* t2 = destination (r5g6b5) */
michael@0 1148
michael@0 1149 CONVERT_1x0565_TO_1x8888 t2, t3, t4, t5
michael@0 1150 OVER_8888_8_8888 t0, t1, t3, t2, t6, t4, t5, t7, t8
michael@0 1151 CONVERT_1x8888_TO_1x0565 t2, t3, t4, t5
michael@0 1152
michael@0 1153 sh t3, 0(a0)
michael@0 1154 3:
michael@0 1155 RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5
michael@0 1156 j ra
michael@0 1157 nop
michael@0 1158
michael@0 1159 END(pixman_composite_over_8888_8_0565_asm_mips)
michael@0 1160
michael@0 1161 LEAF_MIPS_DSPR2(pixman_composite_over_0565_8_0565_asm_mips)
michael@0 1162 /*
michael@0 1163 * a0 - dst (r5g6b5)
michael@0 1164 * a1 - src (r5g6b5)
michael@0 1165 * a2 - mask (a8)
michael@0 1166 * a3 - w
michael@0 1167 */
michael@0 1168
michael@0 1169 SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5
michael@0 1170 li t4, 0xf800f800
michael@0 1171 li t5, 0x07e007e0
michael@0 1172 li t6, 0x001F001F
michael@0 1173 li t7, 0x00ff00ff
michael@0 1174 beqz a3, 3f
michael@0 1175 nop
michael@0 1176 addiu t1, a3, -1
michael@0 1177 beqz t1, 2f
michael@0 1178 nop
michael@0 1179 1:
michael@0 1180 lhu t0, 0(a1) /* t0 = source (r5g6b5) */
michael@0 1181 lhu t1, 2(a1) /* t1 = source (r5g6b5) */
michael@0 1182 lbu t2, 0(a2) /* t2 = mask (a8) */
michael@0 1183 lbu t3, 1(a2) /* t3 = mask (a8) */
michael@0 1184 lhu t8, 0(a0) /* t8 = destination (r5g6b5) */
michael@0 1185 lhu t9, 2(a0) /* t9 = destination (r5g6b5) */
michael@0 1186 addiu a1, a1, 4
michael@0 1187 addiu a2, a2, 2
michael@0 1188
michael@0 1189 CONVERT_2x0565_TO_2x8888 t0, t1, s0, s1, t5, t6, s2, s3, s4, s5
michael@0 1190 CONVERT_2x0565_TO_2x8888 t8, t9, s2, s3, t5, t6, s4, s5, t0, t1
michael@0 1191 OVER_2x8888_2x8_2x8888 s0, s1, t2, t3, s2, s3, \
michael@0 1192 t0, t1, t7, s4, s5, t8, t9, s0, s1
michael@0 1193 CONVERT_2x8888_TO_2x0565 t0, t1, s0, s1, t4, t5, t6, s2, s3
michael@0 1194
michael@0 1195 sh s0, 0(a0)
michael@0 1196 sh s1, 2(a0)
michael@0 1197 addiu a3, a3, -2
michael@0 1198 addiu t1, a3, -1
michael@0 1199 bgtz t1, 1b
michael@0 1200 addiu a0, a0, 4
michael@0 1201 2:
michael@0 1202 beqz a3, 3f
michael@0 1203 nop
michael@0 1204 lhu t0, 0(a1) /* t0 = source (r5g6b5) */
michael@0 1205 lbu t1, 0(a2) /* t1 = mask (a8) */
michael@0 1206 lhu t2, 0(a0) /* t2 = destination (r5g6b5) */
michael@0 1207
michael@0 1208 CONVERT_1x0565_TO_1x8888 t0, t3, t4, t5
michael@0 1209 CONVERT_1x0565_TO_1x8888 t2, t4, t5, t6
michael@0 1210 OVER_8888_8_8888 t3, t1, t4, t0, t7, t2, t5, t6, t8
michael@0 1211 CONVERT_1x8888_TO_1x0565 t0, t3, t4, t5
michael@0 1212
michael@0 1213 sh t3, 0(a0)
michael@0 1214 3:
michael@0 1215 RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5
michael@0 1216 j ra
michael@0 1217 nop
michael@0 1218
michael@0 1219 END(pixman_composite_over_0565_8_0565_asm_mips)
michael@0 1220
michael@0 1221 LEAF_MIPS_DSPR2(pixman_composite_over_8888_8888_8888_asm_mips)
michael@0 1222 /*
michael@0 1223 * a0 - dst (a8r8g8b8)
michael@0 1224 * a1 - src (a8r8g8b8)
michael@0 1225 * a2 - mask (a8r8g8b8)
michael@0 1226 * a3 - w
michael@0 1227 */
michael@0 1228
michael@0 1229 SAVE_REGS_ON_STACK 0, s0, s1, s2
michael@0 1230 li t4, 0x00ff00ff
michael@0 1231 beqz a3, 3f
michael@0 1232 nop
michael@0 1233 addiu t1, a3, -1
michael@0 1234 beqz t1, 2f
michael@0 1235 nop
michael@0 1236 1:
michael@0 1237 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1238 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 1239 lw t2, 0(a2) /* t2 = mask (a8r8g8b8) */
michael@0 1240 lw t3, 4(a2) /* t3 = mask (a8r8g8b8) */
michael@0 1241 lw t5, 0(a0) /* t5 = destination (a8r8g8b8) */
michael@0 1242 lw t6, 4(a0) /* t6 = destination (a8r8g8b8) */
michael@0 1243 addiu a1, a1, 8
michael@0 1244 addiu a2, a2, 8
michael@0 1245 srl t2, t2, 24
michael@0 1246 srl t3, t3, 24
michael@0 1247
michael@0 1248 OVER_2x8888_2x8_2x8888 t0, t1, t2, t3, t5, t6, t7, t8, t4, t9, s0, s1, s2, t0, t1
michael@0 1249
michael@0 1250 sw t7, 0(a0)
michael@0 1251 sw t8, 4(a0)
michael@0 1252 addiu a3, a3, -2
michael@0 1253 addiu t1, a3, -1
michael@0 1254 bgtz t1, 1b
michael@0 1255 addiu a0, a0, 8
michael@0 1256 2:
michael@0 1257 beqz a3, 3f
michael@0 1258 nop
michael@0 1259 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1260 lw t1, 0(a2) /* t1 = mask (a8r8g8b8) */
michael@0 1261 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 1262 srl t1, t1, 24
michael@0 1263
michael@0 1264 OVER_8888_8_8888 t0, t1, t2, t3, t4, t5, t6, t7, t8
michael@0 1265
michael@0 1266 sw t3, 0(a0)
michael@0 1267 3:
michael@0 1268 RESTORE_REGS_FROM_STACK 0, s0, s1, s2
michael@0 1269 j ra
michael@0 1270 nop
michael@0 1271
michael@0 1272 END(pixman_composite_over_8888_8888_8888_asm_mips)
michael@0 1273
michael@0 1274 LEAF_MIPS_DSPR2(pixman_composite_over_8888_8888_asm_mips)
michael@0 1275 /*
michael@0 1276 * a0 - dst (a8r8g8b8)
michael@0 1277 * a1 - src (a8r8g8b8)
michael@0 1278 * a2 - w
michael@0 1279 */
michael@0 1280
michael@0 1281 SAVE_REGS_ON_STACK 0, s0, s1, s2
michael@0 1282 li t4, 0x00ff00ff
michael@0 1283 beqz a2, 3f
michael@0 1284 nop
michael@0 1285 addiu t1, a2, -1
michael@0 1286 beqz t1, 2f
michael@0 1287 nop
michael@0 1288 1:
michael@0 1289 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1290 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 1291 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 1292 lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */
michael@0 1293 addiu a1, a1, 8
michael@0 1294
michael@0 1295 not t5, t0
michael@0 1296 srl t5, t5, 24
michael@0 1297 not t6, t1
michael@0 1298 srl t6, t6, 24
michael@0 1299
michael@0 1300 or t7, t5, t6
michael@0 1301 beqz t7, 11f
michael@0 1302 or t8, t0, t1
michael@0 1303 beqz t8, 12f
michael@0 1304
michael@0 1305 MIPS_2xUN8x4_MUL_2xUN8 t2, t3, t5, t6, t7, t8, t4, t9, s0, s1, s2, t2, t3
michael@0 1306
michael@0 1307 addu_s.qb t0, t7, t0
michael@0 1308 addu_s.qb t1, t8, t1
michael@0 1309 11:
michael@0 1310 sw t0, 0(a0)
michael@0 1311 sw t1, 4(a0)
michael@0 1312 12:
michael@0 1313 addiu a2, a2, -2
michael@0 1314 addiu t1, a2, -1
michael@0 1315 bgtz t1, 1b
michael@0 1316 addiu a0, a0, 8
michael@0 1317 2:
michael@0 1318 beqz a2, 3f
michael@0 1319 nop
michael@0 1320
michael@0 1321 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1322 lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */
michael@0 1323 addiu a1, a1, 4
michael@0 1324
michael@0 1325 not t2, t0
michael@0 1326 srl t2, t2, 24
michael@0 1327
michael@0 1328 beqz t2, 21f
michael@0 1329 nop
michael@0 1330 beqz t0, 3f
michael@0 1331
michael@0 1332 MIPS_UN8x4_MUL_UN8 t1, t2, t3, t4, t5, t6, t7
michael@0 1333
michael@0 1334 addu_s.qb t0, t3, t0
michael@0 1335 21:
michael@0 1336 sw t0, 0(a0)
michael@0 1337
michael@0 1338 3:
michael@0 1339 RESTORE_REGS_FROM_STACK 0, s0, s1, s2
michael@0 1340 j ra
michael@0 1341 nop
michael@0 1342
michael@0 1343 END(pixman_composite_over_8888_8888_asm_mips)
michael@0 1344
michael@0 1345 LEAF_MIPS_DSPR2(pixman_composite_over_n_0565_asm_mips)
michael@0 1346 /*
michael@0 1347 * a0 - dst (r5g6b5)
michael@0 1348 * a1 - src (32bit constant)
michael@0 1349 * a2 - w
michael@0 1350 */
michael@0 1351
michael@0 1352 beqz a2, 5f
michael@0 1353 nop
michael@0 1354
michael@0 1355 not t0, a1
michael@0 1356 srl t0, t0, 24
michael@0 1357 bgtz t0, 1f
michael@0 1358 nop
michael@0 1359 CONVERT_1x8888_TO_1x0565 a1, t1, t2, t3
michael@0 1360 0:
michael@0 1361 sh t1, 0(a0)
michael@0 1362 addiu a2, a2, -1
michael@0 1363 bgtz a2, 0b
michael@0 1364 addiu a0, a0, 2
michael@0 1365 j ra
michael@0 1366 nop
michael@0 1367
michael@0 1368 1:
michael@0 1369 SAVE_REGS_ON_STACK 0, s0, s1, s2
michael@0 1370 li t4, 0x00ff00ff
michael@0 1371 li t5, 0xf800f800
michael@0 1372 li t6, 0x07e007e0
michael@0 1373 li t7, 0x001F001F
michael@0 1374 addiu t1, a2, -1
michael@0 1375 beqz t1, 3f
michael@0 1376 nop
michael@0 1377 2:
michael@0 1378 lhu t1, 0(a0) /* t1 = destination (r5g6b5) */
michael@0 1379 lhu t2, 2(a0) /* t2 = destination (r5g6b5) */
michael@0 1380
michael@0 1381 CONVERT_2x0565_TO_2x8888 t1, t2, t3, t8, t6, t7, t9, s0, s1, s2
michael@0 1382 MIPS_2xUN8x4_MUL_2xUN8 t3, t8, t0, t0, t1, t2, t4, t9, s0, s1, s2, t3, t8
michael@0 1383 addu_s.qb t1, t1, a1
michael@0 1384 addu_s.qb t2, t2, a1
michael@0 1385 CONVERT_2x8888_TO_2x0565 t1, t2, t3, t8, t5, t6, t7, s0, s1
michael@0 1386
michael@0 1387 sh t3, 0(a0)
michael@0 1388 sh t8, 2(a0)
michael@0 1389
michael@0 1390 addiu a2, a2, -2
michael@0 1391 addiu t1, a2, -1
michael@0 1392 bgtz t1, 2b
michael@0 1393 addiu a0, a0, 4
michael@0 1394 3:
michael@0 1395 beqz a2, 4f
michael@0 1396 nop
michael@0 1397
michael@0 1398 lhu t1, 0(a0) /* t1 = destination (r5g6b5) */
michael@0 1399
michael@0 1400 CONVERT_1x0565_TO_1x8888 t1, t2, s0, s1
michael@0 1401 MIPS_UN8x4_MUL_UN8 t2, t0, t1, t4, s0, s1, s2
michael@0 1402 addu_s.qb t1, t1, a1
michael@0 1403 CONVERT_1x8888_TO_1x0565 t1, t2, s0, s1
michael@0 1404
michael@0 1405 sh t2, 0(a0)
michael@0 1406
michael@0 1407 4:
michael@0 1408 RESTORE_REGS_FROM_STACK 0, s0, s1, s2
michael@0 1409 5:
michael@0 1410 j ra
michael@0 1411 nop
michael@0 1412
michael@0 1413 END(pixman_composite_over_n_0565_asm_mips)
michael@0 1414
michael@0 1415 LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_asm_mips)
michael@0 1416 /*
michael@0 1417 * a0 - dst (a8r8g8b8)
michael@0 1418 * a1 - src (32bit constant)
michael@0 1419 * a2 - w
michael@0 1420 */
michael@0 1421
michael@0 1422 beqz a2, 5f
michael@0 1423 nop
michael@0 1424
michael@0 1425 not t0, a1
michael@0 1426 srl t0, t0, 24
michael@0 1427 bgtz t0, 1f
michael@0 1428 nop
michael@0 1429 0:
michael@0 1430 sw a1, 0(a0)
michael@0 1431 addiu a2, a2, -1
michael@0 1432 bgtz a2, 0b
michael@0 1433 addiu a0, a0, 4
michael@0 1434 j ra
michael@0 1435 nop
michael@0 1436
michael@0 1437 1:
michael@0 1438 SAVE_REGS_ON_STACK 0, s0, s1, s2
michael@0 1439 li t4, 0x00ff00ff
michael@0 1440 addiu t1, a2, -1
michael@0 1441 beqz t1, 3f
michael@0 1442 nop
michael@0 1443 2:
michael@0 1444 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 1445 lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */
michael@0 1446
michael@0 1447 MIPS_2xUN8x4_MUL_2xUN8 t2, t3, t0, t0, t7, t8, t4, t9, s0, s1, s2, t2, t3
michael@0 1448
michael@0 1449 addu_s.qb t7, t7, a1
michael@0 1450 addu_s.qb t8, t8, a1
michael@0 1451
michael@0 1452 sw t7, 0(a0)
michael@0 1453 sw t8, 4(a0)
michael@0 1454
michael@0 1455 addiu a2, a2, -2
michael@0 1456 addiu t1, a2, -1
michael@0 1457 bgtz t1, 2b
michael@0 1458 addiu a0, a0, 8
michael@0 1459 3:
michael@0 1460 beqz a2, 4f
michael@0 1461 nop
michael@0 1462
michael@0 1463 lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */
michael@0 1464
michael@0 1465 MIPS_UN8x4_MUL_UN8 t1, t0, t3, t4, t5, t6, t7
michael@0 1466
michael@0 1467 addu_s.qb t3, t3, a1
michael@0 1468
michael@0 1469 sw t3, 0(a0)
michael@0 1470
michael@0 1471 4:
michael@0 1472 RESTORE_REGS_FROM_STACK 0, s0, s1, s2
michael@0 1473 5:
michael@0 1474 j ra
michael@0 1475 nop
michael@0 1476
michael@0 1477 END(pixman_composite_over_n_8888_asm_mips)
michael@0 1478
michael@0 1479 LEAF_MIPS_DSPR2(pixman_composite_add_8_8_8_asm_mips)
michael@0 1480 /*
michael@0 1481 * a0 - dst (a8)
michael@0 1482 * a1 - src (a8)
michael@0 1483 * a2 - mask (a8)
michael@0 1484 * a3 - w
michael@0 1485 */
michael@0 1486
michael@0 1487 SAVE_REGS_ON_STACK 0, v0, v1
michael@0 1488 li t9, 0x00ff00ff
michael@0 1489 beqz a3, 3f
michael@0 1490 nop
michael@0 1491
michael@0 1492 srl v0, a3, 2 /* v0 = how many multiples of 4 dst pixels */
michael@0 1493 beqz v0, 1f /* branch if less than 4 src pixels */
michael@0 1494 nop
michael@0 1495
michael@0 1496 0:
michael@0 1497 beqz v0, 1f
michael@0 1498 addiu v0, v0, -1
michael@0 1499 lbu t0, 0(a2)
michael@0 1500 lbu t1, 1(a2)
michael@0 1501 lbu t2, 2(a2)
michael@0 1502 lbu t3, 3(a2)
michael@0 1503 lbu t4, 0(a0)
michael@0 1504 lbu t5, 1(a0)
michael@0 1505 lbu t6, 2(a0)
michael@0 1506 lbu t7, 3(a0)
michael@0 1507
michael@0 1508 addiu a2, a2, 4
michael@0 1509
michael@0 1510 precr_sra.ph.w t1, t0, 0
michael@0 1511 precr_sra.ph.w t3, t2, 0
michael@0 1512 precr_sra.ph.w t5, t4, 0
michael@0 1513 precr_sra.ph.w t7, t6, 0
michael@0 1514
michael@0 1515 precr.qb.ph t0, t3, t1
michael@0 1516 precr.qb.ph t1, t7, t5
michael@0 1517
michael@0 1518 lbu t4, 0(a1)
michael@0 1519 lbu v1, 1(a1)
michael@0 1520 lbu t7, 2(a1)
michael@0 1521 lbu t8, 3(a1)
michael@0 1522
michael@0 1523 addiu a1, a1, 4
michael@0 1524
michael@0 1525 precr_sra.ph.w v1, t4, 0
michael@0 1526 precr_sra.ph.w t8, t7, 0
michael@0 1527
michael@0 1528 muleu_s.ph.qbl t2, t0, t8
michael@0 1529 muleu_s.ph.qbr t3, t0, v1
michael@0 1530 shra_r.ph t4, t2, 8
michael@0 1531 shra_r.ph t5, t3, 8
michael@0 1532 and t4, t4, t9
michael@0 1533 and t5, t5, t9
michael@0 1534 addq.ph t2, t2, t4
michael@0 1535 addq.ph t3, t3, t5
michael@0 1536 shra_r.ph t2, t2, 8
michael@0 1537 shra_r.ph t3, t3, 8
michael@0 1538 precr.qb.ph t0, t2, t3
michael@0 1539
michael@0 1540 addu_s.qb t2, t0, t1
michael@0 1541
michael@0 1542 sb t2, 0(a0)
michael@0 1543 srl t2, t2, 8
michael@0 1544 sb t2, 1(a0)
michael@0 1545 srl t2, t2, 8
michael@0 1546 sb t2, 2(a0)
michael@0 1547 srl t2, t2, 8
michael@0 1548 sb t2, 3(a0)
michael@0 1549 addiu a3, a3, -4
michael@0 1550 b 0b
michael@0 1551 addiu a0, a0, 4
michael@0 1552
michael@0 1553 1:
michael@0 1554 beqz a3, 3f
michael@0 1555 nop
michael@0 1556 2:
michael@0 1557 lbu t8, 0(a1)
michael@0 1558 lbu t0, 0(a2)
michael@0 1559 lbu t1, 0(a0)
michael@0 1560 addiu a1, a1, 1
michael@0 1561 addiu a2, a2, 1
michael@0 1562
michael@0 1563 mul t2, t0, t8
michael@0 1564 shra_r.ph t3, t2, 8
michael@0 1565 andi t3, t3, 0xff
michael@0 1566 addq.ph t2, t2, t3
michael@0 1567 shra_r.ph t2, t2, 8
michael@0 1568 andi t2, t2, 0xff
michael@0 1569
michael@0 1570 addu_s.qb t2, t2, t1
michael@0 1571 sb t2, 0(a0)
michael@0 1572 addiu a3, a3, -1
michael@0 1573 bnez a3, 2b
michael@0 1574 addiu a0, a0, 1
michael@0 1575
michael@0 1576 3:
michael@0 1577 RESTORE_REGS_FROM_STACK 0, v0, v1
michael@0 1578 j ra
michael@0 1579 nop
michael@0 1580
michael@0 1581 END(pixman_composite_add_8_8_8_asm_mips)
michael@0 1582
michael@0 1583 LEAF_MIPS_DSPR2(pixman_composite_add_n_8_8_asm_mips)
michael@0 1584 /*
michael@0 1585 * a0 - dst (a8)
michael@0 1586 * a1 - src (32bit constant)
michael@0 1587 * a2 - mask (a8)
michael@0 1588 * a3 - w
michael@0 1589 */
michael@0 1590
michael@0 1591 SAVE_REGS_ON_STACK 0, v0
michael@0 1592 li t9, 0x00ff00ff
michael@0 1593 beqz a3, 3f
michael@0 1594 nop
michael@0 1595
michael@0 1596 srl v0, a3, 2 /* v0 = how many multiples of 4 dst pixels */
michael@0 1597 beqz v0, 1f /* branch if less than 4 src pixels */
michael@0 1598 nop
michael@0 1599
michael@0 1600 srl t8, a1, 24
michael@0 1601 replv.ph t8, t8
michael@0 1602
michael@0 1603 0:
michael@0 1604 beqz v0, 1f
michael@0 1605 addiu v0, v0, -1
michael@0 1606 lbu t0, 0(a2)
michael@0 1607 lbu t1, 1(a2)
michael@0 1608 lbu t2, 2(a2)
michael@0 1609 lbu t3, 3(a2)
michael@0 1610 lbu t4, 0(a0)
michael@0 1611 lbu t5, 1(a0)
michael@0 1612 lbu t6, 2(a0)
michael@0 1613 lbu t7, 3(a0)
michael@0 1614
michael@0 1615 addiu a2, a2, 4
michael@0 1616
michael@0 1617 precr_sra.ph.w t1, t0, 0
michael@0 1618 precr_sra.ph.w t3, t2, 0
michael@0 1619 precr_sra.ph.w t5, t4, 0
michael@0 1620 precr_sra.ph.w t7, t6, 0
michael@0 1621
michael@0 1622 precr.qb.ph t0, t3, t1
michael@0 1623 precr.qb.ph t1, t7, t5
michael@0 1624
michael@0 1625 muleu_s.ph.qbl t2, t0, t8
michael@0 1626 muleu_s.ph.qbr t3, t0, t8
michael@0 1627 shra_r.ph t4, t2, 8
michael@0 1628 shra_r.ph t5, t3, 8
michael@0 1629 and t4, t4, t9
michael@0 1630 and t5, t5, t9
michael@0 1631 addq.ph t2, t2, t4
michael@0 1632 addq.ph t3, t3, t5
michael@0 1633 shra_r.ph t2, t2, 8
michael@0 1634 shra_r.ph t3, t3, 8
michael@0 1635 precr.qb.ph t0, t2, t3
michael@0 1636
michael@0 1637 addu_s.qb t2, t0, t1
michael@0 1638
michael@0 1639 sb t2, 0(a0)
michael@0 1640 srl t2, t2, 8
michael@0 1641 sb t2, 1(a0)
michael@0 1642 srl t2, t2, 8
michael@0 1643 sb t2, 2(a0)
michael@0 1644 srl t2, t2, 8
michael@0 1645 sb t2, 3(a0)
michael@0 1646 addiu a3, a3, -4
michael@0 1647 b 0b
michael@0 1648 addiu a0, a0, 4
michael@0 1649
michael@0 1650 1:
michael@0 1651 beqz a3, 3f
michael@0 1652 nop
michael@0 1653 srl t8, a1, 24
michael@0 1654 2:
michael@0 1655 lbu t0, 0(a2)
michael@0 1656 lbu t1, 0(a0)
michael@0 1657 addiu a2, a2, 1
michael@0 1658
michael@0 1659 mul t2, t0, t8
michael@0 1660 shra_r.ph t3, t2, 8
michael@0 1661 andi t3, t3, 0xff
michael@0 1662 addq.ph t2, t2, t3
michael@0 1663 shra_r.ph t2, t2, 8
michael@0 1664 andi t2, t2, 0xff
michael@0 1665
michael@0 1666 addu_s.qb t2, t2, t1
michael@0 1667 sb t2, 0(a0)
michael@0 1668 addiu a3, a3, -1
michael@0 1669 bnez a3, 2b
michael@0 1670 addiu a0, a0, 1
michael@0 1671
michael@0 1672 3:
michael@0 1673 RESTORE_REGS_FROM_STACK 0, v0
michael@0 1674 j ra
michael@0 1675 nop
michael@0 1676
michael@0 1677 END(pixman_composite_add_n_8_8_asm_mips)
michael@0 1678
michael@0 1679 LEAF_MIPS_DSPR2(pixman_composite_add_n_8_8888_asm_mips)
michael@0 1680 /*
michael@0 1681 * a0 - dst (a8r8g8b8)
michael@0 1682 * a1 - src (32bit constant)
michael@0 1683 * a2 - mask (a8)
michael@0 1684 * a3 - w
michael@0 1685 */
michael@0 1686
michael@0 1687 SAVE_REGS_ON_STACK 0, s0, s1, s2
michael@0 1688 li t4, 0x00ff00ff
michael@0 1689 beqz a3, 3f
michael@0 1690 nop
michael@0 1691 addiu t1, a3, -1
michael@0 1692 beqz t1, 2f
michael@0 1693 nop
michael@0 1694 1:
michael@0 1695 /* a1 = source (32bit constant) */
michael@0 1696 lbu t0, 0(a2) /* t0 = mask (a8) */
michael@0 1697 lbu t1, 1(a2) /* t1 = mask (a8) */
michael@0 1698 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 1699 lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */
michael@0 1700 addiu a2, a2, 2
michael@0 1701
michael@0 1702 MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 a1, a1, \
michael@0 1703 t0, t1, \
michael@0 1704 t2, t3, \
michael@0 1705 t5, t6, \
michael@0 1706 t4, t7, t8, t9, s0, s1, s2
michael@0 1707
michael@0 1708 sw t5, 0(a0)
michael@0 1709 sw t6, 4(a0)
michael@0 1710 addiu a3, a3, -2
michael@0 1711 addiu t1, a3, -1
michael@0 1712 bgtz t1, 1b
michael@0 1713 addiu a0, a0, 8
michael@0 1714 2:
michael@0 1715 beqz a3, 3f
michael@0 1716 nop
michael@0 1717 /* a1 = source (32bit constant) */
michael@0 1718 lbu t0, 0(a2) /* t0 = mask (a8) */
michael@0 1719 lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */
michael@0 1720
michael@0 1721 MIPS_UN8x4_MUL_UN8_ADD_UN8x4 a1, t0, t1, t2, t4, t3, t5, t6
michael@0 1722
michael@0 1723 sw t2, 0(a0)
michael@0 1724 3:
michael@0 1725 RESTORE_REGS_FROM_STACK 0, s0, s1, s2
michael@0 1726 j ra
michael@0 1727 nop
michael@0 1728
michael@0 1729 END(pixman_composite_add_n_8_8888_asm_mips)
michael@0 1730
michael@0 1731 LEAF_MIPS_DSPR2(pixman_composite_add_0565_8_0565_asm_mips)
michael@0 1732 /*
michael@0 1733 * a0 - dst (r5g6b5)
michael@0 1734 * a1 - src (r5g6b5)
michael@0 1735 * a2 - mask (a8)
michael@0 1736 * a3 - w
michael@0 1737 */
michael@0 1738
michael@0 1739 SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 1740 li t4, 0xf800f800
michael@0 1741 li t5, 0x07e007e0
michael@0 1742 li t6, 0x001F001F
michael@0 1743 li t7, 0x00ff00ff
michael@0 1744 beqz a3, 3f
michael@0 1745 nop
michael@0 1746 addiu t1, a3, -1
michael@0 1747 beqz t1, 2f
michael@0 1748 nop
michael@0 1749 1:
michael@0 1750 lhu t0, 0(a1) /* t0 = source (r5g6b5) */
michael@0 1751 lhu t1, 2(a1) /* t1 = source (r5g6b5) */
michael@0 1752 lbu t2, 0(a2) /* t2 = mask (a8) */
michael@0 1753 lbu t3, 1(a2) /* t3 = mask (a8) */
michael@0 1754 lhu t8, 0(a0) /* t8 = destination (r5g6b5) */
michael@0 1755 lhu t9, 2(a0) /* t9 = destination (r5g6b5) */
michael@0 1756 addiu a1, a1, 4
michael@0 1757 addiu a2, a2, 2
michael@0 1758
michael@0 1759 CONVERT_2x0565_TO_2x8888 t0, t1, s0, s1, t5, t6, s2, s3, s4, s5
michael@0 1760 CONVERT_2x0565_TO_2x8888 t8, t9, s2, s3, t5, t6, s4, s5, s6, s7
michael@0 1761 MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 s0, s1, \
michael@0 1762 t2, t3, \
michael@0 1763 s2, s3, \
michael@0 1764 t0, t1, \
michael@0 1765 t7, s4, s5, s6, s7, t8, t9
michael@0 1766 CONVERT_2x8888_TO_2x0565 t0, t1, s0, s1, t4, t5, t6, s2, s3
michael@0 1767
michael@0 1768 sh s0, 0(a0)
michael@0 1769 sh s1, 2(a0)
michael@0 1770 addiu a3, a3, -2
michael@0 1771 addiu t1, a3, -1
michael@0 1772 bgtz t1, 1b
michael@0 1773 addiu a0, a0, 4
michael@0 1774 2:
michael@0 1775 beqz a3, 3f
michael@0 1776 nop
michael@0 1777 lhu t0, 0(a1) /* t0 = source (r5g6b5) */
michael@0 1778 lbu t1, 0(a2) /* t1 = mask (a8) */
michael@0 1779 lhu t2, 0(a0) /* t2 = destination (r5g6b5) */
michael@0 1780
michael@0 1781 CONVERT_1x0565_TO_1x8888 t0, t3, t4, t5
michael@0 1782 CONVERT_1x0565_TO_1x8888 t2, t4, t5, t6
michael@0 1783 MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t3, t1, t4, t0, t7, t2, t5, t6
michael@0 1784 CONVERT_1x8888_TO_1x0565 t0, t3, t4, t5
michael@0 1785
michael@0 1786 sh t3, 0(a0)
michael@0 1787 3:
michael@0 1788 RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 1789 j ra
michael@0 1790 nop
michael@0 1791
michael@0 1792 END(pixman_composite_add_0565_8_0565_asm_mips)
michael@0 1793
michael@0 1794 LEAF_MIPS_DSPR2(pixman_composite_add_8888_8_8888_asm_mips)
michael@0 1795 /*
michael@0 1796 * a0 - dst (a8r8g8b8)
michael@0 1797 * a1 - src (a8r8g8b8)
michael@0 1798 * a2 - mask (a8)
michael@0 1799 * a3 - w
michael@0 1800 */
michael@0 1801
michael@0 1802 SAVE_REGS_ON_STACK 0, s0, s1, s2
michael@0 1803 li t4, 0x00ff00ff
michael@0 1804 beqz a3, 3f
michael@0 1805 nop
michael@0 1806 addiu t1, a3, -1
michael@0 1807 beqz t1, 2f
michael@0 1808 nop
michael@0 1809 1:
michael@0 1810 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1811 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 1812 lbu t2, 0(a2) /* t2 = mask (a8) */
michael@0 1813 lbu t3, 1(a2) /* t3 = mask (a8) */
michael@0 1814 lw t5, 0(a0) /* t5 = destination (a8r8g8b8) */
michael@0 1815 lw t6, 4(a0) /* t6 = destination (a8r8g8b8) */
michael@0 1816 addiu a1, a1, 8
michael@0 1817 addiu a2, a2, 2
michael@0 1818
michael@0 1819 MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 t0, t1, \
michael@0 1820 t2, t3, \
michael@0 1821 t5, t6, \
michael@0 1822 t7, t8, \
michael@0 1823 t4, t9, s0, s1, s2, t0, t1
michael@0 1824
michael@0 1825 sw t7, 0(a0)
michael@0 1826 sw t8, 4(a0)
michael@0 1827 addiu a3, a3, -2
michael@0 1828 addiu t1, a3, -1
michael@0 1829 bgtz t1, 1b
michael@0 1830 addiu a0, a0, 8
michael@0 1831 2:
michael@0 1832 beqz a3, 3f
michael@0 1833 nop
michael@0 1834 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1835 lbu t1, 0(a2) /* t1 = mask (a8) */
michael@0 1836 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 1837
michael@0 1838 MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t0, t1, t2, t3, t4, t5, t6, t7
michael@0 1839
michael@0 1840 sw t3, 0(a0)
michael@0 1841 3:
michael@0 1842 RESTORE_REGS_FROM_STACK 0, s0, s1, s2
michael@0 1843 j ra
michael@0 1844 nop
michael@0 1845
michael@0 1846 END(pixman_composite_add_8888_8_8888_asm_mips)
michael@0 1847
michael@0 1848 LEAF_MIPS_DSPR2(pixman_composite_add_8888_n_8888_asm_mips)
michael@0 1849 /*
michael@0 1850 * a0 - dst (a8r8g8b8)
michael@0 1851 * a1 - src (a8r8g8b8)
michael@0 1852 * a2 - mask (32bit constant)
michael@0 1853 * a3 - w
michael@0 1854 */
michael@0 1855
michael@0 1856 SAVE_REGS_ON_STACK 0, s0, s1, s2
michael@0 1857 li t4, 0x00ff00ff
michael@0 1858 beqz a3, 3f
michael@0 1859 nop
michael@0 1860 srl a2, a2, 24
michael@0 1861 addiu t1, a3, -1
michael@0 1862 beqz t1, 2f
michael@0 1863 nop
michael@0 1864 1:
michael@0 1865 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1866 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 1867 /* a2 = mask (32bit constant) */
michael@0 1868 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 1869 lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */
michael@0 1870 addiu a1, a1, 8
michael@0 1871
michael@0 1872 MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 t0, t1, \
michael@0 1873 a2, a2, \
michael@0 1874 t2, t3, \
michael@0 1875 t5, t6, \
michael@0 1876 t4, t7, t8, t9, s0, s1, s2
michael@0 1877
michael@0 1878 sw t5, 0(a0)
michael@0 1879 sw t6, 4(a0)
michael@0 1880 addiu a3, a3, -2
michael@0 1881 addiu t1, a3, -1
michael@0 1882 bgtz t1, 1b
michael@0 1883 addiu a0, a0, 8
michael@0 1884 2:
michael@0 1885 beqz a3, 3f
michael@0 1886 nop
michael@0 1887 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1888 /* a2 = mask (32bit constant) */
michael@0 1889 lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */
michael@0 1890
michael@0 1891 MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t0, a2, t1, t3, t4, t5, t6, t7
michael@0 1892
michael@0 1893 sw t3, 0(a0)
michael@0 1894 3:
michael@0 1895 RESTORE_REGS_FROM_STACK 0, s0, s1, s2
michael@0 1896 j ra
michael@0 1897 nop
michael@0 1898
michael@0 1899 END(pixman_composite_add_8888_n_8888_asm_mips)
michael@0 1900
michael@0 1901 LEAF_MIPS_DSPR2(pixman_composite_add_8888_8888_8888_asm_mips)
michael@0 1902 /*
michael@0 1903 * a0 - dst (a8r8g8b8)
michael@0 1904 * a1 - src (a8r8g8b8)
michael@0 1905 * a2 - mask (a8r8g8b8)
michael@0 1906 * a3 - w
michael@0 1907 */
michael@0 1908
michael@0 1909 SAVE_REGS_ON_STACK 0, s0, s1, s2
michael@0 1910 li t4, 0x00ff00ff
michael@0 1911 beqz a3, 3f
michael@0 1912 nop
michael@0 1913 addiu t1, a3, -1
michael@0 1914 beqz t1, 2f
michael@0 1915 nop
michael@0 1916 1:
michael@0 1917 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1918 lw t1, 4(a1) /* t1 = source (a8r8g8b8) */
michael@0 1919 lw t2, 0(a2) /* t2 = mask (a8r8g8b8) */
michael@0 1920 lw t3, 4(a2) /* t3 = mask (a8r8g8b8) */
michael@0 1921 lw t5, 0(a0) /* t5 = destination (a8r8g8b8) */
michael@0 1922 lw t6, 4(a0) /* t6 = destination (a8r8g8b8) */
michael@0 1923 addiu a1, a1, 8
michael@0 1924 addiu a2, a2, 8
michael@0 1925 srl t2, t2, 24
michael@0 1926 srl t3, t3, 24
michael@0 1927
michael@0 1928 MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 t0, t1, \
michael@0 1929 t2, t3, \
michael@0 1930 t5, t6, \
michael@0 1931 t7, t8, \
michael@0 1932 t4, t9, s0, s1, s2, t0, t1
michael@0 1933
michael@0 1934 sw t7, 0(a0)
michael@0 1935 sw t8, 4(a0)
michael@0 1936 addiu a3, a3, -2
michael@0 1937 addiu t1, a3, -1
michael@0 1938 bgtz t1, 1b
michael@0 1939 addiu a0, a0, 8
michael@0 1940 2:
michael@0 1941 beqz a3, 3f
michael@0 1942 nop
michael@0 1943 lw t0, 0(a1) /* t0 = source (a8r8g8b8) */
michael@0 1944 lw t1, 0(a2) /* t1 = mask (a8r8g8b8) */
michael@0 1945 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 1946 srl t1, t1, 24
michael@0 1947
michael@0 1948 MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t0, t1, t2, t3, t4, t5, t6, t7
michael@0 1949
michael@0 1950 sw t3, 0(a0)
michael@0 1951 3:
michael@0 1952 RESTORE_REGS_FROM_STACK 0, s0, s1, s2
michael@0 1953 j ra
michael@0 1954 nop
michael@0 1955
michael@0 1956 END(pixman_composite_add_8888_8888_8888_asm_mips)
michael@0 1957
michael@0 1958 LEAF_MIPS_DSPR2(pixman_composite_add_8_8_asm_mips)
michael@0 1959 /*
michael@0 1960 * a0 - dst (a8)
michael@0 1961 * a1 - src (a8)
michael@0 1962 * a2 - w
michael@0 1963 */
michael@0 1964
michael@0 1965 beqz a2, 3f
michael@0 1966 nop
michael@0 1967 srl t9, a2, 2 /* t9 = how many multiples of 4 dst pixels */
michael@0 1968 beqz t9, 1f /* branch if less than 4 src pixels */
michael@0 1969 nop
michael@0 1970
michael@0 1971 0:
michael@0 1972 beqz t9, 1f
michael@0 1973 addiu t9, t9, -1
michael@0 1974 lbu t0, 0(a1)
michael@0 1975 lbu t1, 1(a1)
michael@0 1976 lbu t2, 2(a1)
michael@0 1977 lbu t3, 3(a1)
michael@0 1978 lbu t4, 0(a0)
michael@0 1979 lbu t5, 1(a0)
michael@0 1980 lbu t6, 2(a0)
michael@0 1981 lbu t7, 3(a0)
michael@0 1982
michael@0 1983 addiu a1, a1, 4
michael@0 1984
michael@0 1985 precr_sra.ph.w t1, t0, 0
michael@0 1986 precr_sra.ph.w t3, t2, 0
michael@0 1987 precr_sra.ph.w t5, t4, 0
michael@0 1988 precr_sra.ph.w t7, t6, 0
michael@0 1989
michael@0 1990 precr.qb.ph t0, t3, t1
michael@0 1991 precr.qb.ph t1, t7, t5
michael@0 1992
michael@0 1993 addu_s.qb t2, t0, t1
michael@0 1994
michael@0 1995 sb t2, 0(a0)
michael@0 1996 srl t2, t2, 8
michael@0 1997 sb t2, 1(a0)
michael@0 1998 srl t2, t2, 8
michael@0 1999 sb t2, 2(a0)
michael@0 2000 srl t2, t2, 8
michael@0 2001 sb t2, 3(a0)
michael@0 2002 addiu a2, a2, -4
michael@0 2003 b 0b
michael@0 2004 addiu a0, a0, 4
michael@0 2005
michael@0 2006 1:
michael@0 2007 beqz a2, 3f
michael@0 2008 nop
michael@0 2009 2:
michael@0 2010 lbu t0, 0(a1)
michael@0 2011 lbu t1, 0(a0)
michael@0 2012 addiu a1, a1, 1
michael@0 2013
michael@0 2014 addu_s.qb t2, t0, t1
michael@0 2015 sb t2, 0(a0)
michael@0 2016 addiu a2, a2, -1
michael@0 2017 bnez a2, 2b
michael@0 2018 addiu a0, a0, 1
michael@0 2019
michael@0 2020 3:
michael@0 2021 j ra
michael@0 2022 nop
michael@0 2023
michael@0 2024 END(pixman_composite_add_8_8_asm_mips)
michael@0 2025
michael@0 2026 LEAF_MIPS_DSPR2(pixman_composite_add_8888_8888_asm_mips)
michael@0 2027 /*
michael@0 2028 * a0 - dst (a8r8g8b8)
michael@0 2029 * a1 - src (a8r8g8b8)
michael@0 2030 * a2 - w
michael@0 2031 */
michael@0 2032
michael@0 2033 beqz a2, 4f
michael@0 2034 nop
michael@0 2035
michael@0 2036 srl t9, a2, 2 /* t1 = how many multiples of 4 src pixels */
michael@0 2037 beqz t9, 3f /* branch if less than 4 src pixels */
michael@0 2038 nop
michael@0 2039 1:
michael@0 2040 addiu t9, t9, -1
michael@0 2041 beqz t9, 2f
michael@0 2042 addiu a2, a2, -4
michael@0 2043
michael@0 2044 lw t0, 0(a1)
michael@0 2045 lw t1, 4(a1)
michael@0 2046 lw t2, 8(a1)
michael@0 2047 lw t3, 12(a1)
michael@0 2048 lw t4, 0(a0)
michael@0 2049 lw t5, 4(a0)
michael@0 2050 lw t6, 8(a0)
michael@0 2051 lw t7, 12(a0)
michael@0 2052 addiu a1, a1, 16
michael@0 2053
michael@0 2054 addu_s.qb t4, t4, t0
michael@0 2055 addu_s.qb t5, t5, t1
michael@0 2056 addu_s.qb t6, t6, t2
michael@0 2057 addu_s.qb t7, t7, t3
michael@0 2058
michael@0 2059 sw t4, 0(a0)
michael@0 2060 sw t5, 4(a0)
michael@0 2061 sw t6, 8(a0)
michael@0 2062 sw t7, 12(a0)
michael@0 2063 b 1b
michael@0 2064 addiu a0, a0, 16
michael@0 2065 2:
michael@0 2066 lw t0, 0(a1)
michael@0 2067 lw t1, 4(a1)
michael@0 2068 lw t2, 8(a1)
michael@0 2069 lw t3, 12(a1)
michael@0 2070 lw t4, 0(a0)
michael@0 2071 lw t5, 4(a0)
michael@0 2072 lw t6, 8(a0)
michael@0 2073 lw t7, 12(a0)
michael@0 2074 addiu a1, a1, 16
michael@0 2075
michael@0 2076 addu_s.qb t4, t4, t0
michael@0 2077 addu_s.qb t5, t5, t1
michael@0 2078 addu_s.qb t6, t6, t2
michael@0 2079 addu_s.qb t7, t7, t3
michael@0 2080
michael@0 2081 sw t4, 0(a0)
michael@0 2082 sw t5, 4(a0)
michael@0 2083 sw t6, 8(a0)
michael@0 2084 sw t7, 12(a0)
michael@0 2085
michael@0 2086 beqz a2, 4f
michael@0 2087 addiu a0, a0, 16
michael@0 2088 3:
michael@0 2089 lw t0, 0(a1)
michael@0 2090 lw t1, 0(a0)
michael@0 2091 addiu a1, a1, 4
michael@0 2092 addiu a2, a2, -1
michael@0 2093 addu_s.qb t1, t1, t0
michael@0 2094 sw t1, 0(a0)
michael@0 2095 bnez a2, 3b
michael@0 2096 addiu a0, a0, 4
michael@0 2097 4:
michael@0 2098 jr ra
michael@0 2099 nop
michael@0 2100
michael@0 2101 END(pixman_composite_add_8888_8888_asm_mips)
michael@0 2102
michael@0 2103 LEAF_MIPS_DSPR2(pixman_composite_out_reverse_8_0565_asm_mips)
michael@0 2104 /*
michael@0 2105 * a0 - dst (r5g6b5)
michael@0 2106 * a1 - src (a8)
michael@0 2107 * a2 - w
michael@0 2108 */
michael@0 2109
michael@0 2110 beqz a2, 4f
michael@0 2111 nop
michael@0 2112
michael@0 2113 SAVE_REGS_ON_STACK 0, s0, s1, s2, s3
michael@0 2114 li t2, 0xf800f800
michael@0 2115 li t3, 0x07e007e0
michael@0 2116 li t4, 0x001F001F
michael@0 2117 li t5, 0x00ff00ff
michael@0 2118
michael@0 2119 addiu t1, a2, -1
michael@0 2120 beqz t1, 2f
michael@0 2121 nop
michael@0 2122 1:
michael@0 2123 lbu t0, 0(a1) /* t0 = source (a8) */
michael@0 2124 lbu t1, 1(a1) /* t1 = source (a8) */
michael@0 2125 lhu t6, 0(a0) /* t6 = destination (r5g6b5) */
michael@0 2126 lhu t7, 2(a0) /* t7 = destination (r5g6b5) */
michael@0 2127 addiu a1, a1, 2
michael@0 2128
michael@0 2129 not t0, t0
michael@0 2130 not t1, t1
michael@0 2131 andi t0, 0xff /* t0 = neg source1 */
michael@0 2132 andi t1, 0xff /* t1 = neg source2 */
michael@0 2133 CONVERT_2x0565_TO_2x8888 t6, t7, t8, t9, t3, t4, s0, s1, s2, s3
michael@0 2134 MIPS_2xUN8x4_MUL_2xUN8 t8, t9, t0, t1, t6, t7, t5, s0, s1, s2, s3, t8, t9
michael@0 2135 CONVERT_2x8888_TO_2x0565 t6, t7, t8, t9, t2, t3, t4, s0, s1
michael@0 2136
michael@0 2137 sh t8, 0(a0)
michael@0 2138 sh t9, 2(a0)
michael@0 2139 addiu a2, a2, -2
michael@0 2140 addiu t1, a2, -1
michael@0 2141 bgtz t1, 1b
michael@0 2142 addiu a0, a0, 4
michael@0 2143 2:
michael@0 2144 beqz a2, 3f
michael@0 2145 nop
michael@0 2146 lbu t0, 0(a1) /* t0 = source (a8) */
michael@0 2147 lhu t1, 0(a0) /* t1 = destination (r5g6b5) */
michael@0 2148
michael@0 2149 not t0, t0
michael@0 2150 andi t0, 0xff /* t0 = neg source */
michael@0 2151 CONVERT_1x0565_TO_1x8888 t1, t2, t3, t4
michael@0 2152 MIPS_UN8x4_MUL_UN8 t2, t0, t1, t5, t3, t4, t6
michael@0 2153 CONVERT_1x8888_TO_1x0565 t1, t2, t3, t4
michael@0 2154
michael@0 2155 sh t2, 0(a0)
michael@0 2156 3:
michael@0 2157 RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3
michael@0 2158 4:
michael@0 2159 j ra
michael@0 2160 nop
michael@0 2161
michael@0 2162 END(pixman_composite_out_reverse_8_0565_asm_mips)
michael@0 2163
michael@0 2164 LEAF_MIPS_DSPR2(pixman_composite_out_reverse_8_8888_asm_mips)
michael@0 2165 /*
michael@0 2166 * a0 - dst (a8r8g8b8)
michael@0 2167 * a1 - src (a8)
michael@0 2168 * a2 - w
michael@0 2169 */
michael@0 2170
michael@0 2171 beqz a2, 3f
michael@0 2172 nop
michael@0 2173 li t4, 0x00ff00ff
michael@0 2174 addiu t1, a2, -1
michael@0 2175 beqz t1, 2f
michael@0 2176 nop
michael@0 2177 1:
michael@0 2178 lbu t0, 0(a1) /* t0 = source (a8) */
michael@0 2179 lbu t1, 1(a1) /* t1 = source (a8) */
michael@0 2180 lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */
michael@0 2181 lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */
michael@0 2182 addiu a1, a1, 2
michael@0 2183 not t0, t0
michael@0 2184 not t1, t1
michael@0 2185 andi t0, 0xff /* t0 = neg source */
michael@0 2186 andi t1, 0xff /* t1 = neg source */
michael@0 2187
michael@0 2188 MIPS_2xUN8x4_MUL_2xUN8 t2, t3, t0, t1, t5, t6, t4, t7, t8, t9, t2, t3, t0
michael@0 2189
michael@0 2190 sw t5, 0(a0)
michael@0 2191 sw t6, 4(a0)
michael@0 2192 addiu a2, a2, -2
michael@0 2193 addiu t1, a2, -1
michael@0 2194 bgtz t1, 1b
michael@0 2195 addiu a0, a0, 8
michael@0 2196 2:
michael@0 2197 beqz a2, 3f
michael@0 2198 nop
michael@0 2199 lbu t0, 0(a1) /* t0 = source (a8) */
michael@0 2200 lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */
michael@0 2201 not t0, t0
michael@0 2202 andi t0, 0xff /* t0 = neg source */
michael@0 2203
michael@0 2204 MIPS_UN8x4_MUL_UN8 t1, t0, t2, t4, t3, t5, t6
michael@0 2205
michael@0 2206 sw t2, 0(a0)
michael@0 2207 3:
michael@0 2208 j ra
michael@0 2209 nop
michael@0 2210
michael@0 2211 END(pixman_composite_out_reverse_8_8888_asm_mips)
michael@0 2212
michael@0 2213 LEAF_MIPS_DSPR2(pixman_composite_over_reverse_n_8888_asm_mips)
michael@0 2214 /*
michael@0 2215 * a0 - dst (a8r8g8b8)
michael@0 2216 * a1 - src (32bit constant)
michael@0 2217 * a2 - w
michael@0 2218 */
michael@0 2219
michael@0 2220 beqz a2, 5f
michael@0 2221 nop
michael@0 2222
michael@0 2223 SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2224 li t0, 0x00ff00ff
michael@0 2225 srl t9, a2, 2 /* t9 = how many multiples of 4 src pixels */
michael@0 2226 beqz t9, 2f /* branch if less than 4 src pixels */
michael@0 2227 nop
michael@0 2228 1:
michael@0 2229 beqz t9, 2f
michael@0 2230 addiu t9, t9, -1
michael@0 2231
michael@0 2232 lw t1, 0(a0)
michael@0 2233 lw t2, 4(a0)
michael@0 2234 lw t3, 8(a0)
michael@0 2235 lw t4, 12(a0)
michael@0 2236
michael@0 2237 addiu a2, a2, -4
michael@0 2238
michael@0 2239 not t5, t1
michael@0 2240 not t6, t2
michael@0 2241 not t7, t3
michael@0 2242 not t8, t4
michael@0 2243 srl t5, t5, 24
michael@0 2244 srl t6, t6, 24
michael@0 2245 srl t7, t7, 24
michael@0 2246 srl t8, t8, 24
michael@0 2247 replv.ph t5, t5
michael@0 2248 replv.ph t6, t6
michael@0 2249 replv.ph t7, t7
michael@0 2250 replv.ph t8, t8
michael@0 2251 muleu_s.ph.qbl s0, a1, t5
michael@0 2252 muleu_s.ph.qbr s1, a1, t5
michael@0 2253 muleu_s.ph.qbl s2, a1, t6
michael@0 2254 muleu_s.ph.qbr s3, a1, t6
michael@0 2255 muleu_s.ph.qbl s4, a1, t7
michael@0 2256 muleu_s.ph.qbr s5, a1, t7
michael@0 2257 muleu_s.ph.qbl s6, a1, t8
michael@0 2258 muleu_s.ph.qbr s7, a1, t8
michael@0 2259
michael@0 2260 shra_r.ph t5, s0, 8
michael@0 2261 shra_r.ph t6, s1, 8
michael@0 2262 shra_r.ph t7, s2, 8
michael@0 2263 shra_r.ph t8, s3, 8
michael@0 2264 and t5, t5, t0
michael@0 2265 and t6, t6, t0
michael@0 2266 and t7, t7, t0
michael@0 2267 and t8, t8, t0
michael@0 2268 addq.ph s0, s0, t5
michael@0 2269 addq.ph s1, s1, t6
michael@0 2270 addq.ph s2, s2, t7
michael@0 2271 addq.ph s3, s3, t8
michael@0 2272 shra_r.ph s0, s0, 8
michael@0 2273 shra_r.ph s1, s1, 8
michael@0 2274 shra_r.ph s2, s2, 8
michael@0 2275 shra_r.ph s3, s3, 8
michael@0 2276 shra_r.ph t5, s4, 8
michael@0 2277 shra_r.ph t6, s5, 8
michael@0 2278 shra_r.ph t7, s6, 8
michael@0 2279 shra_r.ph t8, s7, 8
michael@0 2280 and t5, t5, t0
michael@0 2281 and t6, t6, t0
michael@0 2282 and t7, t7, t0
michael@0 2283 and t8, t8, t0
michael@0 2284 addq.ph s4, s4, t5
michael@0 2285 addq.ph s5, s5, t6
michael@0 2286 addq.ph s6, s6, t7
michael@0 2287 addq.ph s7, s7, t8
michael@0 2288 shra_r.ph s4, s4, 8
michael@0 2289 shra_r.ph s5, s5, 8
michael@0 2290 shra_r.ph s6, s6, 8
michael@0 2291 shra_r.ph s7, s7, 8
michael@0 2292
michael@0 2293 precr.qb.ph t5, s0, s1
michael@0 2294 precr.qb.ph t6, s2, s3
michael@0 2295 precr.qb.ph t7, s4, s5
michael@0 2296 precr.qb.ph t8, s6, s7
michael@0 2297 addu_s.qb t5, t1, t5
michael@0 2298 addu_s.qb t6, t2, t6
michael@0 2299 addu_s.qb t7, t3, t7
michael@0 2300 addu_s.qb t8, t4, t8
michael@0 2301
michael@0 2302 sw t5, 0(a0)
michael@0 2303 sw t6, 4(a0)
michael@0 2304 sw t7, 8(a0)
michael@0 2305 sw t8, 12(a0)
michael@0 2306 b 1b
michael@0 2307 addiu a0, a0, 16
michael@0 2308
michael@0 2309 2:
michael@0 2310 beqz a2, 4f
michael@0 2311 nop
michael@0 2312 3:
michael@0 2313 lw t1, 0(a0)
michael@0 2314
michael@0 2315 not t2, t1
michael@0 2316 srl t2, t2, 24
michael@0 2317 replv.ph t2, t2
michael@0 2318
michael@0 2319 muleu_s.ph.qbl t4, a1, t2
michael@0 2320 muleu_s.ph.qbr t5, a1, t2
michael@0 2321 shra_r.ph t6, t4, 8
michael@0 2322 shra_r.ph t7, t5, 8
michael@0 2323
michael@0 2324 and t6,t6,t0
michael@0 2325 and t7,t7,t0
michael@0 2326
michael@0 2327 addq.ph t8, t4, t6
michael@0 2328 addq.ph t9, t5, t7
michael@0 2329
michael@0 2330 shra_r.ph t8, t8, 8
michael@0 2331 shra_r.ph t9, t9, 8
michael@0 2332
michael@0 2333 precr.qb.ph t9, t8, t9
michael@0 2334
michael@0 2335 addu_s.qb t9, t1, t9
michael@0 2336 sw t9, 0(a0)
michael@0 2337
michael@0 2338 addiu a2, a2, -1
michael@0 2339 bnez a2, 3b
michael@0 2340 addiu a0, a0, 4
michael@0 2341 4:
michael@0 2342 RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2343 5:
michael@0 2344 j ra
michael@0 2345 nop
michael@0 2346
michael@0 2347 END(pixman_composite_over_reverse_n_8888_asm_mips)
michael@0 2348
michael@0 2349 LEAF_MIPS_DSPR2(pixman_composite_in_n_8_asm_mips)
michael@0 2350 /*
michael@0 2351 * a0 - dst (a8)
michael@0 2352 * a1 - src (a8r8g8b8)
michael@0 2353 * a2 - w
michael@0 2354 */
michael@0 2355
michael@0 2356 beqz a2, 5f
michael@0 2357 nop
michael@0 2358
michael@0 2359 SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2360 move t7, a1
michael@0 2361 srl t5, t7, 24
michael@0 2362 replv.ph t5, t5
michael@0 2363 srl t9, a2, 2 /* t1 = how many multiples of 4 src pixels */
michael@0 2364 beqz t9, 2f /* branch if less than 4 src pixels */
michael@0 2365 nop
michael@0 2366
michael@0 2367 1:
michael@0 2368 addiu t9, t9, -1
michael@0 2369 addiu a2, a2, -4
michael@0 2370 lbu t0, 0(a0)
michael@0 2371 lbu t1, 1(a0)
michael@0 2372 lbu t2, 2(a0)
michael@0 2373 lbu t3, 3(a0)
michael@0 2374
michael@0 2375 muleu_s.ph.qbl s0, t0, t5
michael@0 2376 muleu_s.ph.qbr s1, t0, t5
michael@0 2377 muleu_s.ph.qbl s2, t1, t5
michael@0 2378 muleu_s.ph.qbr s3, t1, t5
michael@0 2379 muleu_s.ph.qbl s4, t2, t5
michael@0 2380 muleu_s.ph.qbr s5, t2, t5
michael@0 2381 muleu_s.ph.qbl s6, t3, t5
michael@0 2382 muleu_s.ph.qbr s7, t3, t5
michael@0 2383
michael@0 2384 shrl.ph t4, s0, 8
michael@0 2385 shrl.ph t6, s1, 8
michael@0 2386 shrl.ph t7, s2, 8
michael@0 2387 shrl.ph t8, s3, 8
michael@0 2388 addq.ph t0, s0, t4
michael@0 2389 addq.ph t1, s1, t6
michael@0 2390 addq.ph t2, s2, t7
michael@0 2391 addq.ph t3, s3, t8
michael@0 2392 shra_r.ph t0, t0, 8
michael@0 2393 shra_r.ph t1, t1, 8
michael@0 2394 shra_r.ph t2, t2, 8
michael@0 2395 shra_r.ph t3, t3, 8
michael@0 2396 shrl.ph t4, s4, 8
michael@0 2397 shrl.ph t6, s5, 8
michael@0 2398 shrl.ph t7, s6, 8
michael@0 2399 shrl.ph t8, s7, 8
michael@0 2400 addq.ph s0, s4, t4
michael@0 2401 addq.ph s1, s5, t6
michael@0 2402 addq.ph s2, s6, t7
michael@0 2403 addq.ph s3, s7, t8
michael@0 2404 shra_r.ph t4, s0, 8
michael@0 2405 shra_r.ph t6, s1, 8
michael@0 2406 shra_r.ph t7, s2, 8
michael@0 2407 shra_r.ph t8, s3, 8
michael@0 2408
michael@0 2409 precr.qb.ph s0, t0, t1
michael@0 2410 precr.qb.ph s1, t2, t3
michael@0 2411 precr.qb.ph s2, t4, t6
michael@0 2412 precr.qb.ph s3, t7, t8
michael@0 2413
michael@0 2414 sb s0, 0(a0)
michael@0 2415 sb s1, 1(a0)
michael@0 2416 sb s2, 2(a0)
michael@0 2417 sb s3, 3(a0)
michael@0 2418 bgtz t9, 1b
michael@0 2419 addiu a0, a0, 4
michael@0 2420 2:
michael@0 2421 beqz a2, 4f
michael@0 2422 nop
michael@0 2423 3:
michael@0 2424 lbu t1, 0(a0)
michael@0 2425
michael@0 2426 muleu_s.ph.qbl t4, t1, t5
michael@0 2427 muleu_s.ph.qbr t7, t1, t5
michael@0 2428 shrl.ph t6, t4, 8
michael@0 2429 shrl.ph t0, t7, 8
michael@0 2430 addq.ph t8, t4, t6
michael@0 2431 addq.ph t9, t7, t0
michael@0 2432 shra_r.ph t8, t8, 8
michael@0 2433 shra_r.ph t9, t9, 8
michael@0 2434 precr.qb.ph t2, t8, t9
michael@0 2435 sb t2, 0(a0)
michael@0 2436 addiu a2, a2, -1
michael@0 2437 bnez a2, 3b
michael@0 2438 addiu a0, a0, 1
michael@0 2439 4:
michael@0 2440 RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2441 5:
michael@0 2442 j ra
michael@0 2443 nop
michael@0 2444
michael@0 2445 END(pixman_composite_in_n_8_asm_mips)
michael@0 2446
michael@0 2447 LEAF_MIPS_DSPR2(pixman_scaled_nearest_scanline_8888_8_0565_OVER_asm_mips)
michael@0 2448 /*
michael@0 2449 * a0 - dst (r5g6b5)
michael@0 2450 * a1 - src (a8r8g8b8)
michael@0 2451 * a2 - mask (a8)
michael@0 2452 * a3 - w
michael@0 2453 * 16(sp) - vx
michael@0 2454 * 20(sp) - unit_x
michael@0 2455 */
michael@0 2456 beqz a3, 4f
michael@0 2457 nop
michael@0 2458
michael@0 2459 SAVE_REGS_ON_STACK 20, v0, v1, s0, s1, s2, s3, s4, s5
michael@0 2460 lw v0, 36(sp) /* v0 = vx */
michael@0 2461 lw v1, 40(sp) /* v1 = unit_x */
michael@0 2462 li t6, 0x00ff00ff
michael@0 2463 li t7, 0xf800f800
michael@0 2464 li t8, 0x07e007e0
michael@0 2465 li t9, 0x001F001F
michael@0 2466
michael@0 2467 addiu t1, a3, -1
michael@0 2468 beqz t1, 2f
michael@0 2469 nop
michael@0 2470 1:
michael@0 2471 sra t0, v0, 16 /* t0 = vx >> 16 */
michael@0 2472 sll t0, t0, 2 /* t0 = t0 * 4 (a8r8g8b8) */
michael@0 2473 addu t0, a1, t0
michael@0 2474 lw t0, 0(t0) /* t0 = source (a8r8g8b8) */
michael@0 2475 addu v0, v0, v1 /* v0 = vx + unit_x */
michael@0 2476 sra t1, v0, 16 /* t1 = vx >> 16 */
michael@0 2477 sll t1, t1, 2 /* t1 = t1 * 4 (a8r8g8b8) */
michael@0 2478 addu t1, a1, t1
michael@0 2479 lw t1, 0(t1) /* t1 = source (a8r8g8b8) */
michael@0 2480 addu v0, v0, v1 /* v0 = vx + unit_x */
michael@0 2481 lbu t2, 0(a2) /* t2 = mask (a8) */
michael@0 2482 lbu t3, 1(a2) /* t3 = mask (a8) */
michael@0 2483 lhu t4, 0(a0) /* t4 = destination (r5g6b5) */
michael@0 2484 lhu t5, 2(a0) /* t5 = destination (r5g6b5) */
michael@0 2485 addiu a2, a2, 2
michael@0 2486
michael@0 2487 CONVERT_2x0565_TO_2x8888 t4, t5, s0, s1, t8, t9, s2, s3, s4, s5
michael@0 2488 OVER_2x8888_2x8_2x8888 t0, t1, \
michael@0 2489 t2, t3, \
michael@0 2490 s0, s1, \
michael@0 2491 t4, t5, \
michael@0 2492 t6, s2, s3, s4, s5, t2, t3
michael@0 2493 CONVERT_2x8888_TO_2x0565 t4, t5, s0, s1, t7, t8, t9, s2, s3
michael@0 2494
michael@0 2495 sh s0, 0(a0)
michael@0 2496 sh s1, 2(a0)
michael@0 2497 addiu a3, a3, -2
michael@0 2498 addiu t1, a3, -1
michael@0 2499 bgtz t1, 1b
michael@0 2500 addiu a0, a0, 4
michael@0 2501 2:
michael@0 2502 beqz a3, 3f
michael@0 2503 nop
michael@0 2504 sra t0, v0, 16 /* t0 = vx >> 16 */
michael@0 2505 sll t0, t0, 2 /* t0 = t0 * 4 (a8r8g8b8) */
michael@0 2506 addu t0, a1, t0
michael@0 2507 lw t0, 0(t0) /* t0 = source (a8r8g8b8) */
michael@0 2508 lbu t1, 0(a2) /* t1 = mask (a8) */
michael@0 2509 lhu t2, 0(a0) /* t2 = destination (r5g6b5) */
michael@0 2510
michael@0 2511 CONVERT_1x0565_TO_1x8888 t2, t3, t4, t5
michael@0 2512 OVER_8888_8_8888 t0, t1, t3, t2, t6, t4, t5, t7, t8
michael@0 2513 CONVERT_1x8888_TO_1x0565 t2, t3, t4, t5
michael@0 2514
michael@0 2515 sh t3, 0(a0)
michael@0 2516 3:
michael@0 2517 RESTORE_REGS_FROM_STACK 20, v0, v1, s0, s1, s2, s3, s4, s5
michael@0 2518 4:
michael@0 2519 j ra
michael@0 2520 nop
michael@0 2521
michael@0 2522 END(pixman_scaled_nearest_scanline_8888_8_0565_OVER_asm_mips)
michael@0 2523
michael@0 2524 LEAF_MIPS_DSPR2(pixman_scaled_nearest_scanline_0565_8_0565_OVER_asm_mips)
michael@0 2525 /*
michael@0 2526 * a0 - dst (r5g6b5)
michael@0 2527 * a1 - src (r5g6b5)
michael@0 2528 * a2 - mask (a8)
michael@0 2529 * a3 - w
michael@0 2530 * 16(sp) - vx
michael@0 2531 * 20(sp) - unit_x
michael@0 2532 */
michael@0 2533
michael@0 2534 beqz a3, 4f
michael@0 2535 nop
michael@0 2536 SAVE_REGS_ON_STACK 20, v0, v1, s0, s1, s2, s3, s4, s5
michael@0 2537 lw v0, 36(sp) /* v0 = vx */
michael@0 2538 lw v1, 40(sp) /* v1 = unit_x */
michael@0 2539 li t4, 0xf800f800
michael@0 2540 li t5, 0x07e007e0
michael@0 2541 li t6, 0x001F001F
michael@0 2542 li t7, 0x00ff00ff
michael@0 2543
michael@0 2544 addiu t1, a3, -1
michael@0 2545 beqz t1, 2f
michael@0 2546 nop
michael@0 2547 1:
michael@0 2548 sra t0, v0, 16 /* t0 = vx >> 16 */
michael@0 2549 sll t0, t0, 1 /* t0 = t0 * 2 (r5g6b5) */
michael@0 2550 addu t0, a1, t0
michael@0 2551 lhu t0, 0(t0) /* t0 = source (r5g6b5) */
michael@0 2552 addu v0, v0, v1 /* v0 = vx + unit_x */
michael@0 2553 sra t1, v0, 16 /* t1 = vx >> 16 */
michael@0 2554 sll t1, t1, 1 /* t1 = t1 * 2 (r5g6b5) */
michael@0 2555 addu t1, a1, t1
michael@0 2556 lhu t1, 0(t1) /* t1 = source (r5g6b5) */
michael@0 2557 addu v0, v0, v1 /* v0 = vx + unit_x */
michael@0 2558 lbu t2, 0(a2) /* t2 = mask (a8) */
michael@0 2559 lbu t3, 1(a2) /* t3 = mask (a8) */
michael@0 2560 lhu t8, 0(a0) /* t8 = destination (r5g6b5) */
michael@0 2561 lhu t9, 2(a0) /* t9 = destination (r5g6b5) */
michael@0 2562 addiu a2, a2, 2
michael@0 2563
michael@0 2564 CONVERT_2x0565_TO_2x8888 t0, t1, s0, s1, t5, t6, s2, s3, s4, s5
michael@0 2565 CONVERT_2x0565_TO_2x8888 t8, t9, s2, s3, t5, t6, s4, s5, t0, t1
michael@0 2566 OVER_2x8888_2x8_2x8888 s0, s1, \
michael@0 2567 t2, t3, \
michael@0 2568 s2, s3, \
michael@0 2569 t0, t1, \
michael@0 2570 t7, t8, t9, s4, s5, s0, s1
michael@0 2571 CONVERT_2x8888_TO_2x0565 t0, t1, s0, s1, t4, t5, t6, s2, s3
michael@0 2572
michael@0 2573 sh s0, 0(a0)
michael@0 2574 sh s1, 2(a0)
michael@0 2575 addiu a3, a3, -2
michael@0 2576 addiu t1, a3, -1
michael@0 2577 bgtz t1, 1b
michael@0 2578 addiu a0, a0, 4
michael@0 2579 2:
michael@0 2580 beqz a3, 3f
michael@0 2581 nop
michael@0 2582 sra t0, v0, 16 /* t0 = vx >> 16 */
michael@0 2583 sll t0, t0, 1 /* t0 = t0 * 2 (r5g6b5) */
michael@0 2584 addu t0, a1, t0
michael@0 2585
michael@0 2586 lhu t0, 0(t0) /* t0 = source (r5g6b5) */
michael@0 2587 lbu t1, 0(a2) /* t1 = mask (a8) */
michael@0 2588 lhu t2, 0(a0) /* t2 = destination (r5g6b5) */
michael@0 2589
michael@0 2590 CONVERT_1x0565_TO_1x8888 t0, t3, t4, t5
michael@0 2591 CONVERT_1x0565_TO_1x8888 t2, t4, t5, t6
michael@0 2592 OVER_8888_8_8888 t3, t1, t4, t0, t7, t2, t5, t6, t8
michael@0 2593 CONVERT_1x8888_TO_1x0565 t0, t3, t4, t5
michael@0 2594
michael@0 2595 sh t3, 0(a0)
michael@0 2596 3:
michael@0 2597 RESTORE_REGS_FROM_STACK 20, v0, v1, s0, s1, s2, s3, s4, s5
michael@0 2598 4:
michael@0 2599 j ra
michael@0 2600 nop
michael@0 2601
michael@0 2602 END(pixman_scaled_nearest_scanline_0565_8_0565_OVER_asm_mips)
michael@0 2603
michael@0 2604 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8888_SRC_asm_mips)
michael@0 2605 /*
michael@0 2606 * a0 - *dst
michael@0 2607 * a1 - *src_top
michael@0 2608 * a2 - *src_bottom
michael@0 2609 * a3 - w
michael@0 2610 * 16(sp) - wt
michael@0 2611 * 20(sp) - wb
michael@0 2612 * 24(sp) - vx
michael@0 2613 * 28(sp) - unit_x
michael@0 2614 */
michael@0 2615
michael@0 2616 beqz a3, 1f
michael@0 2617 nop
michael@0 2618
michael@0 2619 SAVE_REGS_ON_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2620
michael@0 2621 lw s0, 36(sp) /* s0 = wt */
michael@0 2622 lw s1, 40(sp) /* s1 = wb */
michael@0 2623 lw s2, 44(sp) /* s2 = vx */
michael@0 2624 lw s3, 48(sp) /* s3 = unit_x */
michael@0 2625 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 2626
michael@0 2627 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2628 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2629 0:
michael@0 2630 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 2631 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 2632 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 2633
michael@0 2634 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 2635 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 2636 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 2637 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 2638
michael@0 2639 sra t9, s2, 16
michael@0 2640 sll t9, t9, 2
michael@0 2641 addiu t8, t9, 4
michael@0 2642 lwx t0, t9(a1) /* t0 = tl */
michael@0 2643 lwx t1, t8(a1) /* t1 = tr */
michael@0 2644 addiu a3, a3, -1
michael@0 2645 lwx t2, t9(a2) /* t2 = bl */
michael@0 2646 lwx t3, t8(a2) /* t3 = br */
michael@0 2647
michael@0 2648 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 2649
michael@0 2650 addu s2, s2, s3 /* vx += unit_x; */
michael@0 2651 sw t0, 0(a0)
michael@0 2652 bnez a3, 0b
michael@0 2653 addiu a0, a0, 4
michael@0 2654
michael@0 2655 RESTORE_REGS_FROM_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2656 1:
michael@0 2657 j ra
michael@0 2658 nop
michael@0 2659
michael@0 2660 END(pixman_scaled_bilinear_scanline_8888_8888_SRC_asm_mips)
michael@0 2661
michael@0 2662 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_0565_SRC_asm_mips)
michael@0 2663 /*
michael@0 2664 * a0 - *dst
michael@0 2665 * a1 - *src_top
michael@0 2666 * a2 - *src_bottom
michael@0 2667 * a3 - w
michael@0 2668 * 16(sp) - wt
michael@0 2669 * 20(sp) - wb
michael@0 2670 * 24(sp) - vx
michael@0 2671 * 28(sp) - unit_x
michael@0 2672 */
michael@0 2673
michael@0 2674 beqz a3, 1f
michael@0 2675 nop
michael@0 2676
michael@0 2677 SAVE_REGS_ON_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2678
michael@0 2679 lw s0, 36(sp) /* s0 = wt */
michael@0 2680 lw s1, 40(sp) /* s1 = wb */
michael@0 2681 lw s2, 44(sp) /* s2 = vx */
michael@0 2682 lw s3, 48(sp) /* s3 = unit_x */
michael@0 2683 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 2684
michael@0 2685 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2686 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2687 0:
michael@0 2688 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 2689 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 2690 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 2691
michael@0 2692 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 2693 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 2694 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 2695 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 2696
michael@0 2697 sra t9, s2, 16
michael@0 2698 sll t9, t9, 2
michael@0 2699 addiu t8, t9, 4
michael@0 2700 lwx t0, t9(a1) /* t0 = tl */
michael@0 2701 lwx t1, t8(a1) /* t1 = tr */
michael@0 2702 addiu a3, a3, -1
michael@0 2703 lwx t2, t9(a2) /* t2 = bl */
michael@0 2704 lwx t3, t8(a2) /* t3 = br */
michael@0 2705
michael@0 2706 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 2707 CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3
michael@0 2708
michael@0 2709 addu s2, s2, s3 /* vx += unit_x; */
michael@0 2710 sh t1, 0(a0)
michael@0 2711 bnez a3, 0b
michael@0 2712 addiu a0, a0, 2
michael@0 2713
michael@0 2714 RESTORE_REGS_FROM_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2715 1:
michael@0 2716 j ra
michael@0 2717 nop
michael@0 2718
michael@0 2719 END(pixman_scaled_bilinear_scanline_8888_0565_SRC_asm_mips)
michael@0 2720
michael@0 2721 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_0565_8888_SRC_asm_mips)
michael@0 2722 /*
michael@0 2723 * a0 - *dst
michael@0 2724 * a1 - *src_top
michael@0 2725 * a2 - *src_bottom
michael@0 2726 * a3 - w
michael@0 2727 * 16(sp) - wt
michael@0 2728 * 20(sp) - wb
michael@0 2729 * 24(sp) - vx
michael@0 2730 * 28(sp) - unit_x
michael@0 2731 */
michael@0 2732
michael@0 2733 beqz a3, 1f
michael@0 2734 nop
michael@0 2735
michael@0 2736 SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 2737
michael@0 2738 lw s0, 44(sp) /* s0 = wt */
michael@0 2739 lw s1, 48(sp) /* s1 = wb */
michael@0 2740 lw s2, 52(sp) /* s2 = vx */
michael@0 2741 lw s3, 56(sp) /* s3 = unit_x */
michael@0 2742 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 2743 li v1, 0x07e007e0
michael@0 2744 li s8, 0x001f001f
michael@0 2745
michael@0 2746 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2747 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2748 0:
michael@0 2749 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 2750 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 2751 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 2752
michael@0 2753 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 2754 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 2755 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 2756 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 2757
michael@0 2758 sra t9, s2, 16
michael@0 2759 sll t9, t9, 1
michael@0 2760 addiu t8, t9, 2
michael@0 2761 lhx t0, t9(a1) /* t0 = tl */
michael@0 2762 lhx t1, t8(a1) /* t1 = tr */
michael@0 2763 andi t1, t1, 0xffff
michael@0 2764 addiu a3, a3, -1
michael@0 2765 lhx t2, t9(a2) /* t2 = bl */
michael@0 2766 lhx t3, t8(a2) /* t3 = br */
michael@0 2767 andi t3, t3, 0xffff
michael@0 2768
michael@0 2769 CONVERT_2x0565_TO_2x8888 t0, t1, t0, t1, v1, s8, t4, t5, t6, t7
michael@0 2770 CONVERT_2x0565_TO_2x8888 t2, t3, t2, t3, v1, s8, t4, t5, t6, t7
michael@0 2771 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 2772
michael@0 2773 addu s2, s2, s3 /* vx += unit_x; */
michael@0 2774 sw t0, 0(a0)
michael@0 2775 bnez a3, 0b
michael@0 2776 addiu a0, a0, 4
michael@0 2777
michael@0 2778 RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 2779 1:
michael@0 2780 j ra
michael@0 2781 nop
michael@0 2782
michael@0 2783 END(pixman_scaled_bilinear_scanline_0565_8888_SRC_asm_mips)
michael@0 2784
michael@0 2785 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_0565_0565_SRC_asm_mips)
michael@0 2786 /*
michael@0 2787 * a0 - *dst
michael@0 2788 * a1 - *src_top
michael@0 2789 * a2 - *src_bottom
michael@0 2790 * a3 - w
michael@0 2791 * 16(sp) - wt
michael@0 2792 * 20(sp) - wb
michael@0 2793 * 24(sp) - vx
michael@0 2794 * 28(sp) - unit_x
michael@0 2795 */
michael@0 2796
michael@0 2797 beqz a3, 1f
michael@0 2798 nop
michael@0 2799
michael@0 2800 SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 2801
michael@0 2802 lw s0, 44(sp) /* s0 = wt */
michael@0 2803 lw s1, 48(sp) /* s1 = wb */
michael@0 2804 lw s2, 52(sp) /* s2 = vx */
michael@0 2805 lw s3, 56(sp) /* s3 = unit_x */
michael@0 2806 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 2807 li v1, 0x07e007e0
michael@0 2808 li s8, 0x001f001f
michael@0 2809
michael@0 2810 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2811 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2812 0:
michael@0 2813 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 2814 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 2815 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 2816
michael@0 2817 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 2818 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 2819 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 2820 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 2821
michael@0 2822 sra t9, s2, 16
michael@0 2823 sll t9, t9, 1
michael@0 2824 addiu t8, t9, 2
michael@0 2825 lhx t0, t9(a1) /* t0 = tl */
michael@0 2826 lhx t1, t8(a1) /* t1 = tr */
michael@0 2827 andi t1, t1, 0xffff
michael@0 2828 addiu a3, a3, -1
michael@0 2829 lhx t2, t9(a2) /* t2 = bl */
michael@0 2830 lhx t3, t8(a2) /* t3 = br */
michael@0 2831 andi t3, t3, 0xffff
michael@0 2832
michael@0 2833 CONVERT_2x0565_TO_2x8888 t0, t1, t0, t1, v1, s8, t4, t5, t6, t7
michael@0 2834 CONVERT_2x0565_TO_2x8888 t2, t3, t2, t3, v1, s8, t4, t5, t6, t7
michael@0 2835 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 2836 CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3
michael@0 2837
michael@0 2838 addu s2, s2, s3 /* vx += unit_x; */
michael@0 2839 sh t1, 0(a0)
michael@0 2840 bnez a3, 0b
michael@0 2841 addiu a0, a0, 2
michael@0 2842
michael@0 2843 RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 2844 1:
michael@0 2845 j ra
michael@0 2846 nop
michael@0 2847
michael@0 2848 END(pixman_scaled_bilinear_scanline_0565_0565_SRC_asm_mips)
michael@0 2849
michael@0 2850 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8888_OVER_asm_mips)
michael@0 2851 /*
michael@0 2852 * a0 - *dst
michael@0 2853 * a1 - *src_top
michael@0 2854 * a2 - *src_bottom
michael@0 2855 * a3 - w
michael@0 2856 * 16(sp) - wt
michael@0 2857 * 20(sp) - wb
michael@0 2858 * 24(sp) - vx
michael@0 2859 * 28(sp) - unit_x
michael@0 2860 */
michael@0 2861
michael@0 2862 beqz a3, 1f
michael@0 2863 nop
michael@0 2864
michael@0 2865 SAVE_REGS_ON_STACK 24, v0, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 2866
michael@0 2867 lw s0, 40(sp) /* s0 = wt */
michael@0 2868 lw s1, 44(sp) /* s1 = wb */
michael@0 2869 lw s2, 48(sp) /* s2 = vx */
michael@0 2870 lw s3, 52(sp) /* s3 = unit_x */
michael@0 2871 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 2872 li s8, 0x00ff00ff
michael@0 2873
michael@0 2874 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2875 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2876 0:
michael@0 2877 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 2878 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 2879 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 2880
michael@0 2881 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 2882 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 2883 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 2884 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 2885
michael@0 2886 sra t9, s2, 16
michael@0 2887 sll t9, t9, 2
michael@0 2888 addiu t8, t9, 4
michael@0 2889 lwx t0, t9(a1) /* t0 = tl */
michael@0 2890 lwx t1, t8(a1) /* t1 = tr */
michael@0 2891 addiu a3, a3, -1
michael@0 2892 lwx t2, t9(a2) /* t2 = bl */
michael@0 2893 lwx t3, t8(a2) /* t3 = br */
michael@0 2894
michael@0 2895 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 2896 lw t1, 0(a0) /* t1 = dest */
michael@0 2897 OVER_8888_8888 t0, t1, t2, s8, t3, t4, t5, t6
michael@0 2898
michael@0 2899 addu s2, s2, s3 /* vx += unit_x; */
michael@0 2900 sw t2, 0(a0)
michael@0 2901 bnez a3, 0b
michael@0 2902 addiu a0, a0, 4
michael@0 2903
michael@0 2904 RESTORE_REGS_FROM_STACK 24, v0, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 2905 1:
michael@0 2906 j ra
michael@0 2907 nop
michael@0 2908
michael@0 2909 END(pixman_scaled_bilinear_scanline_8888_8888_OVER_asm_mips)
michael@0 2910
michael@0 2911 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8888_ADD_asm_mips)
michael@0 2912 /*
michael@0 2913 * a0 - *dst
michael@0 2914 * a1 - *src_top
michael@0 2915 * a2 - *src_bottom
michael@0 2916 * a3 - w
michael@0 2917 * 16(sp) - wt
michael@0 2918 * 20(sp) - wb
michael@0 2919 * 24(sp) - vx
michael@0 2920 * 28(sp) - unit_x
michael@0 2921 */
michael@0 2922
michael@0 2923 beqz a3, 1f
michael@0 2924 nop
michael@0 2925
michael@0 2926 SAVE_REGS_ON_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2927
michael@0 2928 lw s0, 36(sp) /* s0 = wt */
michael@0 2929 lw s1, 40(sp) /* s1 = wb */
michael@0 2930 lw s2, 44(sp) /* s2 = vx */
michael@0 2931 lw s3, 48(sp) /* s3 = unit_x */
michael@0 2932 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 2933
michael@0 2934 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2935 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2936 0:
michael@0 2937 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 2938 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 2939 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 2940
michael@0 2941 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 2942 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 2943 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 2944 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 2945
michael@0 2946 sra t9, s2, 16
michael@0 2947 sll t9, t9, 2
michael@0 2948 addiu t8, t9, 4
michael@0 2949 lwx t0, t9(a1) /* t0 = tl */
michael@0 2950 lwx t1, t8(a1) /* t1 = tr */
michael@0 2951 addiu a3, a3, -1
michael@0 2952 lwx t2, t9(a2) /* t2 = bl */
michael@0 2953 lwx t3, t8(a2) /* t3 = br */
michael@0 2954
michael@0 2955 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 2956 lw t1, 0(a0)
michael@0 2957 addu_s.qb t2, t0, t1
michael@0 2958
michael@0 2959 addu s2, s2, s3 /* vx += unit_x; */
michael@0 2960 sw t2, 0(a0)
michael@0 2961 bnez a3, 0b
michael@0 2962 addiu a0, a0, 4
michael@0 2963
michael@0 2964 RESTORE_REGS_FROM_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7
michael@0 2965 1:
michael@0 2966 j ra
michael@0 2967 nop
michael@0 2968
michael@0 2969 END(pixman_scaled_bilinear_scanline_8888_8888_ADD_asm_mips)
michael@0 2970
michael@0 2971 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_8888_SRC_asm_mips)
michael@0 2972 /*
michael@0 2973 * a0 - *dst
michael@0 2974 * a1 - *mask
michael@0 2975 * a2 - *src_top
michael@0 2976 * a3 - *src_bottom
michael@0 2977 * 16(sp) - wt
michael@0 2978 * 20(sp) - wb
michael@0 2979 * 24(sp) - vx
michael@0 2980 * 28(sp) - unit_x
michael@0 2981 * 32(sp) - w
michael@0 2982 */
michael@0 2983
michael@0 2984 lw v1, 32(sp)
michael@0 2985 beqz v1, 1f
michael@0 2986 nop
michael@0 2987
michael@0 2988 SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 2989
michael@0 2990 lw s0, 44(sp) /* s0 = wt */
michael@0 2991 lw s1, 48(sp) /* s1 = wb */
michael@0 2992 lw s2, 52(sp) /* s2 = vx */
michael@0 2993 lw s3, 56(sp) /* s3 = unit_x */
michael@0 2994 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 2995 li s8, 0x00ff00ff
michael@0 2996
michael@0 2997 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2998 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 2999 0:
michael@0 3000 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 3001 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 3002 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 3003
michael@0 3004 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 3005 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 3006 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 3007 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 3008
michael@0 3009 sra t9, s2, 16
michael@0 3010 sll t9, t9, 2
michael@0 3011 addiu t8, t9, 4
michael@0 3012 lwx t0, t9(a2) /* t0 = tl */
michael@0 3013 lwx t1, t8(a2) /* t1 = tr */
michael@0 3014 addiu v1, v1, -1
michael@0 3015 lwx t2, t9(a3) /* t2 = bl */
michael@0 3016 lwx t3, t8(a3) /* t3 = br */
michael@0 3017
michael@0 3018 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 3019 lbu t1, 0(a1) /* t1 = mask */
michael@0 3020 addiu a1, a1, 1
michael@0 3021 MIPS_UN8x4_MUL_UN8 t0, t1, t0, s8, t2, t3, t4
michael@0 3022
michael@0 3023 addu s2, s2, s3 /* vx += unit_x; */
michael@0 3024 sw t0, 0(a0)
michael@0 3025 bnez v1, 0b
michael@0 3026 addiu a0, a0, 4
michael@0 3027
michael@0 3028 RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 3029 1:
michael@0 3030 j ra
michael@0 3031 nop
michael@0 3032
michael@0 3033 END(pixman_scaled_bilinear_scanline_8888_8_8888_SRC_asm_mips)
michael@0 3034
michael@0 3035 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_0565_SRC_asm_mips)
michael@0 3036 /*
michael@0 3037 * a0 - *dst
michael@0 3038 * a1 - *mask
michael@0 3039 * a2 - *src_top
michael@0 3040 * a3 - *src_bottom
michael@0 3041 * 16(sp) - wt
michael@0 3042 * 20(sp) - wb
michael@0 3043 * 24(sp) - vx
michael@0 3044 * 28(sp) - unit_x
michael@0 3045 * 32(sp) - w
michael@0 3046 */
michael@0 3047
michael@0 3048 lw v1, 32(sp)
michael@0 3049 beqz v1, 1f
michael@0 3050 nop
michael@0 3051
michael@0 3052 SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 3053
michael@0 3054 lw s0, 44(sp) /* s0 = wt */
michael@0 3055 lw s1, 48(sp) /* s1 = wb */
michael@0 3056 lw s2, 52(sp) /* s2 = vx */
michael@0 3057 lw s3, 56(sp) /* s3 = unit_x */
michael@0 3058 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 3059 li s8, 0x00ff00ff
michael@0 3060
michael@0 3061 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3062 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3063 0:
michael@0 3064 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 3065 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 3066 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 3067
michael@0 3068 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 3069 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 3070 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 3071 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 3072
michael@0 3073 sra t9, s2, 16
michael@0 3074 sll t9, t9, 2
michael@0 3075 addiu t8, t9, 4
michael@0 3076 lwx t0, t9(a2) /* t0 = tl */
michael@0 3077 lwx t1, t8(a2) /* t1 = tr */
michael@0 3078 addiu v1, v1, -1
michael@0 3079 lwx t2, t9(a3) /* t2 = bl */
michael@0 3080 lwx t3, t8(a3) /* t3 = br */
michael@0 3081
michael@0 3082 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 3083 lbu t1, 0(a1) /* t1 = mask */
michael@0 3084 addiu a1, a1, 1
michael@0 3085 MIPS_UN8x4_MUL_UN8 t0, t1, t0, s8, t2, t3, t4
michael@0 3086 CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3
michael@0 3087
michael@0 3088 addu s2, s2, s3 /* vx += unit_x; */
michael@0 3089 sh t1, 0(a0)
michael@0 3090 bnez v1, 0b
michael@0 3091 addiu a0, a0, 2
michael@0 3092
michael@0 3093 RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 3094 1:
michael@0 3095 j ra
michael@0 3096 nop
michael@0 3097
michael@0 3098 END(pixman_scaled_bilinear_scanline_8888_8_0565_SRC_asm_mips)
michael@0 3099
michael@0 3100 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_0565_8_x888_SRC_asm_mips)
michael@0 3101 /*
michael@0 3102 * a0 - *dst
michael@0 3103 * a1 - *mask
michael@0 3104 * a2 - *src_top
michael@0 3105 * a3 - *src_bottom
michael@0 3106 * 16(sp) - wt
michael@0 3107 * 20(sp) - wb
michael@0 3108 * 24(sp) - vx
michael@0 3109 * 28(sp) - unit_x
michael@0 3110 * 32(sp) - w
michael@0 3111 */
michael@0 3112
michael@0 3113 lw t0, 32(sp)
michael@0 3114 beqz t0, 1f
michael@0 3115 nop
michael@0 3116
michael@0 3117 SAVE_REGS_ON_STACK 32, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8, ra
michael@0 3118
michael@0 3119 lw s0, 48(sp) /* s0 = wt */
michael@0 3120 lw s1, 52(sp) /* s1 = wb */
michael@0 3121 lw s2, 56(sp) /* s2 = vx */
michael@0 3122 lw s3, 60(sp) /* s3 = unit_x */
michael@0 3123 lw ra, 64(sp) /* ra = w */
michael@0 3124 li v0, 0x00ff00ff
michael@0 3125 li v1, 0x07e007e0
michael@0 3126 li s8, 0x001f001f
michael@0 3127
michael@0 3128 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3129 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3130 0:
michael@0 3131 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 3132 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 3133 li t5, BILINEAR_INTERPOLATION_RANGE
michael@0 3134 subu t5, t5, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 3135
michael@0 3136 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 3137 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 3138 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 3139 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 3140
michael@0 3141 sra t9, s2, 16
michael@0 3142 sll t9, t9, 1
michael@0 3143 addiu t8, t9, 2
michael@0 3144 lhx t0, t9(a2) /* t0 = tl */
michael@0 3145 lhx t1, t8(a2) /* t1 = tr */
michael@0 3146 andi t1, t1, 0xffff
michael@0 3147 addiu ra, ra, -1
michael@0 3148 lhx t2, t9(a3) /* t2 = bl */
michael@0 3149 lhx t3, t8(a3) /* t3 = br */
michael@0 3150 andi t3, t3, 0xffff
michael@0 3151
michael@0 3152 CONVERT_2x0565_TO_2x8888 t0, t1, t0, t1, v1, s8, t4, t5, t6, t7
michael@0 3153 CONVERT_2x0565_TO_2x8888 t2, t3, t2, t3, v1, s8, t4, t5, t6, t7
michael@0 3154 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 3155 lbu t1, 0(a1) /* t1 = mask */
michael@0 3156 addiu a1, a1, 1
michael@0 3157 MIPS_UN8x4_MUL_UN8 t0, t1, t0, v0, t2, t3, t4
michael@0 3158
michael@0 3159 addu s2, s2, s3 /* vx += unit_x; */
michael@0 3160 sw t0, 0(a0)
michael@0 3161 bnez ra, 0b
michael@0 3162 addiu a0, a0, 4
michael@0 3163
michael@0 3164 RESTORE_REGS_FROM_STACK 32, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8, ra
michael@0 3165 1:
michael@0 3166 j ra
michael@0 3167 nop
michael@0 3168
michael@0 3169 END(pixman_scaled_bilinear_scanline_0565_8_x888_SRC_asm_mips)
michael@0 3170
michael@0 3171 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_0565_8_0565_SRC_asm_mips)
michael@0 3172 /*
michael@0 3173 * a0 - *dst
michael@0 3174 * a1 - *mask
michael@0 3175 * a2 - *src_top
michael@0 3176 * a3 - *src_bottom
michael@0 3177 * 16(sp) - wt
michael@0 3178 * 20(sp) - wb
michael@0 3179 * 24(sp) - vx
michael@0 3180 * 28(sp) - unit_x
michael@0 3181 * 32(sp) - w
michael@0 3182 */
michael@0 3183
michael@0 3184 lw t0, 32(sp)
michael@0 3185 beqz t0, 1f
michael@0 3186 nop
michael@0 3187
michael@0 3188 SAVE_REGS_ON_STACK 32, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8, ra
michael@0 3189
michael@0 3190 lw s0, 48(sp) /* s0 = wt */
michael@0 3191 lw s1, 52(sp) /* s1 = wb */
michael@0 3192 lw s2, 56(sp) /* s2 = vx */
michael@0 3193 lw s3, 60(sp) /* s3 = unit_x */
michael@0 3194 lw ra, 64(sp) /* ra = w */
michael@0 3195 li v0, 0x00ff00ff
michael@0 3196 li v1, 0x07e007e0
michael@0 3197 li s8, 0x001f001f
michael@0 3198
michael@0 3199 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3200 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3201 0:
michael@0 3202 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 3203 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 3204 li t5, BILINEAR_INTERPOLATION_RANGE
michael@0 3205 subu t5, t5, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 3206
michael@0 3207 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 3208 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 3209 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 3210 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 3211
michael@0 3212 sra t9, s2, 16
michael@0 3213 sll t9, t9, 1
michael@0 3214 addiu t8, t9, 2
michael@0 3215 lhx t0, t9(a2) /* t0 = tl */
michael@0 3216 lhx t1, t8(a2) /* t1 = tr */
michael@0 3217 andi t1, t1, 0xffff
michael@0 3218 addiu ra, ra, -1
michael@0 3219 lhx t2, t9(a3) /* t2 = bl */
michael@0 3220 lhx t3, t8(a3) /* t3 = br */
michael@0 3221 andi t3, t3, 0xffff
michael@0 3222
michael@0 3223 CONVERT_2x0565_TO_2x8888 t0, t1, t0, t1, v1, s8, t4, t5, t6, t7
michael@0 3224 CONVERT_2x0565_TO_2x8888 t2, t3, t2, t3, v1, s8, t4, t5, t6, t7
michael@0 3225 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 3226 lbu t1, 0(a1) /* t1 = mask */
michael@0 3227 addiu a1, a1, 1
michael@0 3228 MIPS_UN8x4_MUL_UN8 t0, t1, t0, v0, t2, t3, t4
michael@0 3229 CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3
michael@0 3230
michael@0 3231 addu s2, s2, s3 /* vx += unit_x; */
michael@0 3232 sh t1, 0(a0)
michael@0 3233 bnez ra, 0b
michael@0 3234 addiu a0, a0, 2
michael@0 3235
michael@0 3236 RESTORE_REGS_FROM_STACK 32, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8, ra
michael@0 3237 1:
michael@0 3238 j ra
michael@0 3239 nop
michael@0 3240
michael@0 3241 END(pixman_scaled_bilinear_scanline_0565_8_0565_SRC_asm_mips)
michael@0 3242
michael@0 3243 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_8888_OVER_asm_mips)
michael@0 3244 /*
michael@0 3245 * a0 - dst (a8r8g8b8)
michael@0 3246 * a1 - mask (a8)
michael@0 3247 * a2 - src_top (a8r8g8b8)
michael@0 3248 * a3 - src_bottom (a8r8g8b8)
michael@0 3249 * 16(sp) - wt
michael@0 3250 * 20(sp) - wb
michael@0 3251 * 24(sp) - vx
michael@0 3252 * 28(sp) - unit_x
michael@0 3253 * 32(sp) - w
michael@0 3254 */
michael@0 3255
michael@0 3256 SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 3257
michael@0 3258 lw v1, 60(sp) /* v1 = w(sp + 32 + 28 save regs stack offset)*/
michael@0 3259 beqz v1, 1f
michael@0 3260 nop
michael@0 3261
michael@0 3262 lw s0, 44(sp) /* s0 = wt */
michael@0 3263 lw s1, 48(sp) /* s1 = wb */
michael@0 3264 lw s2, 52(sp) /* s2 = vx */
michael@0 3265 lw s3, 56(sp) /* s3 = unit_x */
michael@0 3266 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 3267 li s8, 0x00ff00ff
michael@0 3268
michael@0 3269 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3270 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3271
michael@0 3272 0:
michael@0 3273 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 3274 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 3275 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 3276
michael@0 3277 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 3278 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 3279 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 3280 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 3281
michael@0 3282 sra t9, s2, 16
michael@0 3283 sll t9, t9, 2
michael@0 3284 addiu t8, t9, 4
michael@0 3285 lwx t0, t9(a2) /* t0 = tl */
michael@0 3286 lwx t1, t8(a2) /* t1 = tr */
michael@0 3287 addiu v1, v1, -1
michael@0 3288 lwx t2, t9(a3) /* t2 = bl */
michael@0 3289 lwx t3, t8(a3) /* t3 = br */
michael@0 3290
michael@0 3291 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, \
michael@0 3292 t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 3293 lbu t1, 0(a1) /* t1 = mask */
michael@0 3294 lw t2, 0(a0) /* t2 = dst */
michael@0 3295 addiu a1, a1, 1
michael@0 3296 OVER_8888_8_8888 t0, t1, t2, t0, s8, t3, t4, t5, t6
michael@0 3297
michael@0 3298 addu s2, s2, s3 /* vx += unit_x; */
michael@0 3299 sw t0, 0(a0)
michael@0 3300 bnez v1, 0b
michael@0 3301 addiu a0, a0, 4
michael@0 3302
michael@0 3303 1:
michael@0 3304 RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 3305 j ra
michael@0 3306 nop
michael@0 3307
michael@0 3308 END(pixman_scaled_bilinear_scanline_8888_8_8888_OVER_asm_mips)
michael@0 3309
michael@0 3310 LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_8888_ADD_asm_mips)
michael@0 3311 /*
michael@0 3312 * a0 - *dst
michael@0 3313 * a1 - *mask
michael@0 3314 * a2 - *src_top
michael@0 3315 * a3 - *src_bottom
michael@0 3316 * 16(sp) - wt
michael@0 3317 * 20(sp) - wb
michael@0 3318 * 24(sp) - vx
michael@0 3319 * 28(sp) - unit_x
michael@0 3320 * 32(sp) - w
michael@0 3321 */
michael@0 3322
michael@0 3323 lw v1, 32(sp)
michael@0 3324 beqz v1, 1f
michael@0 3325 nop
michael@0 3326
michael@0 3327 SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 3328
michael@0 3329 lw s0, 44(sp) /* s0 = wt */
michael@0 3330 lw s1, 48(sp) /* s1 = wb */
michael@0 3331 lw s2, 52(sp) /* s2 = vx */
michael@0 3332 lw s3, 56(sp) /* s3 = unit_x */
michael@0 3333 li v0, BILINEAR_INTERPOLATION_RANGE
michael@0 3334 li s8, 0x00ff00ff
michael@0 3335
michael@0 3336 sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3337 sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS))
michael@0 3338 0:
michael@0 3339 andi t4, s2, 0xffff /* t4 = (short)vx */
michael@0 3340 srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */
michael@0 3341 subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */
michael@0 3342
michael@0 3343 mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */
michael@0 3344 mul s5, s0, t4 /* s5 = wt*(vx>>8) */
michael@0 3345 mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */
michael@0 3346 mul s7, s1, t4 /* s7 = wb*(vx>>8) */
michael@0 3347
michael@0 3348 sra t9, s2, 16
michael@0 3349 sll t9, t9, 2
michael@0 3350 addiu t8, t9, 4
michael@0 3351 lwx t0, t9(a2) /* t0 = tl */
michael@0 3352 lwx t1, t8(a2) /* t1 = tr */
michael@0 3353 addiu v1, v1, -1
michael@0 3354 lwx t2, t9(a3) /* t2 = bl */
michael@0 3355 lwx t3, t8(a3) /* t3 = br */
michael@0 3356
michael@0 3357 BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7
michael@0 3358 lbu t1, 0(a1) /* t1 = mask */
michael@0 3359 lw t2, 0(a0) /* t2 = dst */
michael@0 3360 addiu a1, a1, 1
michael@0 3361 MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t0, t1, t2, t0, s8, t3, t4, t5
michael@0 3362
michael@0 3363 addu s2, s2, s3 /* vx += unit_x; */
michael@0 3364 sw t0, 0(a0)
michael@0 3365 bnez v1, 0b
michael@0 3366 addiu a0, a0, 4
michael@0 3367
michael@0 3368 RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8
michael@0 3369 1:
michael@0 3370 j ra
michael@0 3371 nop
michael@0 3372
michael@0 3373 END(pixman_scaled_bilinear_scanline_8888_8_8888_ADD_asm_mips)

mercurial