regs[creg][TGA_REG_GMOR] = 0x0007;	 regs[creg][TGA_REG_GOPR] = alu;
alphaTgaDoBitbltSimple(		unsigned int *psrcBase,		unsigned int *pdstBase,		unsigned int widthSrc,		unsigned int widthDst,		tga_reg_t **regs,		int alu,		int sx,		int sy,		int dx,		int dy,		int h,		int w,		int xdir,		int ydir){	unsigned psrcLine, pdstLine;	unsigned dpremask, dpostmask;	int rw, endx;	int x, y, pshift;	int dx_align;	int sdirm, ddirm;	int cxdir = xdir; /* current xdir */	int creg = 0;	regs[creg][TGA_REG_GMOR] = 0x0007;	/* Copy Mode */	regs[creg][TGA_REG_GOPR] = 0x0003;	/* GXcopy */	switch (alu) {	case GXclear:		alu = 0x0;	case GXand:		alu = 0x1;	case GXandReverse:		alu = 0x2;	case GXcopy:		alu = 0x3;	case GXandInverted:		alu = 0x4;	case GXnoop:		alu = 0x5;	case GXxor:		alu = 0x6;	case GXor:		alu = 0x7;	case GXnor:		alu = 0x8;	case GXequiv:		alu = 0x9;	case GXinvert:		alu = 0xa;	case GXorReverse:		alu = 0xb;	case GXcopyInverted:		alu = 0xc;	case GXorInverted:		alu = 0xd;	case GXnand:		alu = 0xe;	case GXset:		alu = 0xf;	}	if (sy != dy)		/* Source and dest are not on a line, */		cxdir = 1;	/* so just forward copy */	if (cxdir == -1) {		sx += w;		dx += w;		w  *= -1;	}	if (ydir == 1) {		psrcLine = sy * widthSrc * 4;		pdstLine = dy * widthDst * 4;	} else {		psrcLine = (sy+h-1) * -widthSrc * 4;		pdstLine = (dy+h-1) * -widthDst * 4;	}	/*	 * Prepare the masks, starting addresses and lengths	 * up front.	 */	dpostmask  = 0;	sdirm = sx & ~0x7;	ddirm = dx & ~0x7;	dx_align = dx - ddirm;	pshift = dx_align - (sx - sdirm);	if ((cxdir*pshift < 0) || (cxdir == -1 && pshift == 0)) {		pshift   += cxdir*8;		ddirm    -= cxdir*8;		dx_align += cxdir*8;	}	rw = abs(dx_align + w) + (cxdir==-1?8:0);	endx = rw & 0x1f;	if (cxdir == 1) {		dpremask  = ~0U << dx_align;		dpostmask = ~0U >> (32 - endx);		if (endx && (rw < 32)) {			dpremask &= dpostmask;			dpostmask = 0;		}	} else {		if (dx_align < 0)			dpremask = (~0U<<16) |			    (((0xff >> (-dx_align)) & 0xff) << 8);		else			dpremask = (~0U<<8) |			    ((0xff >> (8-dx_align)) & 0xff);		endx = 32 - endx;		if (endx < 8) {			dpostmask = ~0U >> 8;			dpostmask |= ((0xff << endx) & 0xff) << 24;		} else if (endx < 16) {			dpostmask = ~0U >> 16;			dpostmask |= ((0xff << (endx - 8)) & 0xff) << 16;		} else if (endx < 24) {			dpostmask = ~0U >> 24;			dpostmask |= ((0xff << (endx - 16)) & 0xff) << 8;		} else {			dpostmask = (0xff << (endx - 24)) & 0xff;		}		if (endx && (rw < 32)) {			dpremask &= dpostmask;			dpostmask = 0;		}	}#define mb    __asm__ __volatile__("mb" : : : "memory")	mb;	regs[creg][TGA_REG_GPSR] = pshift;	while (h--) {	    unsigned char *Bsrc;	    unsigned char *Bdst;	    int xloop = rw;	    Bsrc = (unsigned char *)(psrcBase) + psrcLine + sdirm;	    Bdst = (unsigned char *)(pdstBase) + pdstLine + ddirm;	    mb;	    x = 0;	    *((unsigned *)Bsrc + x) = ~0; mb;	    *((unsigned *)Bdst + x) = dpremask; mb;	    x += cxdir*32;	    xloop -= 32;#if 0	    for (; xloop >= 64; x += cxdir*64, xloop -= 64) {		regs[creg][TGA_REG_GCSR]   = psrcLine + sdirm + x;		regs[creg++][TGA_REG_GCDR] = pdstLine + ddirm + x;		if (creg > 3)			creg = 0;	    }#else	    for (; xloop >= 32; x += cxdir*32, xloop -= 32) {		*((unsigned *)(Bsrc + x)) = ~0; mb;		*((unsigned *)(Bdst + x)) = ~0; mb;	    }#endif	    if (xloop >= 32) {		*((unsigned *)(Bsrc + x)) = ~0; mb;		*((unsigned *)(Bdst + x)) = ~0; mb;		x += cxdir*32;		xloop -= 32;	    }	    if (xloop > 0) {		*((unsigned *)(Bsrc + x)) = ~0; mb;		*((unsigned *)(Bdst + x)) = dpostmask; mb;	    }	    psrcLine += widthSrc * 4;	    pdstLine += widthDst * 4;	}	mb;	regs[creg][TGA_REG_GPSR] = 0;	regs[creg][TGA_REG_GMOR] = 0x0000;	/* Simple Mode */	regs[creg][TGA_REG_GOPR] = 0x0003;	/* GXcopy */#undef mb}