llvm-6502/lib
Nate Begeman 1b75022cd3 Implement bitfield insert by recognizing the following pattern:
1. optional shift left
2. and x, immX
3. and y, immY
4. or z, x, y
==> rlwimi z, x, y, shift, mask begin, mask end

where immX == ~immY and immX is a run of set bits. This transformation
fires 32 times on voronoi, once on espresso, and probably several
dozen times on external benchmarks such as gcc.

To put this in terms of actual code generated for
struct B { unsigned a : 3; unsigned b : 2; };
void storeA (struct B *b, int v) { b->a = v;}
void storeB (struct B *b, int v) { b->b = v;}

Old:
_storeA:
        rlwinm r2, r4, 0, 29, 31
        lwz r4, 0(r3)
        rlwinm r4, r4, 0, 0, 28
        or r2, r4, r2
        stw r2, 0(r3)
        blr

_storeB:
        rlwinm r2, r4, 3, 0, 28
        rlwinm r2, r2, 0, 27, 28
        lwz r4, 0(r3)
        rlwinm r4, r4, 0, 29, 26
        or r2, r2, r4
        stw r2, 0(r3)
        blr

New:
_storeA:
        lwz r2, 0(r3)
        rlwimi r2, r4, 0, 29, 31
        stw r2, 0(r3)
        blr

_storeB:
        lwz r2, 0(r3)
        rlwimi r2, r4, 3, 27, 28
        stw r2, 0(r3)
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17078 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-17 05:19:20 +00:00
..
Analysis Add support for unreachable 2004-10-16 18:21:33 +00:00
Archive Changes For Bug 352 2004-09-01 22:55:40 +00:00
AsmParser Parse undef and unreachable 2004-10-16 18:17:13 +00:00
Bytecode Do not erroneously accept revision 6 bytecode files when the format hasn't 2004-10-16 18:56:02 +00:00
CodeGen Add support for undef 2004-10-16 18:19:26 +00:00
Debugger Update to reflect changes in Makefile rules. 2004-10-13 11:46:52 +00:00
ExecutionEngine Add support for unreachable 2004-10-16 18:21:33 +00:00
Linker Add support for undef and unreachable 2004-10-16 18:08:06 +00:00
Support Update to reflect changes in Makefile rules. 2004-10-13 11:46:52 +00:00
System Allow this file to compile on Darwin. 2004-10-14 03:33:25 +00:00
Target Implement bitfield insert by recognizing the following pattern: 2004-10-17 05:19:20 +00:00
Transforms Fix a type violation 2004-10-16 23:28:04 +00:00
VMCore Fix constant folding relational operators with undef operands. 2004-10-17 04:01:51 +00:00
Makefile Wrap long line 2004-09-15 01:34:42 +00:00
Makefile.am Update to reflect changes in Makefile rules. 2004-10-13 11:46:52 +00:00