1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/lib
Nate Begeman 47cd13d42a Handle some more real world cases of rlwimi. These don't come up that
regularly in "normal" code, but for things like software graphics, they
make a big difference.

For the following code:
unsigned short Trans16Bit(unsigned srcA,unsigned srcB,unsigned alpha)
{
	unsigned tmpA,tmpB,mixed;
	tmpA = ((srcA & 0x03E0) << 15) | (srcA & 0x7C1F);
	tmpB = ((srcB & 0x03E0) << 15) | (srcB & 0x7C1F);
	mixed = (tmpA * alpha) + (tmpB * (32 - alpha));
	return ((mixed >> 5) & 0x7C1F) | ((mixed >> 20) & 0x03E0);
}

We now generate:
_Trans16Bit:
.LBB_Trans16Bit_0:      ; entry
        andi. r2, r4, 31775
        rlwimi r2, r4, 15, 7, 11
        subfic r4, r5, 32
        mullw r2, r2, r4
        andi. r4, r3, 31775
        rlwimi r4, r3, 15, 7, 11
        mullw r3, r4, r5
        add r2, r2, r3
        srwi r3, r2, 5
        andi. r3, r3, 31775
        rlwimi r3, r2, 12, 22, 26
        blr

Instead of:
_Trans16Bit:
.LBB_Trans16Bit_0:      ; entry
        slwi r2, r4, 15
        rlwinm r2, r2, 0, 7, 11
        andi. r4, r4, 31775
        or r2, r2, r4
        subfic r4, r5, 32
        mullw r2, r2, r4
        slwi r4, r3, 15
        rlwinm r4, r4, 0, 7, 11
        andi. r3, r3, 31775
        or r3, r4, r3
        mullw r3, r3, r5
        add r2, r2, r3
        srwi r3, r2, 5
        andi. r3, r3, 31775
        srwi r2, r2, 20
        rlwimi r3, r2, 0, 22, 26
        blr

llvm-svn: 22201
2005-06-08 04:14:27 +00:00
..
Analysis By definition, 'tail' calls cannot access the stack frame of their caller. 2005-05-08 23:58:12 +00:00
AsmParser Give the asmparser the ability to parse strings. Patch contributed by 2005-05-20 03:25:47 +00:00
Bytecode Remove code for conversion from old style va_args. Preparing the way for 2005-06-08 00:49:08 +00:00
CodeGen aCC and STLport complained about this, because they're like that 2005-05-15 13:05:48 +00:00
Debugger Remove trailing whitespace 2005-04-21 22:36:52 +00:00
ExecutionEngine Fix a really horrible problem that causes the JIT to miscompile any program 2005-05-12 06:01:28 +00:00
Linker Preserve CC's when linking modules 2005-05-09 01:09:39 +00:00
Support HP-UX system headers make a mess of isinf(), so much so that gcc fixincludes 2005-05-16 06:45:57 +00:00
System Put in a hack for Cygwin that prevents mkdtemp from being used since 2005-06-02 05:38:20 +00:00
Target Handle some more real world cases of rlwimi. These don't come up that 2005-06-08 04:14:27 +00:00
Transforms hack to fix bzip2 (bug 571) 2005-06-04 12:43:56 +00:00
VMCore Some cleanups for compilation with GCC 4.0.0 to remove warnings: 2005-05-15 16:13:11 +00:00
Makefile Add the Linker library 2004-11-14 21:54:41 +00:00