llvm-6502/lib/Target/PowerPC
Nate Begeman b2c4bf3ff6 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22201 91177308-0d34-0410-b5e6-96231b3b80d8
2005-06-08 04:14:27 +00:00
..
.cvsignore ignore generated files. 2004-11-21 00:00:54 +00:00
LICENSE.TXT Added Louis Gerbarg. Louis is given credit in the CREDITS.TXT file, so I 2004-08-05 23:46:27 +00:00
Makefile Specify all of the targets built. 2004-12-16 17:26:44 +00:00
PowerPC.td Factor out common .td file chunks. 2004-12-16 16:31:57 +00:00
PowerPCInstrInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PowerPCTargetMachine.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPC32.td Factor out common .td file chunks. 2004-12-16 16:31:57 +00:00
PPC32ISelSimple.cpp Convert tabs to spaces 2005-04-22 17:54:37 +00:00
PPC32JITInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPC32RegisterInfo.td Initial support for allocation condition registers 2005-04-12 07:04:16 +00:00
PPC64.td Factor out common .td file chunks. 2004-12-16 16:31:57 +00:00
PPC64CodeEmitter.cpp Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPC64InstrInfo.cpp Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPC64InstrInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPC64ISelPattern.cpp Fix andrews changes to fit in 80 columns 2005-05-15 19:54:37 +00:00
PPC64JITInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPC64RegisterInfo.cpp Convert tabs to spaces 2005-04-22 17:54:37 +00:00
PPC64RegisterInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPC64RegisterInfo.td Switch from bytes to bits for alignment. 2004-08-21 20:14:40 +00:00
PPC64TargetMachine.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPC.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCAsmPrinter.cpp Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCBranchSelector.cpp Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCCodeEmitter.cpp Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCFrameInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCInstrBuilder.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCInstrFormats.td switch over the rest of the formats that use RC to use isDOT 2005-04-19 05:21:30 +00:00
PPCInstrInfo.cpp Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCInstrInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCInstrInfo.td PPC "branch and link" instructions are branches in the PPC sense, but not 2005-05-15 20:11:44 +00:00
PPCISelPattern.cpp Handle some more real world cases of rlwimi. These don't come up that 2005-06-08 04:14:27 +00:00
PPCJITInfo.cpp Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCJITInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCRegisterInfo.cpp Convert tabs to spaces 2005-04-22 17:54:37 +00:00
PPCRegisterInfo.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCRegisterInfo.td Revamp the Register class, and allow the use of the RegisterGroup class to 2004-09-14 04:17:02 +00:00
PPCRelocations.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCTargetMachine.cpp Remove trailing whitespace 2005-04-21 23:30:14 +00:00
PPCTargetMachine.h Remove trailing whitespace 2005-04-21 23:30:14 +00:00
README.txt Update PPC readme. Remove things that are done or aren't ppc specific 2005-04-11 20:48:57 +00:00

TODO:
* condition register allocation
* gpr0 allocation
* implement do-loop -> bdnz transform
* implement powerpc-64 for darwin
* use stfiwx in float->int
* should hint to the branch select pass that it doesn't need to print the
  second unconditional branch, so we don't end up with things like:
	b .LBBl42__2E_expand_function_8_674	; loopentry.24
	b .LBBl42__2E_expand_function_8_42	; NewDefault
	b .LBBl42__2E_expand_function_8_42	; NewDefault

Currently failing tests that should pass:
* MultiSource
  |- Applications
  |  `- hbd: miscompilation