michael@0: /* michael@0: * Copyright (c) 2012 michael@0: * MIPS Technologies, Inc., California. michael@0: * michael@0: * Redistribution and use in source and binary forms, with or without michael@0: * modification, are permitted provided that the following conditions michael@0: * are met: michael@0: * 1. Redistributions of source code must retain the above copyright michael@0: * notice, this list of conditions and the following disclaimer. michael@0: * 2. Redistributions in binary form must reproduce the above copyright michael@0: * notice, this list of conditions and the following disclaimer in the michael@0: * documentation and/or other materials provided with the distribution. michael@0: * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its michael@0: * contributors may be used to endorse or promote products derived from michael@0: * this software without specific prior written permission. michael@0: * michael@0: * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND michael@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE michael@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE michael@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE michael@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL michael@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS michael@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) michael@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT michael@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY michael@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@0: * SUCH DAMAGE. michael@0: * michael@0: * Author: Nemanja Lukic (nlukic@mips.com) michael@0: */ michael@0: michael@0: #include "pixman-private.h" michael@0: #include "pixman-mips-dspr2-asm.h" michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_fill_buff16_mips) michael@0: /* michael@0: * a0 - *dest michael@0: * a1 - count (bytes) michael@0: * a2 - value to fill buffer with michael@0: */ michael@0: michael@0: beqz a1, 3f michael@0: andi t1, a0, 0x0002 michael@0: beqz t1, 0f /* check if address is 4-byte aligned */ michael@0: nop michael@0: sh a2, 0(a0) michael@0: addiu a0, a0, 2 michael@0: addiu a1, a1, -2 michael@0: 0: michael@0: srl t1, a1, 5 /* t1 how many multiples of 32 bytes */ michael@0: replv.ph a2, a2 /* replicate fill value (16bit) in a2 */ michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: addiu t1, t1, -1 michael@0: beqz t1, 11f michael@0: addiu a1, a1, -32 michael@0: pref 30, 32(a0) michael@0: sw a2, 0(a0) michael@0: sw a2, 4(a0) michael@0: sw a2, 8(a0) michael@0: sw a2, 12(a0) michael@0: sw a2, 16(a0) michael@0: sw a2, 20(a0) michael@0: sw a2, 24(a0) michael@0: sw a2, 28(a0) michael@0: b 1b michael@0: addiu a0, a0, 32 michael@0: 11: michael@0: sw a2, 0(a0) michael@0: sw a2, 4(a0) michael@0: sw a2, 8(a0) michael@0: sw a2, 12(a0) michael@0: sw a2, 16(a0) michael@0: sw a2, 20(a0) michael@0: sw a2, 24(a0) michael@0: sw a2, 28(a0) michael@0: addiu a0, a0, 32 michael@0: 2: michael@0: blez a1, 3f michael@0: addiu a1, a1, -2 michael@0: sh a2, 0(a0) michael@0: b 2b michael@0: addiu a0, a0, 2 michael@0: 3: michael@0: jr ra michael@0: nop michael@0: michael@0: END(pixman_fill_buff16_mips) michael@0: michael@0: LEAF_MIPS32R2(pixman_fill_buff32_mips) michael@0: /* michael@0: * a0 - *dest michael@0: * a1 - count (bytes) michael@0: * a2 - value to fill buffer with michael@0: */ michael@0: michael@0: beqz a1, 3f michael@0: nop michael@0: srl t1, a1, 5 /* t1 how many multiples of 32 bytes */ michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: addiu t1, t1, -1 michael@0: beqz t1, 11f michael@0: addiu a1, a1, -32 michael@0: pref 30, 32(a0) michael@0: sw a2, 0(a0) michael@0: sw a2, 4(a0) michael@0: sw a2, 8(a0) michael@0: sw a2, 12(a0) michael@0: sw a2, 16(a0) michael@0: sw a2, 20(a0) michael@0: sw a2, 24(a0) michael@0: sw a2, 28(a0) michael@0: b 1b michael@0: addiu a0, a0, 32 michael@0: 11: michael@0: sw a2, 0(a0) michael@0: sw a2, 4(a0) michael@0: sw a2, 8(a0) michael@0: sw a2, 12(a0) michael@0: sw a2, 16(a0) michael@0: sw a2, 20(a0) michael@0: sw a2, 24(a0) michael@0: sw a2, 28(a0) michael@0: addiu a0, a0, 32 michael@0: 2: michael@0: blez a1, 3f michael@0: addiu a1, a1, -4 michael@0: sw a2, 0(a0) michael@0: b 2b michael@0: addiu a0, a0, 4 michael@0: 3: michael@0: jr ra michael@0: nop michael@0: michael@0: END(pixman_fill_buff32_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_src_8888_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 3f michael@0: nop michael@0: addiu t1, a2, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: li t4, 0xf800f800 michael@0: li t5, 0x07e007e0 michael@0: li t6, 0x001f001f michael@0: 1: michael@0: lw t0, 0(a1) michael@0: lw t1, 4(a1) michael@0: addiu a1, a1, 8 michael@0: addiu a2, a2, -2 michael@0: michael@0: CONVERT_2x8888_TO_2x0565 t0, t1, t2, t3, t4, t5, t6, t7, t8 michael@0: michael@0: sh t2, 0(a0) michael@0: sh t3, 2(a0) michael@0: michael@0: addiu t2, a2, -1 michael@0: bgtz t2, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a2, 3f michael@0: nop michael@0: lw t0, 0(a1) michael@0: michael@0: CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3 michael@0: michael@0: sh t1, 0(a0) michael@0: 3: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_src_8888_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_src_0565_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (r5g6b5) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 3f michael@0: nop michael@0: addiu t1, a2, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: li t4, 0x07e007e0 michael@0: li t5, 0x001F001F michael@0: 1: michael@0: lhu t0, 0(a1) michael@0: lhu t1, 2(a1) michael@0: addiu a1, a1, 4 michael@0: addiu a2, a2, -2 michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, t2, t3, t4, t5, t6, t7, t8, t9 michael@0: michael@0: sw t2, 0(a0) michael@0: sw t3, 4(a0) michael@0: michael@0: addiu t2, a2, -1 michael@0: bgtz t2, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a2, 3f michael@0: nop michael@0: lhu t0, 0(a1) michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t0, t1, t2, t3 michael@0: michael@0: sw t1, 0(a0) michael@0: 3: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_src_0565_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_src_x888_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (x8r8g8b8) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 4f michael@0: nop michael@0: li t9, 0xff000000 michael@0: srl t8, a2, 3 /* t1 = how many multiples of 8 src pixels */ michael@0: beqz t8, 3f /* branch if less than 8 src pixels */ michael@0: nop michael@0: 1: michael@0: addiu t8, t8, -1 michael@0: beqz t8, 2f michael@0: addiu a2, a2, -8 michael@0: pref 0, 32(a1) michael@0: lw t0, 0(a1) michael@0: lw t1, 4(a1) michael@0: lw t2, 8(a1) michael@0: lw t3, 12(a1) michael@0: lw t4, 16(a1) michael@0: lw t5, 20(a1) michael@0: lw t6, 24(a1) michael@0: lw t7, 28(a1) michael@0: addiu a1, a1, 32 michael@0: or t0, t0, t9 michael@0: or t1, t1, t9 michael@0: or t2, t2, t9 michael@0: or t3, t3, t9 michael@0: or t4, t4, t9 michael@0: or t5, t5, t9 michael@0: or t6, t6, t9 michael@0: or t7, t7, t9 michael@0: pref 30, 32(a0) michael@0: sw t0, 0(a0) michael@0: sw t1, 4(a0) michael@0: sw t2, 8(a0) michael@0: sw t3, 12(a0) michael@0: sw t4, 16(a0) michael@0: sw t5, 20(a0) michael@0: sw t6, 24(a0) michael@0: sw t7, 28(a0) michael@0: b 1b michael@0: addiu a0, a0, 32 michael@0: 2: michael@0: lw t0, 0(a1) michael@0: lw t1, 4(a1) michael@0: lw t2, 8(a1) michael@0: lw t3, 12(a1) michael@0: lw t4, 16(a1) michael@0: lw t5, 20(a1) michael@0: lw t6, 24(a1) michael@0: lw t7, 28(a1) michael@0: addiu a1, a1, 32 michael@0: or t0, t0, t9 michael@0: or t1, t1, t9 michael@0: or t2, t2, t9 michael@0: or t3, t3, t9 michael@0: or t4, t4, t9 michael@0: or t5, t5, t9 michael@0: or t6, t6, t9 michael@0: or t7, t7, t9 michael@0: sw t0, 0(a0) michael@0: sw t1, 4(a0) michael@0: sw t2, 8(a0) michael@0: sw t3, 12(a0) michael@0: sw t4, 16(a0) michael@0: sw t5, 20(a0) michael@0: sw t6, 24(a0) michael@0: sw t7, 28(a0) michael@0: beqz a2, 4f michael@0: addiu a0, a0, 32 michael@0: 3: michael@0: lw t0, 0(a1) michael@0: addiu a1, a1, 4 michael@0: addiu a2, a2, -1 michael@0: or t1, t0, t9 michael@0: sw t1, 0(a0) michael@0: bnez a2, 3b michael@0: addiu a0, a0, 4 michael@0: 4: michael@0: jr ra michael@0: nop michael@0: michael@0: END(pixman_composite_src_x888_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_src_n_8_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (32bit constant) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: michael@0: SAVE_REGS_ON_STACK 0, v0 michael@0: li v0, 0x00ff00ff michael@0: michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: michael@0: 1: michael@0: /* a1 = source (32bit constant) */ michael@0: lbu t0, 0(a2) /* t2 = mask (a8) */ michael@0: lbu t1, 1(a2) /* t3 = mask (a8) */ michael@0: addiu a2, a2, 2 michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8 a1, a1, t0, t1, t2, t3, v0, t4, t5, t6, t7, t8, t9 michael@0: michael@0: sw t2, 0(a0) michael@0: sw t3, 4(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t2, a3, -1 michael@0: bgtz t2, 1b michael@0: addiu a0, a0, 8 michael@0: michael@0: beqz a3, 3f michael@0: nop michael@0: michael@0: 2: michael@0: lbu t0, 0(a2) michael@0: addiu a2, a2, 1 michael@0: michael@0: MIPS_UN8x4_MUL_UN8 a1, t0, t1, v0, t3, t4, t5 michael@0: michael@0: sw t1, 0(a0) michael@0: addiu a3, a3, -1 michael@0: addiu a0, a0, 4 michael@0: michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, v0 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_src_n_8_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_src_n_8_8_asm_mips) michael@0: /* michael@0: * a0 - dst (a8) michael@0: * a1 - src (32bit constant) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: li t9, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: srl t7, a3, 2 /* t7 = how many multiples of 4 dst pixels */ michael@0: beqz t7, 1f /* branch if less than 4 src pixels */ michael@0: nop michael@0: michael@0: srl t8, a1, 24 michael@0: replv.ph t8, t8 michael@0: michael@0: 0: michael@0: beqz t7, 1f michael@0: addiu t7, t7, -1 michael@0: lbu t0, 0(a2) michael@0: lbu t1, 1(a2) michael@0: lbu t2, 2(a2) michael@0: lbu t3, 3(a2) michael@0: michael@0: addiu a2, a2, 4 michael@0: michael@0: precr_sra.ph.w t1, t0, 0 michael@0: precr_sra.ph.w t3, t2, 0 michael@0: precr.qb.ph t0, t3, t1 michael@0: michael@0: muleu_s.ph.qbl t2, t0, t8 michael@0: muleu_s.ph.qbr t3, t0, t8 michael@0: shra_r.ph t4, t2, 8 michael@0: shra_r.ph t5, t3, 8 michael@0: and t4, t4, t9 michael@0: and t5, t5, t9 michael@0: addq.ph t2, t2, t4 michael@0: addq.ph t3, t3, t5 michael@0: shra_r.ph t2, t2, 8 michael@0: shra_r.ph t3, t3, 8 michael@0: precr.qb.ph t2, t2, t3 michael@0: michael@0: sb t2, 0(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 1(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 2(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 3(a0) michael@0: addiu a3, a3, -4 michael@0: b 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: 1: michael@0: beqz a3, 3f michael@0: nop michael@0: srl t8, a1, 24 michael@0: 2: michael@0: lbu t0, 0(a2) michael@0: addiu a2, a2, 1 michael@0: michael@0: mul t2, t0, t8 michael@0: shra_r.ph t3, t2, 8 michael@0: andi t3, t3, 0x00ff michael@0: addq.ph t2, t2, t3 michael@0: shra_r.ph t2, t2, 8 michael@0: michael@0: sb t2, 0(a0) michael@0: addiu a3, a3, -1 michael@0: bnez a3, 2b michael@0: addiu a0, a0, 1 michael@0: michael@0: 3: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_src_n_8_8_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_8888_ca_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (32bit constant) michael@0: * a2 - mask (a8r8g8b8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 8, s0, s1, s2, s3, s4, s5 michael@0: beqz a3, 4f michael@0: nop michael@0: li t6, 0xff michael@0: addiu t7, zero, -1 /* t7 = 0xffffffff */ michael@0: srl t8, a1, 24 /* t8 = srca */ michael@0: li t9, 0x00ff00ff michael@0: addiu t1, a3, -1 michael@0: beqz t1, 3f /* last pixel */ michael@0: nop michael@0: beq t8, t6, 2f /* if (srca == 0xff) */ michael@0: nop michael@0: 1: michael@0: /* a1 = src */ michael@0: lw t0, 0(a2) /* t0 = mask */ michael@0: lw t1, 4(a2) /* t1 = mask */ michael@0: or t2, t0, t1 michael@0: beqz t2, 12f /* if (t0 == 0) && (t1 == 0) */ michael@0: addiu a2, a2, 8 michael@0: and t3, t0, t1 michael@0: move t4, a1 /* t4 = src */ michael@0: move t5, a1 /* t5 = src */ michael@0: lw t2, 0(a0) /* t2 = dst */ michael@0: beq t3, t7, 11f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */ michael@0: lw t3, 4(a0) /* t3 = dst */ michael@0: MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, t4, t5, t9, s0, s1, s2, s3, s4, s5 michael@0: MIPS_2xUN8x4_MUL_2xUN8 t0, t1, t8, t8, t0, t1, t9, s0, s1, s2, s3, s4, s5 michael@0: 11: michael@0: not t0, t0 michael@0: not t1, t1 michael@0: MIPS_2xUN8x4_MUL_2xUN8x4 t2, t3, t0, t1, t2, t3, t9, s0, s1, s2, s3, s4, s5 michael@0: addu_s.qb t2, t4, t2 michael@0: addu_s.qb t3, t5, t3 michael@0: sw t2, 0(a0) michael@0: sw t3, 4(a0) michael@0: 12: michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: b 3f michael@0: nop michael@0: 2: michael@0: /* a1 = src */ michael@0: lw t0, 0(a2) /* t0 = mask */ michael@0: lw t1, 4(a2) /* t1 = mask */ michael@0: or t2, t0, t1 michael@0: beqz t2, 22f /* if (t0 == 0) & (t1 == 0) */ michael@0: addiu a2, a2, 8 michael@0: and t2, t0, t1 michael@0: move t4, a1 michael@0: beq t2, t7, 21f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */ michael@0: move t5, a1 michael@0: lw t2, 0(a0) /* t2 = dst */ michael@0: lw t3, 4(a0) /* t3 = dst */ michael@0: MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, t4, t5, t9, s0, s1, s2, s3, s4, s5 michael@0: not t0, t0 michael@0: not t1, t1 michael@0: MIPS_2xUN8x4_MUL_2xUN8x4 t2, t3, t0, t1, t2, t3, t9, s0, s1, s2, s3, s4, s5 michael@0: addu_s.qb t4, t4, t2 michael@0: addu_s.qb t5, t5, t3 michael@0: 21: michael@0: sw t4, 0(a0) michael@0: sw t5, 4(a0) michael@0: 22: michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 2b michael@0: addiu a0, a0, 8 michael@0: 3: michael@0: blez a3, 4f michael@0: nop michael@0: /* a1 = src */ michael@0: lw t1, 0(a2) /* t1 = mask */ michael@0: beqz t1, 4f michael@0: nop michael@0: move t2, a1 /* t2 = src */ michael@0: beq t1, t7, 31f michael@0: lw t0, 0(a0) /* t0 = dst */ michael@0: michael@0: MIPS_UN8x4_MUL_UN8x4 a1, t1, t2, t9, t3, t4, t5, t6 michael@0: MIPS_UN8x4_MUL_UN8 t1, t8, t1, t9, t3, t4, t5 michael@0: 31: michael@0: not t1, t1 michael@0: MIPS_UN8x4_MUL_UN8x4 t0, t1, t0, t9, t3, t4, t5, t6 michael@0: addu_s.qb t0, t2, t0 michael@0: sw t0, 0(a0) michael@0: 4: michael@0: RESTORE_REGS_FROM_STACK 8, s0, s1, s2, s3, s4, s5 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_n_8888_8888_ca_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_0565_ca_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (32bit constant) michael@0: * a2 - mask (a8r8g8b8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: beqz a3, 4f michael@0: nop michael@0: li t5, 0xf800f800 michael@0: li t6, 0x07e007e0 michael@0: li t7, 0x001F001F michael@0: li t9, 0x00ff00ff michael@0: michael@0: srl t8, a1, 24 /* t8 = srca */ michael@0: addiu t1, a3, -1 michael@0: beqz t1, 3f /* last pixel */ michael@0: nop michael@0: li s0, 0xff /* s0 = 0xff */ michael@0: addiu s1, zero, -1 /* s1 = 0xffffffff */ michael@0: michael@0: beq t8, s0, 2f /* if (srca == 0xff) */ michael@0: nop michael@0: 1: michael@0: /* a1 = src */ michael@0: lw t0, 0(a2) /* t0 = mask */ michael@0: lw t1, 4(a2) /* t1 = mask */ michael@0: or t2, t0, t1 michael@0: beqz t2, 12f /* if (t0 == 0) && (t1 == 0) */ michael@0: addiu a2, a2, 8 michael@0: and t3, t0, t1 michael@0: move s2, a1 /* s2 = src */ michael@0: move s3, a1 /* s3 = src */ michael@0: lhu t2, 0(a0) /* t2 = dst */ michael@0: beq t3, s1, 11f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */ michael@0: lhu t3, 2(a0) /* t3 = dst */ michael@0: MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, s2, s3, t9, t4, s4, s5, s6, s7, s8 michael@0: MIPS_2xUN8x4_MUL_2xUN8 t0, t1, t8, t8, t0, t1, t9, t4, s4, s5, s6, s7, s8 michael@0: 11: michael@0: not t0, t0 michael@0: not t1, t1 michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, s4, s5, t6, t7, t4, s6, s7, s8 michael@0: MIPS_2xUN8x4_MUL_2xUN8x4 s4, s5, t0, t1, s4, s5, t9, t4, s6, s7, s8, t0, t1 michael@0: addu_s.qb s2, s2, s4 michael@0: addu_s.qb s3, s3, s5 michael@0: CONVERT_2x8888_TO_2x0565 s2, s3, t2, t3, t5, t6, t7, s4, s5 michael@0: sh t2, 0(a0) michael@0: sh t3, 2(a0) michael@0: 12: michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: b 3f michael@0: nop michael@0: 2: michael@0: /* a1 = src */ michael@0: lw t0, 0(a2) /* t0 = mask */ michael@0: lw t1, 4(a2) /* t1 = mask */ michael@0: or t2, t0, t1 michael@0: beqz t2, 22f /* if (t0 == 0) & (t1 == 0) */ michael@0: addiu a2, a2, 8 michael@0: and t3, t0, t1 michael@0: move t2, a1 michael@0: beq t3, s1, 21f /* if (t0 == 0xffffffff) && (t1 == 0xffffffff) */ michael@0: move t3, a1 michael@0: lhu t2, 0(a0) /* t2 = dst */ michael@0: lhu t3, 2(a0) /* t3 = dst */ michael@0: MIPS_2xUN8x4_MUL_2xUN8x4 a1, a1, t0, t1, s2, s3, t9, t4, s4, s5, s6, s7, s8 michael@0: not t0, t0 michael@0: not t1, t1 michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, s4, s5, t6, t7, t4, s6, s7, s8 michael@0: MIPS_2xUN8x4_MUL_2xUN8x4 s4, s5, t0, t1, s4, s5, t9, t4, s6, s7, s8, t2, t3 michael@0: addu_s.qb t2, s2, s4 michael@0: addu_s.qb t3, s3, s5 michael@0: 21: michael@0: CONVERT_2x8888_TO_2x0565 t2, t3, t0, t1, t5, t6, t7, s2, s3 michael@0: sh t0, 0(a0) michael@0: sh t1, 2(a0) michael@0: 22: michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 2b michael@0: addiu a0, a0, 4 michael@0: 3: michael@0: blez a3, 4f michael@0: nop michael@0: /* a1 = src */ michael@0: lw t1, 0(a2) /* t1 = mask */ michael@0: beqz t1, 4f michael@0: nop michael@0: move t2, a1 /* t2 = src */ michael@0: beq t1, t7, 31f michael@0: lhu t0, 0(a0) /* t0 = dst */ michael@0: michael@0: MIPS_UN8x4_MUL_UN8x4 a1, t1, t2, t9, t3, t4, t5, t6 michael@0: MIPS_UN8x4_MUL_UN8 t1, t8, t1, t9, t3, t4, t5 michael@0: 31: michael@0: not t1, t1 michael@0: CONVERT_1x0565_TO_1x8888 t0, s1, s2, s3 michael@0: MIPS_UN8x4_MUL_UN8x4 s1, t1, t3, t9, t4, t5, t6, t7 michael@0: addu_s.qb t0, t2, t3 michael@0: CONVERT_1x8888_TO_1x0565 t0, s1, s2, s3 michael@0: sh s1, 0(a0) michael@0: 4: michael@0: RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_n_8888_0565_ca_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_n_8_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (32bit constant) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 4, s0, s1, s2, s3, s4 michael@0: beqz a3, 4f michael@0: nop michael@0: li t4, 0x00ff00ff michael@0: li t5, 0xff michael@0: addiu t0, a3, -1 michael@0: beqz t0, 3f /* last pixel */ michael@0: srl t6, a1, 24 /* t6 = srca */ michael@0: not s4, a1 michael@0: beq t5, t6, 2f /* if (srca == 0xff) */ michael@0: srl s4, s4, 24 michael@0: 1: michael@0: /* a1 = src */ michael@0: lbu t0, 0(a2) /* t0 = mask */ michael@0: lbu t1, 1(a2) /* t1 = mask */ michael@0: or t2, t0, t1 michael@0: beqz t2, 111f /* if (t0 == 0) && (t1 == 0) */ michael@0: addiu a2, a2, 2 michael@0: and t3, t0, t1 michael@0: michael@0: lw t2, 0(a0) /* t2 = dst */ michael@0: beq t3, t5, 11f /* if (t0 == 0xff) && (t1 == 0xff) */ michael@0: lw t3, 4(a0) /* t3 = dst */ michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8 a1, a1, t0, t1, s0, s1, t4, t6, t7, t8, t9, s2, s3 michael@0: not s2, s0 michael@0: not s3, s1 michael@0: srl s2, s2, 24 michael@0: srl s3, s3, 24 michael@0: MIPS_2xUN8x4_MUL_2xUN8 t2, t3, s2, s3, t2, t3, t4, t0, t1, t6, t7, t8, t9 michael@0: addu_s.qb s2, t2, s0 michael@0: addu_s.qb s3, t3, s1 michael@0: sw s2, 0(a0) michael@0: b 111f michael@0: sw s3, 4(a0) michael@0: 11: michael@0: MIPS_2xUN8x4_MUL_2xUN8 t2, t3, s4, s4, t2, t3, t4, t0, t1, t6, t7, t8, t9 michael@0: addu_s.qb s2, t2, a1 michael@0: addu_s.qb s3, t3, a1 michael@0: sw s2, 0(a0) michael@0: sw s3, 4(a0) michael@0: michael@0: 111: michael@0: addiu a3, a3, -2 michael@0: addiu t0, a3, -1 michael@0: bgtz t0, 1b michael@0: addiu a0, a0, 8 michael@0: b 3f michael@0: nop michael@0: 2: michael@0: /* a1 = src */ michael@0: lbu t0, 0(a2) /* t0 = mask */ michael@0: lbu t1, 1(a2) /* t1 = mask */ michael@0: or t2, t0, t1 michael@0: beqz t2, 222f /* if (t0 == 0) && (t1 == 0) */ michael@0: addiu a2, a2, 2 michael@0: and t3, t0, t1 michael@0: beq t3, t5, 22f /* if (t0 == 0xff) && (t1 == 0xff) */ michael@0: nop michael@0: lw t2, 0(a0) /* t2 = dst */ michael@0: lw t3, 4(a0) /* t3 = dst */ michael@0: michael@0: OVER_2x8888_2x8_2x8888 a1, a1, t0, t1, t2, t3, \ michael@0: t6, t7, t4, t8, t9, s0, s1, s2, s3 michael@0: sw t6, 0(a0) michael@0: b 222f michael@0: sw t7, 4(a0) michael@0: 22: michael@0: sw a1, 0(a0) michael@0: sw a1, 4(a0) michael@0: 222: michael@0: addiu a3, a3, -2 michael@0: addiu t0, a3, -1 michael@0: bgtz t0, 2b michael@0: addiu a0, a0, 8 michael@0: 3: michael@0: blez a3, 4f michael@0: nop michael@0: /* a1 = src */ michael@0: lbu t0, 0(a2) /* t0 = mask */ michael@0: beqz t0, 4f /* if (t0 == 0) */ michael@0: addiu a2, a2, 1 michael@0: move t3, a1 michael@0: beq t0, t5, 31f /* if (t0 == 0xff) */ michael@0: lw t1, 0(a0) /* t1 = dst */ michael@0: michael@0: MIPS_UN8x4_MUL_UN8 a1, t0, t3, t4, t6, t7, t8 michael@0: 31: michael@0: not t2, t3 michael@0: srl t2, t2, 24 michael@0: MIPS_UN8x4_MUL_UN8 t1, t2, t1, t4, t6, t7, t8 michael@0: addu_s.qb t2, t1, t3 michael@0: sw t2, 0(a0) michael@0: 4: michael@0: RESTORE_REGS_FROM_STACK 4, s0, s1, s2, s3, s4 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_n_8_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_n_8_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (32bit constant) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: SAVE_REGS_ON_STACK 24, v0, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: beqz a3, 4f michael@0: nop michael@0: li t4, 0x00ff00ff michael@0: li t5, 0xff michael@0: li t6, 0xf800f800 michael@0: li t7, 0x07e007e0 michael@0: li t8, 0x001F001F michael@0: addiu t1, a3, -1 michael@0: beqz t1, 3f /* last pixel */ michael@0: srl t0, a1, 24 /* t0 = srca */ michael@0: not v0, a1 michael@0: beq t0, t5, 2f /* if (srca == 0xff) */ michael@0: srl v0, v0, 24 michael@0: 1: michael@0: /* a1 = src */ michael@0: lbu t0, 0(a2) /* t0 = mask */ michael@0: lbu t1, 1(a2) /* t1 = mask */ michael@0: or t2, t0, t1 michael@0: beqz t2, 111f /* if (t0 == 0) && (t1 == 0) */ michael@0: addiu a2, a2, 2 michael@0: lhu t2, 0(a0) /* t2 = dst */ michael@0: lhu t3, 2(a0) /* t3 = dst */ michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, s0, s1, t7, t8, t9, s2, s3, s4 michael@0: and t9, t0, t1 michael@0: beq t9, t5, 11f /* if (t0 == 0xff) && (t1 == 0xff) */ michael@0: nop michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8 a1, a1, t0, t1, s2, s3, t4, t9, s4, s5, s6, s7, s8 michael@0: not s4, s2 michael@0: not s5, s3 michael@0: srl s4, s4, 24 michael@0: srl s5, s5, 24 michael@0: MIPS_2xUN8x4_MUL_2xUN8 s0, s1, s4, s5, s0, s1, t4, t9, t0, t1, s6, s7, s8 michael@0: addu_s.qb s4, s2, s0 michael@0: addu_s.qb s5, s3, s1 michael@0: CONVERT_2x8888_TO_2x0565 s4, s5, t2, t3, t6, t7, t8, s0, s1 michael@0: sh t2, 0(a0) michael@0: b 111f michael@0: sh t3, 2(a0) michael@0: 11: michael@0: MIPS_2xUN8x4_MUL_2xUN8 s0, s1, v0, v0, s0, s1, t4, t9, t0, t1, s6, s7, s8 michael@0: addu_s.qb s4, a1, s0 michael@0: addu_s.qb s5, a1, s1 michael@0: CONVERT_2x8888_TO_2x0565 s4, s5, t2, t3, t6, t7, t8, s0, s1 michael@0: sh t2, 0(a0) michael@0: sh t3, 2(a0) michael@0: 111: michael@0: addiu a3, a3, -2 michael@0: addiu t0, a3, -1 michael@0: bgtz t0, 1b michael@0: addiu a0, a0, 4 michael@0: b 3f michael@0: nop michael@0: 2: michael@0: CONVERT_1x8888_TO_1x0565 a1, s0, s1, s2 michael@0: 21: michael@0: /* a1 = src */ michael@0: lbu t0, 0(a2) /* t0 = mask */ michael@0: lbu t1, 1(a2) /* t1 = mask */ michael@0: or t2, t0, t1 michael@0: beqz t2, 222f /* if (t0 == 0) && (t1 == 0) */ michael@0: addiu a2, a2, 2 michael@0: and t9, t0, t1 michael@0: move s2, s0 michael@0: beq t9, t5, 22f /* if (t0 == 0xff) && (t2 == 0xff) */ michael@0: move s3, s0 michael@0: lhu t2, 0(a0) /* t2 = dst */ michael@0: lhu t3, 2(a0) /* t3 = dst */ michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, s2, s3, t7, t8, s4, s5, s6, s7 michael@0: OVER_2x8888_2x8_2x8888 a1, a1, t0, t1, s2, s3, \ michael@0: t2, t3, t4, t9, s4, s5, s6, s7, s8 michael@0: CONVERT_2x8888_TO_2x0565 t2, t3, s2, s3, t6, t7, t8, s4, s5 michael@0: 22: michael@0: sh s2, 0(a0) michael@0: sh s3, 2(a0) michael@0: 222: michael@0: addiu a3, a3, -2 michael@0: addiu t0, a3, -1 michael@0: bgtz t0, 21b michael@0: addiu a0, a0, 4 michael@0: 3: michael@0: blez a3, 4f michael@0: nop michael@0: /* a1 = src */ michael@0: lbu t0, 0(a2) /* t0 = mask */ michael@0: beqz t0, 4f /* if (t0 == 0) */ michael@0: nop michael@0: lhu t1, 0(a0) /* t1 = dst */ michael@0: CONVERT_1x0565_TO_1x8888 t1, t2, t3, t7 michael@0: beq t0, t5, 31f /* if (t0 == 0xff) */ michael@0: move t3, a1 michael@0: michael@0: MIPS_UN8x4_MUL_UN8 a1, t0, t3, t4, t7, t8, t9 michael@0: 31: michael@0: not t6, t3 michael@0: srl t6, t6, 24 michael@0: MIPS_UN8x4_MUL_UN8 t2, t6, t2, t4, t7, t8, t9 michael@0: addu_s.qb t1, t2, t3 michael@0: CONVERT_1x8888_TO_1x0565 t1, t2, t3, t7 michael@0: sh t2, 0(a0) michael@0: 4: michael@0: RESTORE_REGS_FROM_STACK 24, v0, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_n_8_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_8888_n_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (32bit constant) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0 michael@0: li t4, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: srl a2, a2, 24 michael@0: beqz t1, 2f michael@0: nop michael@0: michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: /* a2 = mask (32bit constant) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 8 michael@0: michael@0: OVER_2x8888_2x8_2x8888 t0, t1, a2, a2, t2, t3, \ michael@0: t5, t6, t4, t7, t8, t9, t0, t1, s0 michael@0: michael@0: sw t5, 0(a0) michael@0: sw t6, 4(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: /* a2 = mask (32bit constant) */ michael@0: lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */ michael@0: michael@0: OVER_8888_8_8888 t0, a2, t1, t3, t4, t5, t6, t7, t8 michael@0: michael@0: sw t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_8888_n_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_8888_n_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (32bit constant) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2, s3 michael@0: li t6, 0x00ff00ff michael@0: li t7, 0xf800f800 michael@0: li t8, 0x07e007e0 michael@0: li t9, 0x001F001F michael@0: beqz a3, 3f michael@0: nop michael@0: srl a2, a2, 24 michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: /* a2 = mask (32bit constant) */ michael@0: lhu t2, 0(a0) /* t2 = destination (r5g6b5) */ michael@0: lhu t3, 2(a0) /* t2 = destination (r5g6b5) */ michael@0: addiu a1, a1, 8 michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, t4, t5, t8, t9, s0, s1, t2, t3 michael@0: OVER_2x8888_2x8_2x8888 t0, t1, a2, a2, t4, t5, \ michael@0: t2, t3, t6, t0, t1, s0, s1, s2, s3 michael@0: CONVERT_2x8888_TO_2x0565 t2, t3, t4, t5, t7, t8, t9, s0, s1 michael@0: michael@0: sh t4, 0(a0) michael@0: sh t5, 2(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: /* a2 = mask (32bit constant) */ michael@0: lhu t1, 0(a0) /* t1 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t1, t2, t4, t5 michael@0: OVER_8888_8_8888 t0, a2, t2, t1, t6, t3, t4, t5, t7 michael@0: CONVERT_1x8888_TO_1x0565 t1, t3, t4, t5 michael@0: michael@0: sh t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_8888_n_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_0565_n_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (r5g6b5) michael@0: * a2 - mask (32bit constant) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5 michael@0: li t6, 0x00ff00ff michael@0: li t7, 0xf800f800 michael@0: li t8, 0x07e007e0 michael@0: li t9, 0x001F001F michael@0: beqz a3, 3f michael@0: nop michael@0: srl a2, a2, 24 michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lhu t0, 0(a1) /* t0 = source (r5g6b5) */ michael@0: lhu t1, 2(a1) /* t1 = source (r5g6b5) */ michael@0: /* a2 = mask (32bit constant) */ michael@0: lhu t2, 0(a0) /* t2 = destination (r5g6b5) */ michael@0: lhu t3, 2(a0) /* t3 = destination (r5g6b5) */ michael@0: addiu a1, a1, 4 michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, t4, t5, t8, t9, s0, s1, s2, s3 michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, s0, s1, t8, t9, s2, s3, s4, s5 michael@0: OVER_2x8888_2x8_2x8888 t4, t5, a2, a2, s0, s1, \ michael@0: t0, t1, t6, s2, s3, s4, s5, t4, t5 michael@0: CONVERT_2x8888_TO_2x0565 t0, t1, s0, s1, t7, t8, t9, s2, s3 michael@0: michael@0: sh s0, 0(a0) michael@0: sh s1, 2(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lhu t0, 0(a1) /* t0 = source (r5g6b5) */ michael@0: /* a2 = mask (32bit constant) */ michael@0: lhu t1, 0(a0) /* t1 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t0, t2, t4, t5 michael@0: CONVERT_1x0565_TO_1x8888 t1, t3, t4, t5 michael@0: OVER_8888_8_8888 t2, a2, t3, t0, t6, t1, t4, t5, t7 michael@0: CONVERT_1x8888_TO_1x0565 t0, t3, t4, t5 michael@0: michael@0: sh t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_0565_n_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_8888_8_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1 michael@0: li t4, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: lbu t2, 0(a2) /* t2 = mask (a8) */ michael@0: lbu t3, 1(a2) /* t3 = mask (a8) */ michael@0: lw t5, 0(a0) /* t5 = destination (a8r8g8b8) */ michael@0: lw t6, 4(a0) /* t6 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 8 michael@0: addiu a2, a2, 2 michael@0: michael@0: OVER_2x8888_2x8_2x8888 t0, t1, t2, t3, t5, t6, \ michael@0: t7, t8, t4, t9, s0, s1, t0, t1, t2 michael@0: michael@0: sw t7, 0(a0) michael@0: sw t8, 4(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lbu t1, 0(a2) /* t1 = mask (a8) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: michael@0: OVER_8888_8_8888 t0, t1, t2, t3, t4, t5, t6, t7, t8 michael@0: michael@0: sw t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_8888_8_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_8888_8_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5 michael@0: li t6, 0x00ff00ff michael@0: li t7, 0xf800f800 michael@0: li t8, 0x07e007e0 michael@0: li t9, 0x001F001F michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: lbu t2, 0(a2) /* t2 = mask (a8) */ michael@0: lbu t3, 1(a2) /* t3 = mask (a8) */ michael@0: lhu t4, 0(a0) /* t4 = destination (r5g6b5) */ michael@0: lhu t5, 2(a0) /* t5 = destination (r5g6b5) */ michael@0: addiu a1, a1, 8 michael@0: addiu a2, a2, 2 michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t4, t5, s0, s1, t8, t9, s2, s3, s4, s5 michael@0: OVER_2x8888_2x8_2x8888 t0, t1, t2, t3, s0, s1, \ michael@0: t4, t5, t6, s2, s3, s4, s5, t0, t1 michael@0: CONVERT_2x8888_TO_2x0565 t4, t5, s0, s1, t7, t8, t9, s2, s3 michael@0: michael@0: sh s0, 0(a0) michael@0: sh s1, 2(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lbu t1, 0(a2) /* t1 = mask (a8) */ michael@0: lhu t2, 0(a0) /* t2 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t2, t3, t4, t5 michael@0: OVER_8888_8_8888 t0, t1, t3, t2, t6, t4, t5, t7, t8 michael@0: CONVERT_1x8888_TO_1x0565 t2, t3, t4, t5 michael@0: michael@0: sh t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_8888_8_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_0565_8_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (r5g6b5) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5 michael@0: li t4, 0xf800f800 michael@0: li t5, 0x07e007e0 michael@0: li t6, 0x001F001F michael@0: li t7, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lhu t0, 0(a1) /* t0 = source (r5g6b5) */ michael@0: lhu t1, 2(a1) /* t1 = source (r5g6b5) */ michael@0: lbu t2, 0(a2) /* t2 = mask (a8) */ michael@0: lbu t3, 1(a2) /* t3 = mask (a8) */ michael@0: lhu t8, 0(a0) /* t8 = destination (r5g6b5) */ michael@0: lhu t9, 2(a0) /* t9 = destination (r5g6b5) */ michael@0: addiu a1, a1, 4 michael@0: addiu a2, a2, 2 michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, s0, s1, t5, t6, s2, s3, s4, s5 michael@0: CONVERT_2x0565_TO_2x8888 t8, t9, s2, s3, t5, t6, s4, s5, t0, t1 michael@0: OVER_2x8888_2x8_2x8888 s0, s1, t2, t3, s2, s3, \ michael@0: t0, t1, t7, s4, s5, t8, t9, s0, s1 michael@0: CONVERT_2x8888_TO_2x0565 t0, t1, s0, s1, t4, t5, t6, s2, s3 michael@0: michael@0: sh s0, 0(a0) michael@0: sh s1, 2(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lhu t0, 0(a1) /* t0 = source (r5g6b5) */ michael@0: lbu t1, 0(a2) /* t1 = mask (a8) */ michael@0: lhu t2, 0(a0) /* t2 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t0, t3, t4, t5 michael@0: CONVERT_1x0565_TO_1x8888 t2, t4, t5, t6 michael@0: OVER_8888_8_8888 t3, t1, t4, t0, t7, t2, t5, t6, t8 michael@0: CONVERT_1x8888_TO_1x0565 t0, t3, t4, t5 michael@0: michael@0: sh t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_0565_8_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_8888_8888_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (a8r8g8b8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2 michael@0: li t4, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: lw t2, 0(a2) /* t2 = mask (a8r8g8b8) */ michael@0: lw t3, 4(a2) /* t3 = mask (a8r8g8b8) */ michael@0: lw t5, 0(a0) /* t5 = destination (a8r8g8b8) */ michael@0: lw t6, 4(a0) /* t6 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 8 michael@0: addiu a2, a2, 8 michael@0: srl t2, t2, 24 michael@0: srl t3, t3, 24 michael@0: michael@0: OVER_2x8888_2x8_2x8888 t0, t1, t2, t3, t5, t6, t7, t8, t4, t9, s0, s1, s2, t0, t1 michael@0: michael@0: sw t7, 0(a0) michael@0: sw t8, 4(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 0(a2) /* t1 = mask (a8r8g8b8) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: srl t1, t1, 24 michael@0: michael@0: OVER_8888_8_8888 t0, t1, t2, t3, t4, t5, t6, t7, t8 michael@0: michael@0: sw t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_8888_8888_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_8888_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2 michael@0: li t4, 0x00ff00ff michael@0: beqz a2, 3f michael@0: nop michael@0: addiu t1, a2, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 8 michael@0: michael@0: not t5, t0 michael@0: srl t5, t5, 24 michael@0: not t6, t1 michael@0: srl t6, t6, 24 michael@0: michael@0: or t7, t5, t6 michael@0: beqz t7, 11f michael@0: or t8, t0, t1 michael@0: beqz t8, 12f michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8 t2, t3, t5, t6, t7, t8, t4, t9, s0, s1, s2, t2, t3 michael@0: michael@0: addu_s.qb t0, t7, t0 michael@0: addu_s.qb t1, t8, t1 michael@0: 11: michael@0: sw t0, 0(a0) michael@0: sw t1, 4(a0) michael@0: 12: michael@0: addiu a2, a2, -2 michael@0: addiu t1, a2, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a2, 3f michael@0: nop michael@0: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 4 michael@0: michael@0: not t2, t0 michael@0: srl t2, t2, 24 michael@0: michael@0: beqz t2, 21f michael@0: nop michael@0: beqz t0, 3f michael@0: michael@0: MIPS_UN8x4_MUL_UN8 t1, t2, t3, t4, t5, t6, t7 michael@0: michael@0: addu_s.qb t0, t3, t0 michael@0: 21: michael@0: sw t0, 0(a0) michael@0: michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_8888_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_n_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (32bit constant) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 5f michael@0: nop michael@0: michael@0: not t0, a1 michael@0: srl t0, t0, 24 michael@0: bgtz t0, 1f michael@0: nop michael@0: CONVERT_1x8888_TO_1x0565 a1, t1, t2, t3 michael@0: 0: michael@0: sh t1, 0(a0) michael@0: addiu a2, a2, -1 michael@0: bgtz a2, 0b michael@0: addiu a0, a0, 2 michael@0: j ra michael@0: nop michael@0: michael@0: 1: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2 michael@0: li t4, 0x00ff00ff michael@0: li t5, 0xf800f800 michael@0: li t6, 0x07e007e0 michael@0: li t7, 0x001F001F michael@0: addiu t1, a2, -1 michael@0: beqz t1, 3f michael@0: nop michael@0: 2: michael@0: lhu t1, 0(a0) /* t1 = destination (r5g6b5) */ michael@0: lhu t2, 2(a0) /* t2 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t1, t2, t3, t8, t6, t7, t9, s0, s1, s2 michael@0: MIPS_2xUN8x4_MUL_2xUN8 t3, t8, t0, t0, t1, t2, t4, t9, s0, s1, s2, t3, t8 michael@0: addu_s.qb t1, t1, a1 michael@0: addu_s.qb t2, t2, a1 michael@0: CONVERT_2x8888_TO_2x0565 t1, t2, t3, t8, t5, t6, t7, s0, s1 michael@0: michael@0: sh t3, 0(a0) michael@0: sh t8, 2(a0) michael@0: michael@0: addiu a2, a2, -2 michael@0: addiu t1, a2, -1 michael@0: bgtz t1, 2b michael@0: addiu a0, a0, 4 michael@0: 3: michael@0: beqz a2, 4f michael@0: nop michael@0: michael@0: lhu t1, 0(a0) /* t1 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t1, t2, s0, s1 michael@0: MIPS_UN8x4_MUL_UN8 t2, t0, t1, t4, s0, s1, s2 michael@0: addu_s.qb t1, t1, a1 michael@0: CONVERT_1x8888_TO_1x0565 t1, t2, s0, s1 michael@0: michael@0: sh t2, 0(a0) michael@0: michael@0: 4: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2 michael@0: 5: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_n_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (32bit constant) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 5f michael@0: nop michael@0: michael@0: not t0, a1 michael@0: srl t0, t0, 24 michael@0: bgtz t0, 1f michael@0: nop michael@0: 0: michael@0: sw a1, 0(a0) michael@0: addiu a2, a2, -1 michael@0: bgtz a2, 0b michael@0: addiu a0, a0, 4 michael@0: j ra michael@0: nop michael@0: michael@0: 1: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2 michael@0: li t4, 0x00ff00ff michael@0: addiu t1, a2, -1 michael@0: beqz t1, 3f michael@0: nop michael@0: 2: michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */ michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8 t2, t3, t0, t0, t7, t8, t4, t9, s0, s1, s2, t2, t3 michael@0: michael@0: addu_s.qb t7, t7, a1 michael@0: addu_s.qb t8, t8, a1 michael@0: michael@0: sw t7, 0(a0) michael@0: sw t8, 4(a0) michael@0: michael@0: addiu a2, a2, -2 michael@0: addiu t1, a2, -1 michael@0: bgtz t1, 2b michael@0: addiu a0, a0, 8 michael@0: 3: michael@0: beqz a2, 4f michael@0: nop michael@0: michael@0: lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */ michael@0: michael@0: MIPS_UN8x4_MUL_UN8 t1, t0, t3, t4, t5, t6, t7 michael@0: michael@0: addu_s.qb t3, t3, a1 michael@0: michael@0: sw t3, 0(a0) michael@0: michael@0: 4: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2 michael@0: 5: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_n_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_8_8_8_asm_mips) michael@0: /* michael@0: * a0 - dst (a8) michael@0: * a1 - src (a8) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, v0, v1 michael@0: li t9, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: michael@0: srl v0, a3, 2 /* v0 = how many multiples of 4 dst pixels */ michael@0: beqz v0, 1f /* branch if less than 4 src pixels */ michael@0: nop michael@0: michael@0: 0: michael@0: beqz v0, 1f michael@0: addiu v0, v0, -1 michael@0: lbu t0, 0(a2) michael@0: lbu t1, 1(a2) michael@0: lbu t2, 2(a2) michael@0: lbu t3, 3(a2) michael@0: lbu t4, 0(a0) michael@0: lbu t5, 1(a0) michael@0: lbu t6, 2(a0) michael@0: lbu t7, 3(a0) michael@0: michael@0: addiu a2, a2, 4 michael@0: michael@0: precr_sra.ph.w t1, t0, 0 michael@0: precr_sra.ph.w t3, t2, 0 michael@0: precr_sra.ph.w t5, t4, 0 michael@0: precr_sra.ph.w t7, t6, 0 michael@0: michael@0: precr.qb.ph t0, t3, t1 michael@0: precr.qb.ph t1, t7, t5 michael@0: michael@0: lbu t4, 0(a1) michael@0: lbu v1, 1(a1) michael@0: lbu t7, 2(a1) michael@0: lbu t8, 3(a1) michael@0: michael@0: addiu a1, a1, 4 michael@0: michael@0: precr_sra.ph.w v1, t4, 0 michael@0: precr_sra.ph.w t8, t7, 0 michael@0: michael@0: muleu_s.ph.qbl t2, t0, t8 michael@0: muleu_s.ph.qbr t3, t0, v1 michael@0: shra_r.ph t4, t2, 8 michael@0: shra_r.ph t5, t3, 8 michael@0: and t4, t4, t9 michael@0: and t5, t5, t9 michael@0: addq.ph t2, t2, t4 michael@0: addq.ph t3, t3, t5 michael@0: shra_r.ph t2, t2, 8 michael@0: shra_r.ph t3, t3, 8 michael@0: precr.qb.ph t0, t2, t3 michael@0: michael@0: addu_s.qb t2, t0, t1 michael@0: michael@0: sb t2, 0(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 1(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 2(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 3(a0) michael@0: addiu a3, a3, -4 michael@0: b 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: 1: michael@0: beqz a3, 3f michael@0: nop michael@0: 2: michael@0: lbu t8, 0(a1) michael@0: lbu t0, 0(a2) michael@0: lbu t1, 0(a0) michael@0: addiu a1, a1, 1 michael@0: addiu a2, a2, 1 michael@0: michael@0: mul t2, t0, t8 michael@0: shra_r.ph t3, t2, 8 michael@0: andi t3, t3, 0xff michael@0: addq.ph t2, t2, t3 michael@0: shra_r.ph t2, t2, 8 michael@0: andi t2, t2, 0xff michael@0: michael@0: addu_s.qb t2, t2, t1 michael@0: sb t2, 0(a0) michael@0: addiu a3, a3, -1 michael@0: bnez a3, 2b michael@0: addiu a0, a0, 1 michael@0: michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, v0, v1 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_8_8_8_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_n_8_8_asm_mips) michael@0: /* michael@0: * a0 - dst (a8) michael@0: * a1 - src (32bit constant) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, v0 michael@0: li t9, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: michael@0: srl v0, a3, 2 /* v0 = how many multiples of 4 dst pixels */ michael@0: beqz v0, 1f /* branch if less than 4 src pixels */ michael@0: nop michael@0: michael@0: srl t8, a1, 24 michael@0: replv.ph t8, t8 michael@0: michael@0: 0: michael@0: beqz v0, 1f michael@0: addiu v0, v0, -1 michael@0: lbu t0, 0(a2) michael@0: lbu t1, 1(a2) michael@0: lbu t2, 2(a2) michael@0: lbu t3, 3(a2) michael@0: lbu t4, 0(a0) michael@0: lbu t5, 1(a0) michael@0: lbu t6, 2(a0) michael@0: lbu t7, 3(a0) michael@0: michael@0: addiu a2, a2, 4 michael@0: michael@0: precr_sra.ph.w t1, t0, 0 michael@0: precr_sra.ph.w t3, t2, 0 michael@0: precr_sra.ph.w t5, t4, 0 michael@0: precr_sra.ph.w t7, t6, 0 michael@0: michael@0: precr.qb.ph t0, t3, t1 michael@0: precr.qb.ph t1, t7, t5 michael@0: michael@0: muleu_s.ph.qbl t2, t0, t8 michael@0: muleu_s.ph.qbr t3, t0, t8 michael@0: shra_r.ph t4, t2, 8 michael@0: shra_r.ph t5, t3, 8 michael@0: and t4, t4, t9 michael@0: and t5, t5, t9 michael@0: addq.ph t2, t2, t4 michael@0: addq.ph t3, t3, t5 michael@0: shra_r.ph t2, t2, 8 michael@0: shra_r.ph t3, t3, 8 michael@0: precr.qb.ph t0, t2, t3 michael@0: michael@0: addu_s.qb t2, t0, t1 michael@0: michael@0: sb t2, 0(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 1(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 2(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 3(a0) michael@0: addiu a3, a3, -4 michael@0: b 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: 1: michael@0: beqz a3, 3f michael@0: nop michael@0: srl t8, a1, 24 michael@0: 2: michael@0: lbu t0, 0(a2) michael@0: lbu t1, 0(a0) michael@0: addiu a2, a2, 1 michael@0: michael@0: mul t2, t0, t8 michael@0: shra_r.ph t3, t2, 8 michael@0: andi t3, t3, 0xff michael@0: addq.ph t2, t2, t3 michael@0: shra_r.ph t2, t2, 8 michael@0: andi t2, t2, 0xff michael@0: michael@0: addu_s.qb t2, t2, t1 michael@0: sb t2, 0(a0) michael@0: addiu a3, a3, -1 michael@0: bnez a3, 2b michael@0: addiu a0, a0, 1 michael@0: michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, v0 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_n_8_8_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_n_8_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (32bit constant) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2 michael@0: li t4, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: /* a1 = source (32bit constant) */ michael@0: lbu t0, 0(a2) /* t0 = mask (a8) */ michael@0: lbu t1, 1(a2) /* t1 = mask (a8) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */ michael@0: addiu a2, a2, 2 michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 a1, a1, \ michael@0: t0, t1, \ michael@0: t2, t3, \ michael@0: t5, t6, \ michael@0: t4, t7, t8, t9, s0, s1, s2 michael@0: michael@0: sw t5, 0(a0) michael@0: sw t6, 4(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: /* a1 = source (32bit constant) */ michael@0: lbu t0, 0(a2) /* t0 = mask (a8) */ michael@0: lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */ michael@0: michael@0: MIPS_UN8x4_MUL_UN8_ADD_UN8x4 a1, t0, t1, t2, t4, t3, t5, t6 michael@0: michael@0: sw t2, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_n_8_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_0565_8_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (r5g6b5) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: li t4, 0xf800f800 michael@0: li t5, 0x07e007e0 michael@0: li t6, 0x001F001F michael@0: li t7, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lhu t0, 0(a1) /* t0 = source (r5g6b5) */ michael@0: lhu t1, 2(a1) /* t1 = source (r5g6b5) */ michael@0: lbu t2, 0(a2) /* t2 = mask (a8) */ michael@0: lbu t3, 1(a2) /* t3 = mask (a8) */ michael@0: lhu t8, 0(a0) /* t8 = destination (r5g6b5) */ michael@0: lhu t9, 2(a0) /* t9 = destination (r5g6b5) */ michael@0: addiu a1, a1, 4 michael@0: addiu a2, a2, 2 michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, s0, s1, t5, t6, s2, s3, s4, s5 michael@0: CONVERT_2x0565_TO_2x8888 t8, t9, s2, s3, t5, t6, s4, s5, s6, s7 michael@0: MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 s0, s1, \ michael@0: t2, t3, \ michael@0: s2, s3, \ michael@0: t0, t1, \ michael@0: t7, s4, s5, s6, s7, t8, t9 michael@0: CONVERT_2x8888_TO_2x0565 t0, t1, s0, s1, t4, t5, t6, s2, s3 michael@0: michael@0: sh s0, 0(a0) michael@0: sh s1, 2(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lhu t0, 0(a1) /* t0 = source (r5g6b5) */ michael@0: lbu t1, 0(a2) /* t1 = mask (a8) */ michael@0: lhu t2, 0(a0) /* t2 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t0, t3, t4, t5 michael@0: CONVERT_1x0565_TO_1x8888 t2, t4, t5, t6 michael@0: MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t3, t1, t4, t0, t7, t2, t5, t6 michael@0: CONVERT_1x8888_TO_1x0565 t0, t3, t4, t5 michael@0: michael@0: sh t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_0565_8_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_8888_8_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2 michael@0: li t4, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: lbu t2, 0(a2) /* t2 = mask (a8) */ michael@0: lbu t3, 1(a2) /* t3 = mask (a8) */ michael@0: lw t5, 0(a0) /* t5 = destination (a8r8g8b8) */ michael@0: lw t6, 4(a0) /* t6 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 8 michael@0: addiu a2, a2, 2 michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 t0, t1, \ michael@0: t2, t3, \ michael@0: t5, t6, \ michael@0: t7, t8, \ michael@0: t4, t9, s0, s1, s2, t0, t1 michael@0: michael@0: sw t7, 0(a0) michael@0: sw t8, 4(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lbu t1, 0(a2) /* t1 = mask (a8) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: michael@0: MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t0, t1, t2, t3, t4, t5, t6, t7 michael@0: michael@0: sw t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_8888_8_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_8888_n_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (32bit constant) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2 michael@0: li t4, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: srl a2, a2, 24 michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: /* a2 = mask (32bit constant) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 8 michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 t0, t1, \ michael@0: a2, a2, \ michael@0: t2, t3, \ michael@0: t5, t6, \ michael@0: t4, t7, t8, t9, s0, s1, s2 michael@0: michael@0: sw t5, 0(a0) michael@0: sw t6, 4(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: /* a2 = mask (32bit constant) */ michael@0: lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */ michael@0: michael@0: MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t0, a2, t1, t3, t4, t5, t6, t7 michael@0: michael@0: sw t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_8888_n_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_8888_8888_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (a8r8g8b8) michael@0: * a3 - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2 michael@0: li t4, 0x00ff00ff michael@0: beqz a3, 3f michael@0: nop michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ michael@0: lw t2, 0(a2) /* t2 = mask (a8r8g8b8) */ michael@0: lw t3, 4(a2) /* t3 = mask (a8r8g8b8) */ michael@0: lw t5, 0(a0) /* t5 = destination (a8r8g8b8) */ michael@0: lw t6, 4(a0) /* t6 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 8 michael@0: addiu a2, a2, 8 michael@0: srl t2, t2, 24 michael@0: srl t3, t3, 24 michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8_ADD_2xUN8x4 t0, t1, \ michael@0: t2, t3, \ michael@0: t5, t6, \ michael@0: t7, t8, \ michael@0: t4, t9, s0, s1, s2, t0, t1 michael@0: michael@0: sw t7, 0(a0) michael@0: sw t8, 4(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ michael@0: lw t1, 0(a2) /* t1 = mask (a8r8g8b8) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: srl t1, t1, 24 michael@0: michael@0: MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t0, t1, t2, t3, t4, t5, t6, t7 michael@0: michael@0: sw t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_8888_8888_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_8_8_asm_mips) michael@0: /* michael@0: * a0 - dst (a8) michael@0: * a1 - src (a8) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 3f michael@0: nop michael@0: srl t9, a2, 2 /* t9 = how many multiples of 4 dst pixels */ michael@0: beqz t9, 1f /* branch if less than 4 src pixels */ michael@0: nop michael@0: michael@0: 0: michael@0: beqz t9, 1f michael@0: addiu t9, t9, -1 michael@0: lbu t0, 0(a1) michael@0: lbu t1, 1(a1) michael@0: lbu t2, 2(a1) michael@0: lbu t3, 3(a1) michael@0: lbu t4, 0(a0) michael@0: lbu t5, 1(a0) michael@0: lbu t6, 2(a0) michael@0: lbu t7, 3(a0) michael@0: michael@0: addiu a1, a1, 4 michael@0: michael@0: precr_sra.ph.w t1, t0, 0 michael@0: precr_sra.ph.w t3, t2, 0 michael@0: precr_sra.ph.w t5, t4, 0 michael@0: precr_sra.ph.w t7, t6, 0 michael@0: michael@0: precr.qb.ph t0, t3, t1 michael@0: precr.qb.ph t1, t7, t5 michael@0: michael@0: addu_s.qb t2, t0, t1 michael@0: michael@0: sb t2, 0(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 1(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 2(a0) michael@0: srl t2, t2, 8 michael@0: sb t2, 3(a0) michael@0: addiu a2, a2, -4 michael@0: b 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: 1: michael@0: beqz a2, 3f michael@0: nop michael@0: 2: michael@0: lbu t0, 0(a1) michael@0: lbu t1, 0(a0) michael@0: addiu a1, a1, 1 michael@0: michael@0: addu_s.qb t2, t0, t1 michael@0: sb t2, 0(a0) michael@0: addiu a2, a2, -1 michael@0: bnez a2, 2b michael@0: addiu a0, a0, 1 michael@0: michael@0: 3: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_8_8_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_add_8888_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 4f michael@0: nop michael@0: michael@0: srl t9, a2, 2 /* t1 = how many multiples of 4 src pixels */ michael@0: beqz t9, 3f /* branch if less than 4 src pixels */ michael@0: nop michael@0: 1: michael@0: addiu t9, t9, -1 michael@0: beqz t9, 2f michael@0: addiu a2, a2, -4 michael@0: michael@0: lw t0, 0(a1) michael@0: lw t1, 4(a1) michael@0: lw t2, 8(a1) michael@0: lw t3, 12(a1) michael@0: lw t4, 0(a0) michael@0: lw t5, 4(a0) michael@0: lw t6, 8(a0) michael@0: lw t7, 12(a0) michael@0: addiu a1, a1, 16 michael@0: michael@0: addu_s.qb t4, t4, t0 michael@0: addu_s.qb t5, t5, t1 michael@0: addu_s.qb t6, t6, t2 michael@0: addu_s.qb t7, t7, t3 michael@0: michael@0: sw t4, 0(a0) michael@0: sw t5, 4(a0) michael@0: sw t6, 8(a0) michael@0: sw t7, 12(a0) michael@0: b 1b michael@0: addiu a0, a0, 16 michael@0: 2: michael@0: lw t0, 0(a1) michael@0: lw t1, 4(a1) michael@0: lw t2, 8(a1) michael@0: lw t3, 12(a1) michael@0: lw t4, 0(a0) michael@0: lw t5, 4(a0) michael@0: lw t6, 8(a0) michael@0: lw t7, 12(a0) michael@0: addiu a1, a1, 16 michael@0: michael@0: addu_s.qb t4, t4, t0 michael@0: addu_s.qb t5, t5, t1 michael@0: addu_s.qb t6, t6, t2 michael@0: addu_s.qb t7, t7, t3 michael@0: michael@0: sw t4, 0(a0) michael@0: sw t5, 4(a0) michael@0: sw t6, 8(a0) michael@0: sw t7, 12(a0) michael@0: michael@0: beqz a2, 4f michael@0: addiu a0, a0, 16 michael@0: 3: michael@0: lw t0, 0(a1) michael@0: lw t1, 0(a0) michael@0: addiu a1, a1, 4 michael@0: addiu a2, a2, -1 michael@0: addu_s.qb t1, t1, t0 michael@0: sw t1, 0(a0) michael@0: bnez a2, 3b michael@0: addiu a0, a0, 4 michael@0: 4: michael@0: jr ra michael@0: nop michael@0: michael@0: END(pixman_composite_add_8888_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_out_reverse_8_0565_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (a8) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 4f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 0, s0, s1, s2, s3 michael@0: li t2, 0xf800f800 michael@0: li t3, 0x07e007e0 michael@0: li t4, 0x001F001F michael@0: li t5, 0x00ff00ff michael@0: michael@0: addiu t1, a2, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lbu t0, 0(a1) /* t0 = source (a8) */ michael@0: lbu t1, 1(a1) /* t1 = source (a8) */ michael@0: lhu t6, 0(a0) /* t6 = destination (r5g6b5) */ michael@0: lhu t7, 2(a0) /* t7 = destination (r5g6b5) */ michael@0: addiu a1, a1, 2 michael@0: michael@0: not t0, t0 michael@0: not t1, t1 michael@0: andi t0, 0xff /* t0 = neg source1 */ michael@0: andi t1, 0xff /* t1 = neg source2 */ michael@0: CONVERT_2x0565_TO_2x8888 t6, t7, t8, t9, t3, t4, s0, s1, s2, s3 michael@0: MIPS_2xUN8x4_MUL_2xUN8 t8, t9, t0, t1, t6, t7, t5, s0, s1, s2, s3, t8, t9 michael@0: CONVERT_2x8888_TO_2x0565 t6, t7, t8, t9, t2, t3, t4, s0, s1 michael@0: michael@0: sh t8, 0(a0) michael@0: sh t9, 2(a0) michael@0: addiu a2, a2, -2 michael@0: addiu t1, a2, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a2, 3f michael@0: nop michael@0: lbu t0, 0(a1) /* t0 = source (a8) */ michael@0: lhu t1, 0(a0) /* t1 = destination (r5g6b5) */ michael@0: michael@0: not t0, t0 michael@0: andi t0, 0xff /* t0 = neg source */ michael@0: CONVERT_1x0565_TO_1x8888 t1, t2, t3, t4 michael@0: MIPS_UN8x4_MUL_UN8 t2, t0, t1, t5, t3, t4, t6 michael@0: CONVERT_1x8888_TO_1x0565 t1, t2, t3, t4 michael@0: michael@0: sh t2, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3 michael@0: 4: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_out_reverse_8_0565_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_out_reverse_8_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (a8) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 3f michael@0: nop michael@0: li t4, 0x00ff00ff michael@0: addiu t1, a2, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: lbu t0, 0(a1) /* t0 = source (a8) */ michael@0: lbu t1, 1(a1) /* t1 = source (a8) */ michael@0: lw t2, 0(a0) /* t2 = destination (a8r8g8b8) */ michael@0: lw t3, 4(a0) /* t3 = destination (a8r8g8b8) */ michael@0: addiu a1, a1, 2 michael@0: not t0, t0 michael@0: not t1, t1 michael@0: andi t0, 0xff /* t0 = neg source */ michael@0: andi t1, 0xff /* t1 = neg source */ michael@0: michael@0: MIPS_2xUN8x4_MUL_2xUN8 t2, t3, t0, t1, t5, t6, t4, t7, t8, t9, t2, t3, t0 michael@0: michael@0: sw t5, 0(a0) michael@0: sw t6, 4(a0) michael@0: addiu a2, a2, -2 michael@0: addiu t1, a2, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 8 michael@0: 2: michael@0: beqz a2, 3f michael@0: nop michael@0: lbu t0, 0(a1) /* t0 = source (a8) */ michael@0: lw t1, 0(a0) /* t1 = destination (a8r8g8b8) */ michael@0: not t0, t0 michael@0: andi t0, 0xff /* t0 = neg source */ michael@0: michael@0: MIPS_UN8x4_MUL_UN8 t1, t0, t2, t4, t3, t5, t6 michael@0: michael@0: sw t2, 0(a0) michael@0: 3: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_out_reverse_8_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_over_reverse_n_8888_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - src (32bit constant) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 5f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: li t0, 0x00ff00ff michael@0: srl t9, a2, 2 /* t9 = how many multiples of 4 src pixels */ michael@0: beqz t9, 2f /* branch if less than 4 src pixels */ michael@0: nop michael@0: 1: michael@0: beqz t9, 2f michael@0: addiu t9, t9, -1 michael@0: michael@0: lw t1, 0(a0) michael@0: lw t2, 4(a0) michael@0: lw t3, 8(a0) michael@0: lw t4, 12(a0) michael@0: michael@0: addiu a2, a2, -4 michael@0: michael@0: not t5, t1 michael@0: not t6, t2 michael@0: not t7, t3 michael@0: not t8, t4 michael@0: srl t5, t5, 24 michael@0: srl t6, t6, 24 michael@0: srl t7, t7, 24 michael@0: srl t8, t8, 24 michael@0: replv.ph t5, t5 michael@0: replv.ph t6, t6 michael@0: replv.ph t7, t7 michael@0: replv.ph t8, t8 michael@0: muleu_s.ph.qbl s0, a1, t5 michael@0: muleu_s.ph.qbr s1, a1, t5 michael@0: muleu_s.ph.qbl s2, a1, t6 michael@0: muleu_s.ph.qbr s3, a1, t6 michael@0: muleu_s.ph.qbl s4, a1, t7 michael@0: muleu_s.ph.qbr s5, a1, t7 michael@0: muleu_s.ph.qbl s6, a1, t8 michael@0: muleu_s.ph.qbr s7, a1, t8 michael@0: michael@0: shra_r.ph t5, s0, 8 michael@0: shra_r.ph t6, s1, 8 michael@0: shra_r.ph t7, s2, 8 michael@0: shra_r.ph t8, s3, 8 michael@0: and t5, t5, t0 michael@0: and t6, t6, t0 michael@0: and t7, t7, t0 michael@0: and t8, t8, t0 michael@0: addq.ph s0, s0, t5 michael@0: addq.ph s1, s1, t6 michael@0: addq.ph s2, s2, t7 michael@0: addq.ph s3, s3, t8 michael@0: shra_r.ph s0, s0, 8 michael@0: shra_r.ph s1, s1, 8 michael@0: shra_r.ph s2, s2, 8 michael@0: shra_r.ph s3, s3, 8 michael@0: shra_r.ph t5, s4, 8 michael@0: shra_r.ph t6, s5, 8 michael@0: shra_r.ph t7, s6, 8 michael@0: shra_r.ph t8, s7, 8 michael@0: and t5, t5, t0 michael@0: and t6, t6, t0 michael@0: and t7, t7, t0 michael@0: and t8, t8, t0 michael@0: addq.ph s4, s4, t5 michael@0: addq.ph s5, s5, t6 michael@0: addq.ph s6, s6, t7 michael@0: addq.ph s7, s7, t8 michael@0: shra_r.ph s4, s4, 8 michael@0: shra_r.ph s5, s5, 8 michael@0: shra_r.ph s6, s6, 8 michael@0: shra_r.ph s7, s7, 8 michael@0: michael@0: precr.qb.ph t5, s0, s1 michael@0: precr.qb.ph t6, s2, s3 michael@0: precr.qb.ph t7, s4, s5 michael@0: precr.qb.ph t8, s6, s7 michael@0: addu_s.qb t5, t1, t5 michael@0: addu_s.qb t6, t2, t6 michael@0: addu_s.qb t7, t3, t7 michael@0: addu_s.qb t8, t4, t8 michael@0: michael@0: sw t5, 0(a0) michael@0: sw t6, 4(a0) michael@0: sw t7, 8(a0) michael@0: sw t8, 12(a0) michael@0: b 1b michael@0: addiu a0, a0, 16 michael@0: michael@0: 2: michael@0: beqz a2, 4f michael@0: nop michael@0: 3: michael@0: lw t1, 0(a0) michael@0: michael@0: not t2, t1 michael@0: srl t2, t2, 24 michael@0: replv.ph t2, t2 michael@0: michael@0: muleu_s.ph.qbl t4, a1, t2 michael@0: muleu_s.ph.qbr t5, a1, t2 michael@0: shra_r.ph t6, t4, 8 michael@0: shra_r.ph t7, t5, 8 michael@0: michael@0: and t6,t6,t0 michael@0: and t7,t7,t0 michael@0: michael@0: addq.ph t8, t4, t6 michael@0: addq.ph t9, t5, t7 michael@0: michael@0: shra_r.ph t8, t8, 8 michael@0: shra_r.ph t9, t9, 8 michael@0: michael@0: precr.qb.ph t9, t8, t9 michael@0: michael@0: addu_s.qb t9, t1, t9 michael@0: sw t9, 0(a0) michael@0: michael@0: addiu a2, a2, -1 michael@0: bnez a2, 3b michael@0: addiu a0, a0, 4 michael@0: 4: michael@0: RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: 5: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_over_reverse_n_8888_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_composite_in_n_8_asm_mips) michael@0: /* michael@0: * a0 - dst (a8) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - w michael@0: */ michael@0: michael@0: beqz a2, 5f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: move t7, a1 michael@0: srl t5, t7, 24 michael@0: replv.ph t5, t5 michael@0: srl t9, a2, 2 /* t1 = how many multiples of 4 src pixels */ michael@0: beqz t9, 2f /* branch if less than 4 src pixels */ michael@0: nop michael@0: michael@0: 1: michael@0: addiu t9, t9, -1 michael@0: addiu a2, a2, -4 michael@0: lbu t0, 0(a0) michael@0: lbu t1, 1(a0) michael@0: lbu t2, 2(a0) michael@0: lbu t3, 3(a0) michael@0: michael@0: muleu_s.ph.qbl s0, t0, t5 michael@0: muleu_s.ph.qbr s1, t0, t5 michael@0: muleu_s.ph.qbl s2, t1, t5 michael@0: muleu_s.ph.qbr s3, t1, t5 michael@0: muleu_s.ph.qbl s4, t2, t5 michael@0: muleu_s.ph.qbr s5, t2, t5 michael@0: muleu_s.ph.qbl s6, t3, t5 michael@0: muleu_s.ph.qbr s7, t3, t5 michael@0: michael@0: shrl.ph t4, s0, 8 michael@0: shrl.ph t6, s1, 8 michael@0: shrl.ph t7, s2, 8 michael@0: shrl.ph t8, s3, 8 michael@0: addq.ph t0, s0, t4 michael@0: addq.ph t1, s1, t6 michael@0: addq.ph t2, s2, t7 michael@0: addq.ph t3, s3, t8 michael@0: shra_r.ph t0, t0, 8 michael@0: shra_r.ph t1, t1, 8 michael@0: shra_r.ph t2, t2, 8 michael@0: shra_r.ph t3, t3, 8 michael@0: shrl.ph t4, s4, 8 michael@0: shrl.ph t6, s5, 8 michael@0: shrl.ph t7, s6, 8 michael@0: shrl.ph t8, s7, 8 michael@0: addq.ph s0, s4, t4 michael@0: addq.ph s1, s5, t6 michael@0: addq.ph s2, s6, t7 michael@0: addq.ph s3, s7, t8 michael@0: shra_r.ph t4, s0, 8 michael@0: shra_r.ph t6, s1, 8 michael@0: shra_r.ph t7, s2, 8 michael@0: shra_r.ph t8, s3, 8 michael@0: michael@0: precr.qb.ph s0, t0, t1 michael@0: precr.qb.ph s1, t2, t3 michael@0: precr.qb.ph s2, t4, t6 michael@0: precr.qb.ph s3, t7, t8 michael@0: michael@0: sb s0, 0(a0) michael@0: sb s1, 1(a0) michael@0: sb s2, 2(a0) michael@0: sb s3, 3(a0) michael@0: bgtz t9, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a2, 4f michael@0: nop michael@0: 3: michael@0: lbu t1, 0(a0) michael@0: michael@0: muleu_s.ph.qbl t4, t1, t5 michael@0: muleu_s.ph.qbr t7, t1, t5 michael@0: shrl.ph t6, t4, 8 michael@0: shrl.ph t0, t7, 8 michael@0: addq.ph t8, t4, t6 michael@0: addq.ph t9, t7, t0 michael@0: shra_r.ph t8, t8, 8 michael@0: shra_r.ph t9, t9, 8 michael@0: precr.qb.ph t2, t8, t9 michael@0: sb t2, 0(a0) michael@0: addiu a2, a2, -1 michael@0: bnez a2, 3b michael@0: addiu a0, a0, 1 michael@0: 4: michael@0: RESTORE_REGS_FROM_STACK 20, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: 5: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_composite_in_n_8_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_nearest_scanline_8888_8_0565_OVER_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (a8r8g8b8) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: * 16(sp) - vx michael@0: * 20(sp) - unit_x michael@0: */ michael@0: beqz a3, 4f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 20, v0, v1, s0, s1, s2, s3, s4, s5 michael@0: lw v0, 36(sp) /* v0 = vx */ michael@0: lw v1, 40(sp) /* v1 = unit_x */ michael@0: li t6, 0x00ff00ff michael@0: li t7, 0xf800f800 michael@0: li t8, 0x07e007e0 michael@0: li t9, 0x001F001F michael@0: michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: sra t0, v0, 16 /* t0 = vx >> 16 */ michael@0: sll t0, t0, 2 /* t0 = t0 * 4 (a8r8g8b8) */ michael@0: addu t0, a1, t0 michael@0: lw t0, 0(t0) /* t0 = source (a8r8g8b8) */ michael@0: addu v0, v0, v1 /* v0 = vx + unit_x */ michael@0: sra t1, v0, 16 /* t1 = vx >> 16 */ michael@0: sll t1, t1, 2 /* t1 = t1 * 4 (a8r8g8b8) */ michael@0: addu t1, a1, t1 michael@0: lw t1, 0(t1) /* t1 = source (a8r8g8b8) */ michael@0: addu v0, v0, v1 /* v0 = vx + unit_x */ michael@0: lbu t2, 0(a2) /* t2 = mask (a8) */ michael@0: lbu t3, 1(a2) /* t3 = mask (a8) */ michael@0: lhu t4, 0(a0) /* t4 = destination (r5g6b5) */ michael@0: lhu t5, 2(a0) /* t5 = destination (r5g6b5) */ michael@0: addiu a2, a2, 2 michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t4, t5, s0, s1, t8, t9, s2, s3, s4, s5 michael@0: OVER_2x8888_2x8_2x8888 t0, t1, \ michael@0: t2, t3, \ michael@0: s0, s1, \ michael@0: t4, t5, \ michael@0: t6, s2, s3, s4, s5, t2, t3 michael@0: CONVERT_2x8888_TO_2x0565 t4, t5, s0, s1, t7, t8, t9, s2, s3 michael@0: michael@0: sh s0, 0(a0) michael@0: sh s1, 2(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: sra t0, v0, 16 /* t0 = vx >> 16 */ michael@0: sll t0, t0, 2 /* t0 = t0 * 4 (a8r8g8b8) */ michael@0: addu t0, a1, t0 michael@0: lw t0, 0(t0) /* t0 = source (a8r8g8b8) */ michael@0: lbu t1, 0(a2) /* t1 = mask (a8) */ michael@0: lhu t2, 0(a0) /* t2 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t2, t3, t4, t5 michael@0: OVER_8888_8_8888 t0, t1, t3, t2, t6, t4, t5, t7, t8 michael@0: CONVERT_1x8888_TO_1x0565 t2, t3, t4, t5 michael@0: michael@0: sh t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 20, v0, v1, s0, s1, s2, s3, s4, s5 michael@0: 4: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_nearest_scanline_8888_8_0565_OVER_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_nearest_scanline_0565_8_0565_OVER_asm_mips) michael@0: /* michael@0: * a0 - dst (r5g6b5) michael@0: * a1 - src (r5g6b5) michael@0: * a2 - mask (a8) michael@0: * a3 - w michael@0: * 16(sp) - vx michael@0: * 20(sp) - unit_x michael@0: */ michael@0: michael@0: beqz a3, 4f michael@0: nop michael@0: SAVE_REGS_ON_STACK 20, v0, v1, s0, s1, s2, s3, s4, s5 michael@0: lw v0, 36(sp) /* v0 = vx */ michael@0: lw v1, 40(sp) /* v1 = unit_x */ michael@0: li t4, 0xf800f800 michael@0: li t5, 0x07e007e0 michael@0: li t6, 0x001F001F michael@0: li t7, 0x00ff00ff michael@0: michael@0: addiu t1, a3, -1 michael@0: beqz t1, 2f michael@0: nop michael@0: 1: michael@0: sra t0, v0, 16 /* t0 = vx >> 16 */ michael@0: sll t0, t0, 1 /* t0 = t0 * 2 (r5g6b5) */ michael@0: addu t0, a1, t0 michael@0: lhu t0, 0(t0) /* t0 = source (r5g6b5) */ michael@0: addu v0, v0, v1 /* v0 = vx + unit_x */ michael@0: sra t1, v0, 16 /* t1 = vx >> 16 */ michael@0: sll t1, t1, 1 /* t1 = t1 * 2 (r5g6b5) */ michael@0: addu t1, a1, t1 michael@0: lhu t1, 0(t1) /* t1 = source (r5g6b5) */ michael@0: addu v0, v0, v1 /* v0 = vx + unit_x */ michael@0: lbu t2, 0(a2) /* t2 = mask (a8) */ michael@0: lbu t3, 1(a2) /* t3 = mask (a8) */ michael@0: lhu t8, 0(a0) /* t8 = destination (r5g6b5) */ michael@0: lhu t9, 2(a0) /* t9 = destination (r5g6b5) */ michael@0: addiu a2, a2, 2 michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, s0, s1, t5, t6, s2, s3, s4, s5 michael@0: CONVERT_2x0565_TO_2x8888 t8, t9, s2, s3, t5, t6, s4, s5, t0, t1 michael@0: OVER_2x8888_2x8_2x8888 s0, s1, \ michael@0: t2, t3, \ michael@0: s2, s3, \ michael@0: t0, t1, \ michael@0: t7, t8, t9, s4, s5, s0, s1 michael@0: CONVERT_2x8888_TO_2x0565 t0, t1, s0, s1, t4, t5, t6, s2, s3 michael@0: michael@0: sh s0, 0(a0) michael@0: sh s1, 2(a0) michael@0: addiu a3, a3, -2 michael@0: addiu t1, a3, -1 michael@0: bgtz t1, 1b michael@0: addiu a0, a0, 4 michael@0: 2: michael@0: beqz a3, 3f michael@0: nop michael@0: sra t0, v0, 16 /* t0 = vx >> 16 */ michael@0: sll t0, t0, 1 /* t0 = t0 * 2 (r5g6b5) */ michael@0: addu t0, a1, t0 michael@0: michael@0: lhu t0, 0(t0) /* t0 = source (r5g6b5) */ michael@0: lbu t1, 0(a2) /* t1 = mask (a8) */ michael@0: lhu t2, 0(a0) /* t2 = destination (r5g6b5) */ michael@0: michael@0: CONVERT_1x0565_TO_1x8888 t0, t3, t4, t5 michael@0: CONVERT_1x0565_TO_1x8888 t2, t4, t5, t6 michael@0: OVER_8888_8_8888 t3, t1, t4, t0, t7, t2, t5, t6, t8 michael@0: CONVERT_1x8888_TO_1x0565 t0, t3, t4, t5 michael@0: michael@0: sh t3, 0(a0) michael@0: 3: michael@0: RESTORE_REGS_FROM_STACK 20, v0, v1, s0, s1, s2, s3, s4, s5 michael@0: 4: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_nearest_scanline_0565_8_0565_OVER_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8888_SRC_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *src_top michael@0: * a2 - *src_bottom michael@0: * a3 - w michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: */ michael@0: michael@0: beqz a3, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: michael@0: lw s0, 36(sp) /* s0 = wt */ michael@0: lw s1, 40(sp) /* s1 = wb */ michael@0: lw s2, 44(sp) /* s2 = vx */ michael@0: lw s3, 48(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 2 michael@0: addiu t8, t9, 4 michael@0: lwx t0, t9(a1) /* t0 = tl */ michael@0: lwx t1, t8(a1) /* t1 = tr */ michael@0: addiu a3, a3, -1 michael@0: lwx t2, t9(a2) /* t2 = bl */ michael@0: lwx t3, t8(a2) /* t3 = br */ michael@0: michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sw t0, 0(a0) michael@0: bnez a3, 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: RESTORE_REGS_FROM_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_8888_8888_SRC_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_0565_SRC_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *src_top michael@0: * a2 - *src_bottom michael@0: * a3 - w michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: */ michael@0: michael@0: beqz a3, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: michael@0: lw s0, 36(sp) /* s0 = wt */ michael@0: lw s1, 40(sp) /* s1 = wb */ michael@0: lw s2, 44(sp) /* s2 = vx */ michael@0: lw s3, 48(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 2 michael@0: addiu t8, t9, 4 michael@0: lwx t0, t9(a1) /* t0 = tl */ michael@0: lwx t1, t8(a1) /* t1 = tr */ michael@0: addiu a3, a3, -1 michael@0: lwx t2, t9(a2) /* t2 = bl */ michael@0: lwx t3, t8(a2) /* t3 = br */ michael@0: michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sh t1, 0(a0) michael@0: bnez a3, 0b michael@0: addiu a0, a0, 2 michael@0: michael@0: RESTORE_REGS_FROM_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_8888_0565_SRC_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_0565_8888_SRC_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *src_top michael@0: * a2 - *src_bottom michael@0: * a3 - w michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: */ michael@0: michael@0: beqz a3, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: michael@0: lw s0, 44(sp) /* s0 = wt */ michael@0: lw s1, 48(sp) /* s1 = wb */ michael@0: lw s2, 52(sp) /* s2 = vx */ michael@0: lw s3, 56(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: li v1, 0x07e007e0 michael@0: li s8, 0x001f001f michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 1 michael@0: addiu t8, t9, 2 michael@0: lhx t0, t9(a1) /* t0 = tl */ michael@0: lhx t1, t8(a1) /* t1 = tr */ michael@0: andi t1, t1, 0xffff michael@0: addiu a3, a3, -1 michael@0: lhx t2, t9(a2) /* t2 = bl */ michael@0: lhx t3, t8(a2) /* t3 = br */ michael@0: andi t3, t3, 0xffff michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, t0, t1, v1, s8, t4, t5, t6, t7 michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, t2, t3, v1, s8, t4, t5, t6, t7 michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sw t0, 0(a0) michael@0: bnez a3, 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_0565_8888_SRC_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_0565_0565_SRC_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *src_top michael@0: * a2 - *src_bottom michael@0: * a3 - w michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: */ michael@0: michael@0: beqz a3, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: michael@0: lw s0, 44(sp) /* s0 = wt */ michael@0: lw s1, 48(sp) /* s1 = wb */ michael@0: lw s2, 52(sp) /* s2 = vx */ michael@0: lw s3, 56(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: li v1, 0x07e007e0 michael@0: li s8, 0x001f001f michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 1 michael@0: addiu t8, t9, 2 michael@0: lhx t0, t9(a1) /* t0 = tl */ michael@0: lhx t1, t8(a1) /* t1 = tr */ michael@0: andi t1, t1, 0xffff michael@0: addiu a3, a3, -1 michael@0: lhx t2, t9(a2) /* t2 = bl */ michael@0: lhx t3, t8(a2) /* t3 = br */ michael@0: andi t3, t3, 0xffff michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, t0, t1, v1, s8, t4, t5, t6, t7 michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, t2, t3, v1, s8, t4, t5, t6, t7 michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sh t1, 0(a0) michael@0: bnez a3, 0b michael@0: addiu a0, a0, 2 michael@0: michael@0: RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_0565_0565_SRC_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8888_OVER_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *src_top michael@0: * a2 - *src_bottom michael@0: * a3 - w michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: */ michael@0: michael@0: beqz a3, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 24, v0, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: michael@0: lw s0, 40(sp) /* s0 = wt */ michael@0: lw s1, 44(sp) /* s1 = wb */ michael@0: lw s2, 48(sp) /* s2 = vx */ michael@0: lw s3, 52(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: li s8, 0x00ff00ff michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 2 michael@0: addiu t8, t9, 4 michael@0: lwx t0, t9(a1) /* t0 = tl */ michael@0: lwx t1, t8(a1) /* t1 = tr */ michael@0: addiu a3, a3, -1 michael@0: lwx t2, t9(a2) /* t2 = bl */ michael@0: lwx t3, t8(a2) /* t3 = br */ michael@0: michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: lw t1, 0(a0) /* t1 = dest */ michael@0: OVER_8888_8888 t0, t1, t2, s8, t3, t4, t5, t6 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sw t2, 0(a0) michael@0: bnez a3, 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: RESTORE_REGS_FROM_STACK 24, v0, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_8888_8888_OVER_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8888_ADD_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *src_top michael@0: * a2 - *src_bottom michael@0: * a3 - w michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: */ michael@0: michael@0: beqz a3, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: michael@0: lw s0, 36(sp) /* s0 = wt */ michael@0: lw s1, 40(sp) /* s1 = wb */ michael@0: lw s2, 44(sp) /* s2 = vx */ michael@0: lw s3, 48(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 2 michael@0: addiu t8, t9, 4 michael@0: lwx t0, t9(a1) /* t0 = tl */ michael@0: lwx t1, t8(a1) /* t1 = tr */ michael@0: addiu a3, a3, -1 michael@0: lwx t2, t9(a2) /* t2 = bl */ michael@0: lwx t3, t8(a2) /* t3 = br */ michael@0: michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: lw t1, 0(a0) michael@0: addu_s.qb t2, t0, t1 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sw t2, 0(a0) michael@0: bnez a3, 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: RESTORE_REGS_FROM_STACK 20, v0, s0, s1, s2, s3, s4, s5, s6, s7 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_8888_8888_ADD_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_8888_SRC_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *mask michael@0: * a2 - *src_top michael@0: * a3 - *src_bottom michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: * 32(sp) - w michael@0: */ michael@0: michael@0: lw v1, 32(sp) michael@0: beqz v1, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: michael@0: lw s0, 44(sp) /* s0 = wt */ michael@0: lw s1, 48(sp) /* s1 = wb */ michael@0: lw s2, 52(sp) /* s2 = vx */ michael@0: lw s3, 56(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: li s8, 0x00ff00ff michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 2 michael@0: addiu t8, t9, 4 michael@0: lwx t0, t9(a2) /* t0 = tl */ michael@0: lwx t1, t8(a2) /* t1 = tr */ michael@0: addiu v1, v1, -1 michael@0: lwx t2, t9(a3) /* t2 = bl */ michael@0: lwx t3, t8(a3) /* t3 = br */ michael@0: michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: lbu t1, 0(a1) /* t1 = mask */ michael@0: addiu a1, a1, 1 michael@0: MIPS_UN8x4_MUL_UN8 t0, t1, t0, s8, t2, t3, t4 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sw t0, 0(a0) michael@0: bnez v1, 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_8888_8_8888_SRC_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_0565_SRC_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *mask michael@0: * a2 - *src_top michael@0: * a3 - *src_bottom michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: * 32(sp) - w michael@0: */ michael@0: michael@0: lw v1, 32(sp) michael@0: beqz v1, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: michael@0: lw s0, 44(sp) /* s0 = wt */ michael@0: lw s1, 48(sp) /* s1 = wb */ michael@0: lw s2, 52(sp) /* s2 = vx */ michael@0: lw s3, 56(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: li s8, 0x00ff00ff michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 2 michael@0: addiu t8, t9, 4 michael@0: lwx t0, t9(a2) /* t0 = tl */ michael@0: lwx t1, t8(a2) /* t1 = tr */ michael@0: addiu v1, v1, -1 michael@0: lwx t2, t9(a3) /* t2 = bl */ michael@0: lwx t3, t8(a3) /* t3 = br */ michael@0: michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: lbu t1, 0(a1) /* t1 = mask */ michael@0: addiu a1, a1, 1 michael@0: MIPS_UN8x4_MUL_UN8 t0, t1, t0, s8, t2, t3, t4 michael@0: CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sh t1, 0(a0) michael@0: bnez v1, 0b michael@0: addiu a0, a0, 2 michael@0: michael@0: RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_8888_8_0565_SRC_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_0565_8_x888_SRC_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *mask michael@0: * a2 - *src_top michael@0: * a3 - *src_bottom michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: * 32(sp) - w michael@0: */ michael@0: michael@0: lw t0, 32(sp) michael@0: beqz t0, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 32, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8, ra michael@0: michael@0: lw s0, 48(sp) /* s0 = wt */ michael@0: lw s1, 52(sp) /* s1 = wb */ michael@0: lw s2, 56(sp) /* s2 = vx */ michael@0: lw s3, 60(sp) /* s3 = unit_x */ michael@0: lw ra, 64(sp) /* ra = w */ michael@0: li v0, 0x00ff00ff michael@0: li v1, 0x07e007e0 michael@0: li s8, 0x001f001f michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: li t5, BILINEAR_INTERPOLATION_RANGE michael@0: subu t5, t5, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 1 michael@0: addiu t8, t9, 2 michael@0: lhx t0, t9(a2) /* t0 = tl */ michael@0: lhx t1, t8(a2) /* t1 = tr */ michael@0: andi t1, t1, 0xffff michael@0: addiu ra, ra, -1 michael@0: lhx t2, t9(a3) /* t2 = bl */ michael@0: lhx t3, t8(a3) /* t3 = br */ michael@0: andi t3, t3, 0xffff michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, t0, t1, v1, s8, t4, t5, t6, t7 michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, t2, t3, v1, s8, t4, t5, t6, t7 michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: lbu t1, 0(a1) /* t1 = mask */ michael@0: addiu a1, a1, 1 michael@0: MIPS_UN8x4_MUL_UN8 t0, t1, t0, v0, t2, t3, t4 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sw t0, 0(a0) michael@0: bnez ra, 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: RESTORE_REGS_FROM_STACK 32, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8, ra michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_0565_8_x888_SRC_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_0565_8_0565_SRC_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *mask michael@0: * a2 - *src_top michael@0: * a3 - *src_bottom michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: * 32(sp) - w michael@0: */ michael@0: michael@0: lw t0, 32(sp) michael@0: beqz t0, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 32, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8, ra michael@0: michael@0: lw s0, 48(sp) /* s0 = wt */ michael@0: lw s1, 52(sp) /* s1 = wb */ michael@0: lw s2, 56(sp) /* s2 = vx */ michael@0: lw s3, 60(sp) /* s3 = unit_x */ michael@0: lw ra, 64(sp) /* ra = w */ michael@0: li v0, 0x00ff00ff michael@0: li v1, 0x07e007e0 michael@0: li s8, 0x001f001f michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: li t5, BILINEAR_INTERPOLATION_RANGE michael@0: subu t5, t5, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 1 michael@0: addiu t8, t9, 2 michael@0: lhx t0, t9(a2) /* t0 = tl */ michael@0: lhx t1, t8(a2) /* t1 = tr */ michael@0: andi t1, t1, 0xffff michael@0: addiu ra, ra, -1 michael@0: lhx t2, t9(a3) /* t2 = bl */ michael@0: lhx t3, t8(a3) /* t3 = br */ michael@0: andi t3, t3, 0xffff michael@0: michael@0: CONVERT_2x0565_TO_2x8888 t0, t1, t0, t1, v1, s8, t4, t5, t6, t7 michael@0: CONVERT_2x0565_TO_2x8888 t2, t3, t2, t3, v1, s8, t4, t5, t6, t7 michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: lbu t1, 0(a1) /* t1 = mask */ michael@0: addiu a1, a1, 1 michael@0: MIPS_UN8x4_MUL_UN8 t0, t1, t0, v0, t2, t3, t4 michael@0: CONVERT_1x8888_TO_1x0565 t0, t1, t2, t3 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sh t1, 0(a0) michael@0: bnez ra, 0b michael@0: addiu a0, a0, 2 michael@0: michael@0: RESTORE_REGS_FROM_STACK 32, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8, ra michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_0565_8_0565_SRC_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_8888_OVER_asm_mips) michael@0: /* michael@0: * a0 - dst (a8r8g8b8) michael@0: * a1 - mask (a8) michael@0: * a2 - src_top (a8r8g8b8) michael@0: * a3 - src_bottom (a8r8g8b8) michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: * 32(sp) - w michael@0: */ michael@0: michael@0: SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: michael@0: lw v1, 60(sp) /* v1 = w(sp + 32 + 28 save regs stack offset)*/ michael@0: beqz v1, 1f michael@0: nop michael@0: michael@0: lw s0, 44(sp) /* s0 = wt */ michael@0: lw s1, 48(sp) /* s1 = wb */ michael@0: lw s2, 52(sp) /* s2 = vx */ michael@0: lw s3, 56(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: li s8, 0x00ff00ff michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 2 michael@0: addiu t8, t9, 4 michael@0: lwx t0, t9(a2) /* t0 = tl */ michael@0: lwx t1, t8(a2) /* t1 = tr */ michael@0: addiu v1, v1, -1 michael@0: lwx t2, t9(a3) /* t2 = bl */ michael@0: lwx t3, t8(a3) /* t3 = br */ michael@0: michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, \ michael@0: t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: lbu t1, 0(a1) /* t1 = mask */ michael@0: lw t2, 0(a0) /* t2 = dst */ michael@0: addiu a1, a1, 1 michael@0: OVER_8888_8_8888 t0, t1, t2, t0, s8, t3, t4, t5, t6 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sw t0, 0(a0) michael@0: bnez v1, 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: 1: michael@0: RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_8888_8_8888_OVER_asm_mips) michael@0: michael@0: LEAF_MIPS_DSPR2(pixman_scaled_bilinear_scanline_8888_8_8888_ADD_asm_mips) michael@0: /* michael@0: * a0 - *dst michael@0: * a1 - *mask michael@0: * a2 - *src_top michael@0: * a3 - *src_bottom michael@0: * 16(sp) - wt michael@0: * 20(sp) - wb michael@0: * 24(sp) - vx michael@0: * 28(sp) - unit_x michael@0: * 32(sp) - w michael@0: */ michael@0: michael@0: lw v1, 32(sp) michael@0: beqz v1, 1f michael@0: nop michael@0: michael@0: SAVE_REGS_ON_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: michael@0: lw s0, 44(sp) /* s0 = wt */ michael@0: lw s1, 48(sp) /* s1 = wb */ michael@0: lw s2, 52(sp) /* s2 = vx */ michael@0: lw s3, 56(sp) /* s3 = unit_x */ michael@0: li v0, BILINEAR_INTERPOLATION_RANGE michael@0: li s8, 0x00ff00ff michael@0: michael@0: sll s0, s0, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: sll s1, s1, (2 * (8 - BILINEAR_INTERPOLATION_BITS)) michael@0: 0: michael@0: andi t4, s2, 0xffff /* t4 = (short)vx */ michael@0: srl t4, t4, (16 - BILINEAR_INTERPOLATION_BITS) /* t4 = vx >> 8 */ michael@0: subu t5, v0, t4 /* t5 = ( 256 - (vx>>8)) */ michael@0: michael@0: mul s4, s0, t5 /* s4 = wt*(256-(vx>>8)) */ michael@0: mul s5, s0, t4 /* s5 = wt*(vx>>8) */ michael@0: mul s6, s1, t5 /* s6 = wb*(256-(vx>>8)) */ michael@0: mul s7, s1, t4 /* s7 = wb*(vx>>8) */ michael@0: michael@0: sra t9, s2, 16 michael@0: sll t9, t9, 2 michael@0: addiu t8, t9, 4 michael@0: lwx t0, t9(a2) /* t0 = tl */ michael@0: lwx t1, t8(a2) /* t1 = tr */ michael@0: addiu v1, v1, -1 michael@0: lwx t2, t9(a3) /* t2 = bl */ michael@0: lwx t3, t8(a3) /* t3 = br */ michael@0: michael@0: BILINEAR_INTERPOLATE_SINGLE_PIXEL t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, s4, s5, s6, s7 michael@0: lbu t1, 0(a1) /* t1 = mask */ michael@0: lw t2, 0(a0) /* t2 = dst */ michael@0: addiu a1, a1, 1 michael@0: MIPS_UN8x4_MUL_UN8_ADD_UN8x4 t0, t1, t2, t0, s8, t3, t4, t5 michael@0: michael@0: addu s2, s2, s3 /* vx += unit_x; */ michael@0: sw t0, 0(a0) michael@0: bnez v1, 0b michael@0: addiu a0, a0, 4 michael@0: michael@0: RESTORE_REGS_FROM_STACK 28, v0, v1, s0, s1, s2, s3, s4, s5, s6, s7, s8 michael@0: 1: michael@0: j ra michael@0: nop michael@0: michael@0: END(pixman_scaled_bilinear_scanline_8888_8_8888_ADD_asm_mips)