Chris Lattner [Mon, 15 Aug 2005 23:33:51 +0000 (23:33 +0000)]
Teach LLVM to know how many times a loop executes when constructed with
a < expression, e.g.: for (i = m; i < n; ++i)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22793
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Laskey [Mon, 15 Aug 2005 17:35:26 +0000 (17:35 +0000)]
Broke 80 column rule.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22792
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Laskey [Mon, 15 Aug 2005 17:14:19 +0000 (17:14 +0000)]
Changed code gen for int to f32 to use rounding. This makes FP results
consistent with gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22791
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Mon, 15 Aug 2005 14:31:37 +0000 (14:31 +0000)]
isIntImmediate is a good Idea. Add a flavor that checks bounds while it is at it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22790
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sun, 14 Aug 2005 18:38:32 +0000 (18:38 +0000)]
Fix last night's PPC32 regressions by
1. Not selecting the false value of a select_cc in the false arm, which
isn't legal for nested selects.
2. Actually returning the node we created and Legalized in the FP_TO_UINT
Expander.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22789
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sun, 14 Aug 2005 18:37:02 +0000 (18:37 +0000)]
Fix last night's X86 regressions by putting code for SSE in the if(SSE)
block. nur.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22788
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Sun, 14 Aug 2005 15:14:34 +0000 (15:14 +0000)]
only build .a on alpha
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22787
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sun, 14 Aug 2005 04:36:51 +0000 (04:36 +0000)]
Fix FP_TO_UINT with Scalar SSE2 now that the legalizer can handle it. We
now generate the relatively good code sequences:
unsigned short foo(float a) { return a; }
_foo:
movss 4(%esp), %xmm0
cvttss2si %xmm0, %eax
movzwl %ax, %eax
ret
and
unsigned bar(float a) { return a; }
_bar:
movss .CPI_bar_0, %xmm0
movss 4(%esp), %xmm1
movapd %xmm1, %xmm2
subss %xmm0, %xmm2
cvttss2si %xmm2, %eax
xorl $-
2147483648, %eax
cvttss2si %xmm1, %ecx
ucomiss %xmm0, %xmm1
cmovb %ecx, %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22786
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sun, 14 Aug 2005 01:20:53 +0000 (01:20 +0000)]
Teach the legalizer how to legalize FP_TO_UINT.
Teach the legalizer to promote FP_TO_UINT to FP_TO_SINT if the wider
FP_TO_UINT is also illegal. This allows us on PPC to codegen
unsigned short foo(float a) { return a; }
as:
_foo:
.LBB_foo_0: ; entry
fctiwz f0, f1
stfd f0, -8(r1)
lwz r2, -4(r1)
rlwinm r3, r2, 0, 16, 31
blr
instead of:
_foo:
.LBB_foo_0: ; entry
fctiwz f0, f1
stfd f0, -8(r1)
lwz r2, -4(r1)
lis r3, ha16(.CPI_foo_0)
lfs f0, lo16(.CPI_foo_0)(r3)
fcmpu cr0, f1, f0
blt .LBB_foo_2 ; entry
.LBB_foo_1: ; entry
fsubs f0, f1, f0
fctiwz f0, f0
stfd f0, -16(r1)
lwz r2, -12(r1)
xoris r2, r2, 32768
.LBB_foo_2: ; entry
rlwinm r3, r2, 0, 16, 31
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22785
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sun, 14 Aug 2005 01:17:16 +0000 (01:17 +0000)]
Make FP_TO_UINT Illegal. This allows us to generate significantly better
codegen for FP_TO_UINT by using the legalizer's SELECT variant.
Implement a codegen improvement for SELECT_CC, selecting the false node in
the MBB that feeds the phi node. This allows us to codegen:
void foo(int *a, int b, int c) { int d = (a < b) ? 5 : 9; *a = d; }
as:
_foo:
li r2, 5
cmpw cr0, r4, r3
bgt .LBB_foo_2 ; entry
.LBB_foo_1: ; entry
li r2, 9
.LBB_foo_2: ; entry
stw r2, 0(r3)
blr
insted of:
_foo:
li r2, 5
li r5, 9
cmpw cr0, r4, r3
bgt .LBB_foo_2 ; entry
.LBB_foo_1: ; entry
or r2, r5, r5
.LBB_foo_2: ; entry
stw r2, 0(r3)
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22784
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Sat, 13 Aug 2005 14:58:23 +0000 (14:58 +0000)]
Testing a variable before it is defined doesn't work so well. It is a fairly small thing, so just let everyone build the .a file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22783
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 13 Aug 2005 07:42:01 +0000 (07:42 +0000)]
Ooops, don't forget to clear this. The real inner loop is now:
.LBB_foo_3: ; no_exit.1
lfd f2, 0(r9)
lfd f3, 8(r9)
fmul f4, f1, f2
fmadd f4, f0, f3, f4
stfd f4, 8(r9)
fmul f3, f1, f3
fmsub f2, f0, f2, f3
stfd f2, 0(r9)
addi r9, r9, 16
addi r8, r8, 1
cmpw cr0, r8, r4
ble .LBB_foo_3 ; no_exit.1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22782
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 13 Aug 2005 07:27:18 +0000 (07:27 +0000)]
Recursively scan scev expressions for common subexpressions. This allows us
to handle nested loops much better, for example, by being able to tell that
these two expressions:
{( 8 + ( 16 * ( 1 + %Tmp11 + %Tmp12)) + %c_),+,( 16 * %Tmp 12)}<loopentry.1>
{(( 16 * ( 1 + %Tmp11 + %Tmp12)) + %c_),+,( 16 * %Tmp12)}<loopentry.1>
Have the following common part that can be shared:
{(( 16 * ( 1 + %Tmp11 + %Tmp12)) + %c_),+,( 16 * %Tmp12)}<loopentry.1>
This allows us to codegen an important inner loop in 168.wupwise as:
.LBB_foo_4: ; no_exit.1
lfd f2, 16(r9)
fmul f3, f0, f2
fmul f2, f1, f2
fadd f4, f3, f2
stfd f4, 8(r9)
fsub f2, f3, f2
stfd f2, 16(r9)
addi r8, r8, 1
addi r9, r9, 16
cmpw cr0, r8, r4
ble .LBB_foo_4 ; no_exit.1
instead of:
.LBB_foo_3: ; no_exit.1
lfdx f2, r6, r9
add r10, r6, r9
lfd f3, 8(r10)
fmul f4, f1, f2
fmadd f4, f0, f3, f4
stfd f4, 8(r10)
fmul f3, f1, f3
fmsub f2, f0, f2, f3
stfdx f2, r6, r9
addi r9, r9, 16
addi r8, r8, 1
cmpw cr0, r8, r4
ble .LBB_foo_3 ; no_exit.1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22781
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sat, 13 Aug 2005 06:14:17 +0000 (06:14 +0000)]
Remove an unncessary argument to SimplifySelectCC and add an additional
assert when creating a select_cc node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22780
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sat, 13 Aug 2005 06:00:21 +0000 (06:00 +0000)]
Fix the fabs regression on x86 by abstracting the select_cc optimization
out into SimplifySelectCC. This allows both ISD::SELECT and ISD::SELECT_CC
to use the same set of simplifying folds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22779
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sat, 13 Aug 2005 05:59:16 +0000 (05:59 +0000)]
Remove support for 64b PPC, it's been broken for a long time. It'll be
back once a DAG->DAG ISel exists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22778
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Sat, 13 Aug 2005 05:09:50 +0000 (05:09 +0000)]
Fix oversized GOT problem with gcc-4 on alpha
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22777
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 13 Aug 2005 01:38:43 +0000 (01:38 +0000)]
Teach SplitCriticalEdge to update LoopInfo if it is alive. This fixes
a problem in LoopStrengthReduction, where it would split critical edges
then confused itself with outdated loop information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22776
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 13 Aug 2005 01:30:36 +0000 (01:30 +0000)]
remove dead code. The exit block list is computed on demand, thus does not
need to be updated. This code is a relic from when it did.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22775
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 12 Aug 2005 23:54:58 +0000 (23:54 +0000)]
implement a couple of simple shift foldings.
e.g. (X & 7) >> 3 -> 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22774
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Laskey [Fri, 12 Aug 2005 23:52:46 +0000 (23:52 +0000)]
Fix for 2005-08-12-rlwimi-crash.ll. Make allowance for masks being shifted to
zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22773
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Laskey [Fri, 12 Aug 2005 23:40:14 +0000 (23:40 +0000)]
Added test cases to guarantee use of ORC and ANDC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22772
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Laskey [Fri, 12 Aug 2005 23:38:02 +0000 (23:38 +0000)]
1. This changes handles the cases of (~x)&y and x&(~y) yielding ANDC, and
(~x)|y and x|(~y) yielding ORC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22771
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 12 Aug 2005 23:34:03 +0000 (23:34 +0000)]
testcase that crashed the ppc backend, distilled from crafty
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22770
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 12 Aug 2005 22:22:17 +0000 (22:22 +0000)]
When splitting critical edges, make sure not to leave the new block in the
middle of the loop. This turns a critical loop in gzip into this:
.LBB_test_1: ; loopentry
or r27, r28, r28
add r28, r3, r27
lhz r28, 3(r28)
add r26, r4, r27
lhz r26, 3(r26)
cmpw cr0, r28, r26
bne .LBB_test_8 ; loopentry.loopexit_crit_edge
.LBB_test_2: ; shortcirc_next.0
add r28, r3, r27
lhz r28, 5(r28)
add r26, r4, r27
lhz r26, 5(r26)
cmpw cr0, r28, r26
bne .LBB_test_7 ; shortcirc_next.0.loopexit_crit_edge
.LBB_test_3: ; shortcirc_next.1
add r28, r3, r27
lhz r28, 7(r28)
add r26, r4, r27
lhz r26, 7(r26)
cmpw cr0, r28, r26
bne .LBB_test_6 ; shortcirc_next.1.loopexit_crit_edge
.LBB_test_4: ; shortcirc_next.2
add r28, r3, r27
lhz r26, 9(r28)
add r28, r4, r27
lhz r25, 9(r28)
addi r28, r27, 8
cmpw cr7, r26, r25
mfcr r26, 1
rlwinm r26, r26, 31, 31, 31
add r25, r8, r27
cmpw cr7, r25, r7
mfcr r25, 1
rlwinm r25, r25, 29, 31, 31
and. r26, r26, r25
bne .LBB_test_1 ; loopentry
instead of this:
.LBB_test_1: ; loopentry
or r27, r28, r28
add r28, r3, r27
lhz r28, 3(r28)
add r26, r4, r27
lhz r26, 3(r26)
cmpw cr0, r28, r26
beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2: ; loopentry.loopexit_crit_edge
add r2, r30, r27
add r8, r29, r27
b .LBB_test_9 ; loopexit
.LBB_test_3: ; shortcirc_next.0
add r28, r3, r27
lhz r28, 5(r28)
add r26, r4, r27
lhz r26, 5(r26)
cmpw cr0, r28, r26
beq .LBB_test_5 ; shortcirc_next.1
.LBB_test_4: ; shortcirc_next.0.loopexit_crit_edge
add r2, r11, r27
add r8, r12, r27
b .LBB_test_9 ; loopexit
.LBB_test_5: ; shortcirc_next.1
add r28, r3, r27
lhz r28, 7(r28)
add r26, r4, r27
lhz r26, 7(r26)
cmpw cr0, r28, r26
beq .LBB_test_7 ; shortcirc_next.2
.LBB_test_6: ; shortcirc_next.1.loopexit_crit_edge
add r2, r9, r27
add r8, r10, r27
b .LBB_test_9 ; loopexit
.LBB_test_7: ; shortcirc_next.2
add r28, r3, r27
lhz r26, 9(r28)
add r28, r4, r27
lhz r25, 9(r28)
addi r28, r27, 8
cmpw cr7, r26, r25
mfcr r26, 1
rlwinm r26, r26, 31, 31, 31
add r25, r8, r27
cmpw cr7, r25, r7
mfcr r25, 1
rlwinm r25, r25, 29, 31, 31
and. r26, r26, r25
bne .LBB_test_1 ; loopentry
Next up, improve the code for the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22769
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 12 Aug 2005 22:14:06 +0000 (22:14 +0000)]
Add a helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22768
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 12 Aug 2005 22:13:27 +0000 (22:13 +0000)]
add a helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22767
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 12 Aug 2005 22:06:11 +0000 (22:06 +0000)]
Fix a FIXME: if we are inserting code for a PHI argument, split the critical
edge so that the code is not always executed for both operands. This
prevents LSR from inserting code into loops whose exit blocks contain
PHI uses of IV expressions (which are outside of loops). On gzip, for
example, we turn this ugly code:
.LBB_test_1: ; loopentry
add r27, r3, r28
lhz r27, 3(r27)
add r26, r4, r28
lhz r26, 3(r26)
add r25, r30, r28 ;; Only live if exiting the loop
add r24, r29, r28 ;; Only live if exiting the loop
cmpw cr0, r27, r26
bne .LBB_test_5 ; loopexit
into this:
.LBB_test_1: ; loopentry
or r27, r28, r28
add r28, r3, r27
lhz r28, 3(r28)
add r26, r4, r27
lhz r26, 3(r26)
cmpw cr0, r28, r26
beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2: ; loopentry.loopexit_crit_edge
add r2, r30, r27
add r8, r29, r27
b .LBB_test_9 ; loopexit
.LBB_test_2: ; shortcirc_next.0
...
blt .LBB_test_1
into this:
.LBB_test_1: ; loopentry
or r27, r28, r28
add r28, r3, r27
lhz r28, 3(r28)
add r26, r4, r27
lhz r26, 3(r26)
cmpw cr0, r28, r26
beq .LBB_test_3 ; shortcirc_next.0
.LBB_test_2: ; loopentry.loopexit_crit_edge
add r2, r30, r27
add r8, r29, r27
b .LBB_t_3: ; shortcirc_next.0
.LBB_test_3: ; shortcirc_next.0
...
blt .LBB_test_1
Next step: get the block out of the loop so that the loop is all
fall-throughs again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22766
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 12 Aug 2005 21:58:07 +0000 (21:58 +0000)]
Change break critical edges to not remove, then insert, PHI node entries.
Instead, just update the BB in-place. This is both faster, and it prevents
split-critical-edges from shuffling the PHI argument list unneccesarily.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22765
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Fri, 12 Aug 2005 16:14:08 +0000 (16:14 +0000)]
match gcc's use of tabs, makes diffs easier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22764
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Fri, 12 Aug 2005 16:13:43 +0000 (16:13 +0000)]
.section cleanup, patch from Nicholas Riley
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22763
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 11 Aug 2005 22:19:26 +0000 (22:19 +0000)]
First rev of Xcode 2.1 project
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22762
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Laskey [Thu, 11 Aug 2005 21:59:23 +0000 (21:59 +0000)]
1. Added the function isOpcWithIntImmediate to simplify testing of operand with
specified opcode and an integer constant right operand.
2. Modified ISD::SHL, ISD::SRL, ISD::SRA to use rlwinm when applied after a mask.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22761
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 11 Aug 2005 17:56:50 +0000 (17:56 +0000)]
Tidied up the use of dyn_cast<ConstantSDNode> by using isIntImmediate more.
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22760
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 11 Aug 2005 17:15:31 +0000 (17:15 +0000)]
Use a more efficient method of creating integer and float virtual registers
(avoids an extra level of indirection in MakeReg).
defined MakeIntReg using RegMap->createVirtualRegister(PPC32::GPRCRegisterClass)
defined MakeFPReg using RegMap->createVirtualRegister(PPC32::FPRCRegisterClass)
s/MakeReg(MVT::i32)/MakeIntReg/
s/MakeReg(MVT::f64)/MakeFPReg/
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22759
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 11 Aug 2005 02:18:13 +0000 (02:18 +0000)]
Add a select_cc optimization for recognizing abs(int). This speeds up an
integer MPEG encoding loop by a factor of two.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22758
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 11 Aug 2005 01:12:20 +0000 (01:12 +0000)]
Some SELECT_CC cleanups:
1. move assertions for node creation to getNode()
2. legalize the values returned in ExpandOp immediately
3. Move select_cc optimizations from SELECT's getNode() to SELECT_CC's,
allowing them to be cleaned up significantly.
This paves the way to pick up additional optimizations on SELECT_CC, such
as sum-of-absolute-differences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22757
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Wed, 10 Aug 2005 20:52:09 +0000 (20:52 +0000)]
Make SELECT illegal on PPC32, switch to using SELECT_CC, which more closely
reflects what the hardware is capable of. This significantly simplifies
the CC handling logic throughout the ISel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22756
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Wed, 10 Aug 2005 20:51:12 +0000 (20:51 +0000)]
Add new node, SELECT_CC. This node is for targets that don't natively
implement SELECT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22755
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 18:11:33 +0000 (18:11 +0000)]
Changes for PPC32ISelPattern.cpp
1. Clean up how SelectIntImmediateExpr handles use counts.
2. "Subtract from" was not clearing hi 16 bits.
Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22754
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 17:37:53 +0000 (17:37 +0000)]
Fix an oversight that may be causing PR617.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22753
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 17:17:45 +0000 (17:17 +0000)]
now that we handle non-constant strides, this testcase passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22752
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 17:15:20 +0000 (17:15 +0000)]
remove some trickiness that broke yacr2 and some other programs last night
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22751
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 16:35:46 +0000 (16:35 +0000)]
Changed the XOR case to use the isOprNot predicate.
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22750
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 16:34:52 +0000 (16:34 +0000)]
1. Refactored handling of integer immediate values for add, or, xor and sub.
New routine: ISel::SelectIntImmediateExpr
2. Now checking use counts of large constants. If use count is > 2 then drop
thru so that the constant gets loaded into a register.
Source:
int %test1(int %a) {
entry:
%tmp.1 = add int %a,
123456789 ; <int> [#uses=1]
%tmp.2 = or int %tmp.1,
123456789 ; <int> [#uses=1]
%tmp.3 = xor int %tmp.2,
123456789 ; <int> [#uses=1]
%tmp.4 = sub int %tmp.3, -
123456789 ; <int> [#uses=1]
ret int %tmp.4
}
Did Emit:
.machine ppc970
.text
.align 2
.globl _test1
_test1:
.LBB_test1_0: ; entry
addi r2, r3, -13035
addis r2, r2, 1884
ori r2, r2, 52501
oris r2, r2, 1883
xori r2, r2, 52501
xoris r2, r2, 1883
addi r2, r2, 52501
addis r3, r2, 1883
blr
Now Emits:
.machine ppc970
.text
.align 2
.globl _test1
_test1:
.LBB_test1_0: ; entry
lis r2, 1883
ori r2, r2, 52501
add r3, r3, r2
or r3, r3, r2
xor r3, r3, r2
add r3, r3, r2
blr
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22749
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Wed, 10 Aug 2005 12:38:57 +0000 (12:38 +0000)]
sorry!! this is temporary; for some reason the nasty constmul code seems to
be an infinite loop when using g++-4.0.1*, this kills the ia64 nightly
tester. A proper fix shall be forthcoming!!! thanks for not killing me. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22748
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 03:40:09 +0000 (03:40 +0000)]
Fix a bug compiling: select (i32 < i32), f32, f32
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22747
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 02:07:32 +0000 (02:07 +0000)]
Make loop-simplify produce better loops by turning PHI nodes like X = phi [X, Y]
into just Y. This often occurs when it seperates loops that have collapsed loop
headers. This implements LoopSimplify/phi-node-simplify.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22746
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 02:06:35 +0000 (02:06 +0000)]
New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22745
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 01:12:06 +0000 (01:12 +0000)]
Allow indvar simplify to canonicalize ANY affine IV, not just affine IVs with
constant stride. This implements Transforms/IndVarsSimplify/variable-stride-ivs.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22744
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 01:11:24 +0000 (01:11 +0000)]
new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22743
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 00:59:40 +0000 (00:59 +0000)]
Fix an obvious oops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22742
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 00:48:11 +0000 (00:48 +0000)]
new testcase we handle
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22741
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 00:45:21 +0000 (00:45 +0000)]
Teach LSR to strength reduce IVs that have a loop-invariant but non-constant stride.
For code like this:
void foo(float *a, float *b, int n, int stride_a, int stride_b) {
int i;
for (i=0; i<n; i++)
a[i*stride_a] = b[i*stride_b];
}
we now emit:
.LBB_foo2_2: ; no_exit
lfs f0, 0(r4)
stfs f0, 0(r3)
addi r7, r7, 1
add r4, r2, r4
add r3, r6, r3
cmpw cr0, r7, r5
blt .LBB_foo2_2 ; no_exit
instead of:
.LBB_foo_2: ; no_exit
mullw r8, r2, r7 ;; multiply!
slwi r8, r8, 2
lfsx f0, r4, r8
mullw r8, r2, r6 ;; multiply!
slwi r8, r8, 2
stfsx f0, r3, r8
addi r2, r2, 1
cmpw cr0, r2, r5
blt .LBB_foo_2 ; no_exit
loops with variable strides occur pretty often. For example, in SPECFP2K
there are 317 variable strides in 177.mesa, 3 in 179.art, 14 in 188.ammp,
56 in 168.wupwise, 36 in 172.mgrid.
Now we can allow indvars to turn functions written like this:
void foo2(float *a, float *b, int n, int stride_a, int stride_b) {
int i, ai = 0, bi = 0;
for (i=0; i<n; i++)
{
a[ai] = b[bi];
ai += stride_a;
bi += stride_b;
}
}
into code like the above for better analysis. With this patch, they generate
identical code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22740
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 00:35:32 +0000 (00:35 +0000)]
Fix Regression/Transforms/LoopStrengthReduce/phi_node_update_multiple_preds.ll
by being more careful about updating PHI nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22739
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 10 Aug 2005 00:33:01 +0000 (00:33 +0000)]
new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22738
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 23:39:36 +0000 (23:39 +0000)]
Fix some 80 column violations.
Once we compute the evolution for a GEP, tell SE about it. This allows users
of the GEP to know it, if the users are not direct. This allows us to compile
this testcase:
void fbSolidFillmmx(int w, unsigned char *d) {
while (w >= 64) {
*(unsigned long long *) (d + 0) = 0;
*(unsigned long long *) (d + 8) = 0;
*(unsigned long long *) (d + 16) = 0;
*(unsigned long long *) (d + 24) = 0;
*(unsigned long long *) (d + 32) = 0;
*(unsigned long long *) (d + 40) = 0;
*(unsigned long long *) (d + 48) = 0;
*(unsigned long long *) (d + 56) = 0;
w -= 64;
d += 64;
}
}
into:
.LBB_fbSolidFillmmx_2: ; no_exit
li r2, 0
stw r2, 0(r4)
stw r2, 4(r4)
stw r2, 8(r4)
stw r2, 12(r4)
stw r2, 16(r4)
stw r2, 20(r4)
stw r2, 24(r4)
stw r2, 28(r4)
stw r2, 32(r4)
stw r2, 36(r4)
stw r2, 40(r4)
stw r2, 44(r4)
stw r2, 48(r4)
stw r2, 52(r4)
stw r2, 56(r4)
stw r2, 60(r4)
addi r4, r4, 64
addi r3, r3, -64
cmpwi cr0, r3, 63
bgt .LBB_fbSolidFillmmx_2 ; no_exit
instead of:
.LBB_fbSolidFillmmx_2: ; no_exit
li r11, 0
stw r11, 0(r4)
stw r11, 4(r4)
stwx r11, r10, r4
add r12, r10, r4
stw r11, 4(r12)
stwx r11, r9, r4
add r12, r9, r4
stw r11, 4(r12)
stwx r11, r8, r4
add r12, r8, r4
stw r11, 4(r12)
stwx r11, r7, r4
add r12, r7, r4
stw r11, 4(r12)
stwx r11, r6, r4
add r12, r6, r4
stw r11, 4(r12)
stwx r11, r5, r4
add r12, r5, r4
stw r11, 4(r12)
stwx r11, r2, r4
add r12, r2, r4
stw r11, 4(r12)
addi r4, r4, 64
addi r3, r3, -64
cmpwi cr0, r3, 63
bgt .LBB_fbSolidFillmmx_2 ; no_exit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22737
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 23:36:33 +0000 (23:36 +0000)]
implement two helper methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22736
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 23:36:18 +0000 (23:36 +0000)]
add two helper methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22735
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 23:09:05 +0000 (23:09 +0000)]
Fix spelling, fix some broken canonicalizations by my last patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22734
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 23:08:53 +0000 (23:08 +0000)]
I can't believe I caught this before Misha! :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22733
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 22:30:57 +0000 (22:30 +0000)]
add a optimization note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22732
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 20:40:02 +0000 (20:40 +0000)]
add cc nodes to the AllNodes list so they show up in Graphviz output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22731
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 20:24:16 +0000 (20:24 +0000)]
Add testcases for new rlwinm cases handled, patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22730
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 20:21:10 +0000 (20:21 +0000)]
Update the targets to the new SETCC/CondCodeSDNode interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22729
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 20:20:18 +0000 (20:20 +0000)]
Eliminate the SetCCSDNode in favor of a CondCodeSDNode class. This pulls the
CC out of the SetCC operation, making SETCC a standard ternary operation and
CC's a standard DAG leaf. This will make it possible for other node to use
CC's as operands in the future...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22728
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 18:29:55 +0000 (18:29 +0000)]
Minor cleanup patch, no functionality changes. Written by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22727
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 18:08:41 +0000 (18:08 +0000)]
Fix CodeGen/Generic/div-neg-power-2.ll, a regression from last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22726
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 18:07:45 +0000 (18:07 +0000)]
new reg test for a failure last night on ppc/darwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22725
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 01:13:47 +0000 (01:13 +0000)]
SCEVAddExpr::get() of an empty list is invalid.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22724
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 00:19:44 +0000 (00:19 +0000)]
This is now implemented
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22723
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 9 Aug 2005 00:18:09 +0000 (00:18 +0000)]
Implement: LoopStrengthReduce/share_ivs.ll
Two changes:
* Only insert one PHI node for each stride. Other values are live in
values. This cannot introduce higher register pressure than the
previous approach, and can take advantage of reg+reg addressing modes.
* Factor common base values out of uses before moving values from the
base to the immediate fields. This improves codegen by starting the
stride-specific PHI node out at a common place for each IV use.
As an example, we used to generate this for a loop in swim:
.LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_2: ; no_exit.7.i
lfd f0, 0(r8)
stfd f0, 0(r3)
lfd f0, 0(r6)
stfd f0, 0(r7)
lfd f0, 0(r2)
stfd f0, 0(r5)
addi r9, r9, 1
addi r2, r2, 8
addi r5, r5, 8
addi r6, r6, 8
addi r7, r7, 8
addi r8, r8, 8
addi r3, r3, 8
cmpw cr0, r9, r4
bgt .LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_1
now we emit:
.LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_2: ; no_exit.7.i
lfdx f0, r8, r2
stfdx f0, r9, r2
lfdx f0, r5, r2
stfdx f0, r7, r2
lfdx f0, r3, r2
stfdx f0, r6, r2
addi r10, r10, 1
addi r2, r2, 8
cmpw cr0, r10, r4
bgt .LBB_main_no_exit_2E_6_2E_i_no_exit_2E_7_2E_i_1
As another more dramatic example, we used to emit this:
.LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_2: ; no_exit.1.i19
lfd f0, 8(r21)
lfd f4, 8(r3)
lfd f5, 8(r27)
lfd f6, 8(r22)
lfd f7, 8(r5)
lfd f8, 8(r6)
lfd f9, 8(r30)
lfd f10, 8(r11)
lfd f11, 8(r12)
fsub f10, f10, f11
fadd f5, f4, f5
fmul f5, f5, f1
fadd f6, f6, f7
fadd f6, f6, f8
fadd f6, f6, f9
fmadd f0, f5, f6, f0
fnmsub f0, f10, f2, f0
stfd f0, 8(r4)
lfd f0, 8(r25)
lfd f5, 8(r26)
lfd f6, 8(r23)
lfd f9, 8(r28)
lfd f10, 8(r10)
lfd f12, 8(r9)
lfd f13, 8(r29)
fsub f11, f13, f11
fadd f4, f4, f5
fmul f4, f4, f1
fadd f5, f6, f9
fadd f5, f5, f10
fadd f5, f5, f12
fnmsub f0, f4, f5, f0
fnmsub f0, f11, f3, f0
stfd f0, 8(r24)
lfd f0, 8(r8)
fsub f4, f7, f8
fsub f5, f12, f10
fnmsub f0, f5, f2, f0
fnmsub f0, f4, f3, f0
stfd f0, 8(r2)
addi r20, r20, 1
addi r2, r2, 8
addi r8, r8, 8
addi r10, r10, 8
addi r12, r12, 8
addi r6, r6, 8
addi r29, r29, 8
addi r28, r28, 8
addi r26, r26, 8
addi r25, r25, 8
addi r24, r24, 8
addi r5, r5, 8
addi r23, r23, 8
addi r22, r22, 8
addi r3, r3, 8
addi r9, r9, 8
addi r11, r11, 8
addi r30, r30, 8
addi r27, r27, 8
addi r21, r21, 8
addi r4, r4, 8
cmpw cr0, r20, r7
bgt .LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_1
we now emit:
.LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_2: ; no_exit.1.i19
lfdx f0, r21, r20
lfdx f4, r3, r20
lfdx f5, r27, r20
lfdx f6, r22, r20
lfdx f7, r5, r20
lfdx f8, r6, r20
lfdx f9, r30, r20
lfdx f10, r11, r20
lfdx f11, r12, r20
fsub f10, f10, f11
fadd f5, f4, f5
fmul f5, f5, f1
fadd f6, f6, f7
fadd f6, f6, f8
fadd f6, f6, f9
fmadd f0, f5, f6, f0
fnmsub f0, f10, f2, f0
stfdx f0, r4, r20
lfdx f0, r25, r20
lfdx f5, r26, r20
lfdx f6, r23, r20
lfdx f9, r28, r20
lfdx f10, r10, r20
lfdx f12, r9, r20
lfdx f13, r29, r20
fsub f11, f13, f11
fadd f4, f4, f5
fmul f4, f4, f1
fadd f5, f6, f9
fadd f5, f5, f10
fadd f5, f5, f12
fnmsub f0, f4, f5, f0
fnmsub f0, f11, f3, f0
stfdx f0, r24, r20
lfdx f0, r8, r20
fsub f4, f7, f8
fsub f5, f12, f10
fnmsub f0, f5, f2, f0
fnmsub f0, f4, f3, f0
stfdx f0, r2, r20
addi r19, r19, 1
addi r20, r20, 8
cmpw cr0, r19, r7
bgt .LBB_main_L_90_no_exit_2E_0_2E_i16_no_exit_2E_1_2E_i19_1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22722
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 22:56:21 +0000 (22:56 +0000)]
Suck the base value out of the UsersToProcess vector into the BasedUser
class to simplify the code. Fuse two loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22721
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 22:32:34 +0000 (22:32 +0000)]
Split MoveLoopVariantsToImediateField out from MoveImmediateValues. The
first is a correctness thing, and the later is an optzn thing. This also
is needed to support a future change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22720
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 8 Aug 2005 22:22:56 +0000 (22:22 +0000)]
Factor out some common code, and be smarter about when to emit load hi/lo
code sequences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22719
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 22:13:49 +0000 (22:13 +0000)]
A testcase I don't want to break in the future
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22718
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:57:27 +0000 (21:57 +0000)]
Allow tools with "consume after" options (like lli) to take more positional
opts than they take directly. Thanks to John C for pointing this problem
out to me!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22717
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:34:13 +0000 (21:34 +0000)]
Remove getImmediateForOpcode, which is now dead.
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22716
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:33:23 +0000 (21:33 +0000)]
Add new immediate handling support for mul/div.
Patch by Jim Laskey!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22715
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:30:29 +0000 (21:30 +0000)]
Add support for OR/XOR/SUB immediates that are handled with the new immediate
way. This allows ORI/ORIS pairs, for example.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22714
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:24:57 +0000 (21:24 +0000)]
Modify the ISD::AND opcode case to use new immediate constant predicates.
Includes wider support for rotate and mask cases.
Patch by Jim Laskey.
I've requested that Jim add new regression tests the newly handled cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22712
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:21:03 +0000 (21:21 +0000)]
Modify the ISD::ADD opcode case to use new immediate constant predicates.
Includes support for 32-bit constants using addi/addis.
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22711
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:12:35 +0000 (21:12 +0000)]
Modify existing support functions to use new immediate constant predicates.
Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22710
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:10:27 +0000 (21:10 +0000)]
Add support predicates for future immediate constant changes.
Patch by Jim Laskey
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22709
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 21:08:09 +0000 (21:08 +0000)]
Move IsRunOfOnes to a more logical place and rename to a proper predicate form
(lowercase isXXX).
Patch by Jim Laskey.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22708
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 8 Aug 2005 20:04:52 +0000 (20:04 +0000)]
Fix JIT encoding of ppc mfocrf instruction; the operands were reversed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22707
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 19:11:57 +0000 (19:11 +0000)]
Use the new 'moveBefore' method to simplify some code. Really, which is
easier to understand? :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22706
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 17:25:38 +0000 (17:25 +0000)]
Reject command lines that have too many positional arguments passed (e.g.,
'opt x y'). This fixes PR493.
Patch contributed by Owen Anderson!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22705
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 06:25:50 +0000 (06:25 +0000)]
Not all constants are legal immediates in load/store instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22704
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 06:23:47 +0000 (06:23 +0000)]
new testcase, not implemented yet
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22703
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:47:49 +0000 (05:47 +0000)]
Implement LoopStrengthReduce/share_code_in_preheader.ll by having one
rewriter for all code inserted into the preheader, which is never flushed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22702
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:46:51 +0000 (05:46 +0000)]
It is better to not depend on CSE to share multiplies due to IV insertion.
This testcase checks that only one mul is present in the output code, as it
should be.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22701
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:29:51 +0000 (05:29 +0000)]
These are both implemented by a recent LSR patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22700
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:28:22 +0000 (05:28 +0000)]
Implement a simple optimization for the termination condition of the loop.
The termination condition actually wants to use the post-incremented value
of the loop, not a new indvar with an unusual base.
On PPC, for example, this allows us to compile
LoopStrengthReduce/exit_compare_live_range.ll to:
_foo:
li r2, 0
.LBB_foo_1: ; no_exit
li r5, 0
stw r5, 0(r3)
addi r2, r2, 1
cmpw cr0, r2, r4
bne .LBB_foo_1 ; no_exit
blr
instead of:
_foo:
li r2, 1 ;; IV starts at 1, not 0
.LBB_foo_1: ; no_exit
li r5, 0
stw r5, 0(r3)
addi r5, r2, 1
cmpw cr0, r2, r4
or r2, r5, r5 ;; Reg-reg copy, extra live range
bne .LBB_foo_1 ; no_exit
blr
This implements LoopStrengthReduce/exit_compare_live_range.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22699
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:21:50 +0000 (05:21 +0000)]
add new helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22698
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 05:21:33 +0000 (05:21 +0000)]
add a new helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22697
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 8 Aug 2005 04:26:32 +0000 (04:26 +0000)]
Handle 64-bit constant exprs on 64-bit targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22696
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 20:02:04 +0000 (20:02 +0000)]
All stats are "Number of ..."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22694
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 07:03:10 +0000 (07:03 +0000)]
Add some simple folds that occur in bitfield cases. Fix a minor bug in
isHighOnes, where it would consider 0 to have high ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22693
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 7 Aug 2005 07:00:52 +0000 (07:00 +0000)]
Fix typoCVS: ----------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22692
91177308-0d34-0410-b5e6-
96231b3b80d8