llvm-mirror/lib
Chris Lattner 3057944738 Legalize is no longer limited to cleverness with just constant shift amounts.
Allow it to be clever when possible and fall back to the gross code when needed.

This allows us to compile:

long long foo1(long long X, int C) {
  return X << (C|32);
}
long long foo2(long long X, int C) {
  return X << (C&~32);
}

to:
_foo1:
        rlwinm r2, r5, 0, 27, 31
        slw r3, r4, r2
        li r4, 0
        blr


        .globl  _foo2
        .align  4
_foo2:
        rlwinm r2, r5, 0, 27, 25
        subfic r5, r2, 32
        slw r3, r3, r2
        srw r5, r4, r5
        or r3, r3, r5
        slw r4, r4, r2
        blr

instead of:

_foo1:
        ori r2, r5, 32
        subfic r5, r2, 32
        addi r6, r2, -32
        srw r5, r4, r5
        slw r3, r3, r2
        slw r6, r4, r6
        or r3, r3, r5
        slw r4, r4, r2
        or r3, r3, r6
        blr


        .globl  _foo2
        .align  4
_foo2:
        rlwinm r2, r5, 0, 27, 25
        subfic r5, r2, 32
        addi r6, r2, -32
        srw r5, r4, r5
        slw r3, r3, r2
        slw r6, r4, r6
        or r3, r3, r5
        slw r4, r4, r2
        or r3, r3, r6
        blr

llvm-svn: 30507
2006-09-20 03:47:40 +00:00
..
Analysis Explain change with a comment. 2006-09-17 17:51:00 +00:00
AsmParser Added some eye-candy for Subtarget type checking 2006-09-17 20:25:45 +00:00
Bytecode Small fixes for supporting dll* linkage types 2006-09-17 13:06:18 +00:00
CodeGen Expand 64-bit shifts more optimally if we know that the high bit of the 2006-09-20 03:38:48 +00:00
Debugger For PR797: 2006-08-25 17:43:11 +00:00
ExecutionEngine Unbreak the JIT 2006-09-15 04:56:11 +00:00
Linker Adding dllimport, dllexport and external weak linkage types. 2006-09-14 18:23:27 +00:00
Support Instantiate Statistic<> in one place, not in every .o file that uses it. 2006-08-30 04:17:00 +00:00
System Use new config.h macro 2006-09-14 06:21:59 +00:00
Target Legalize is no longer limited to cleverness with just constant shift amounts. 2006-09-20 03:47:40 +00:00
Transforms Back out Chris' last set of changes. This breaks 177.mesa and povray somehow. 2006-09-20 01:39:40 +00:00
VMCore add a helper method 2006-09-18 04:54:57 +00:00
Makefile Make some changes suggested by Chris: 2006-05-17 22:55:35 +00:00