Chris Lattner [Tue, 19 Apr 2005 01:36:41 +0000 (01:36 +0000)]
Tell dj to run the tests in this directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21337
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 19 Apr 2005 01:17:35 +0000 (01:17 +0000)]
implementing shifting of literal integers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21336
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 19 Apr 2005 01:11:03 +0000 (01:11 +0000)]
Add initial lexer and parser support for shifting values. Every use of this
will lead to it being rejected though.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21335
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 18 Apr 2005 07:48:09 +0000 (07:48 +0000)]
Next round of PPC CR optimizations. For the following code:
int %bar(float %a, float %b, float %c, float %d) {
entry:
%tmp.1 = setlt float %a, %d
%tmp.2 = setlt float %b, %d
%or = or bool %tmp.1, %tmp.2
%tmp.3 = setgt float %c, %d
%tmp.4 = or bool %or, %tmp.3
%tmp.5 = and bool %tmp.4, true
%retval = cast bool %tmp.5 to int
ret int %retval
}
We now emit:
_bar:
.LBB_bar_0: ; entry
fcmpu cr0, f1, f4
fcmpu cr1, f2, f4
cror 0, 0, 4
fcmpu cr1, f3, f4
cror 28, 0, 5
mfcr r2
rlwinm r3, r2, 29, 31, 31
blr
Instead of:
_bar:
.LBB_bar_0: ; entry
fcmpu cr7, f1, f4
mfcr r2
rlwinm r2, r2, 29, 31, 31
fcmpu cr7, f2, f4
mfcr r3
rlwinm r3, r3, 29, 31, 31
or r2, r2, r3
fcmpu cr7, f3, f4
mfcr r3
rlwinm r3, r3, 30, 31, 31
or r3, r2, r3
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21321
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 18 Apr 2005 05:26:21 +0000 (05:26 +0000)]
silence a bogus warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21320
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 18 Apr 2005 04:48:12 +0000 (04:48 +0000)]
Fold setcc of MVT::i1 operands into logical operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21319
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 18 Apr 2005 04:30:45 +0000 (04:30 +0000)]
Another minor simplification: handle setcc (zero_extend x), c -> setcc(x, c')
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21318
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 18 Apr 2005 04:11:19 +0000 (04:11 +0000)]
Another simple xform
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21317
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 18 Apr 2005 03:59:53 +0000 (03:59 +0000)]
Fold:
// (X != 0) | (Y != 0) -> (X|Y != 0)
// (X == 0) & (Y == 0) -> (X|Y == 0)
Compiling this:
int %bar(int %a, int %b) {
entry:
%tmp.1 = setne int %a, 0
%tmp.2 = setne int %b, 0
%tmp.3 = or bool %tmp.1, %tmp.2
%retval = cast bool %tmp.3 to int
ret int %retval
}
to this:
_bar:
or r2, r3, r4
addic r3, r2, -1
subfe r3, r3, r2
blr
instead of:
_bar:
addic r2, r3, -1
subfe r2, r2, r3
addic r3, r4, -1
subfe r3, r3, r4
or r3, r2, r3
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21316
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 18 Apr 2005 03:48:41 +0000 (03:48 +0000)]
Make the AND elimination operation recursive and significantly more powerful,
eliminating an and for Nate's testcase:
int %bar(int %a, int %b) {
entry:
%tmp.1 = setne int %a, 0
%tmp.2 = setne int %b, 0
%tmp.3 = or bool %tmp.1, %tmp.2
%retval = cast bool %tmp.3 to int
ret int %retval
}
generating:
_bar:
addic r2, r3, -1
subfe r2, r2, r3
addic r3, r4, -1
subfe r3, r3, r4
or r3, r2, r3
blr
instead of:
_bar:
addic r2, r3, -1
subfe r2, r2, r3
addic r3, r4, -1
subfe r3, r3, r4
or r2, r2, r3
rlwinm r3, r2, 0, 31, 31
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21315
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 18 Apr 2005 02:43:24 +0000 (02:43 +0000)]
Change codegen for setcc to read the bit directly out of the condition
register. Added support in the .td file for the g5-specific variant
of cr -> gpr moves that executes faster, but we currently don't
generate it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21314
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 18 Apr 2005 01:44:27 +0000 (01:44 +0000)]
Add support for targets that require stubs for external functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21313
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 18 Apr 2005 00:46:10 +0000 (00:46 +0000)]
Handle ExternalSymbol operands in the PPC JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21312
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Sat, 16 Apr 2005 04:25:48 +0000 (04:25 +0000)]
Update dejagnu tests to use the new pattern isel flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21311
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Sat, 16 Apr 2005 02:51:44 +0000 (02:51 +0000)]
Add CondPropagate.cpp to VC++ Transforms project
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21310
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Fri, 15 Apr 2005 22:12:16 +0000 (22:12 +0000)]
Make pattern isel default for ppc
Add new ppc beta option related to using condition registers
Make pattern isel control flag (-enable-pattern-isel) global and tristate
0 == off
1 == on
2 == target default
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21309
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 15 Apr 2005 21:13:16 +0000 (21:13 +0000)]
new pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21307
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 15 Apr 2005 19:28:32 +0000 (19:28 +0000)]
a new simple pass, which will be extended to be more useful in the future.
This pass forward branches through conditions when it can show that the
conditions is either always true or false for a predecessor. This currently
only handles the most simple cases of this, but is successful at threading
across 2489 branches and 65 switch instructions in 176.gcc, which isn't bad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21306
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 15 Apr 2005 19:24:49 +0000 (19:24 +0000)]
add a new prototype
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21305
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 15 Apr 2005 19:24:36 +0000 (19:24 +0000)]
new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21304
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Thu, 14 Apr 2005 17:34:20 +0000 (17:34 +0000)]
fix calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21303
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Thu, 14 Apr 2005 16:24:00 +0000 (16:24 +0000)]
a 21264 fix, and fix the operator precidence on an and -> zap check (should fix hundreds of test cases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21302
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Thu, 14 Apr 2005 16:17:49 +0000 (16:17 +0000)]
added a random and mask test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21301
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Thu, 14 Apr 2005 10:08:01 +0000 (10:08 +0000)]
print negative 64 bit immediates as negative numbers, makes things a little
easier on the eyes, not that numbers like
18446744073709541376 are bad or
anything
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21300
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Thu, 14 Apr 2005 10:06:35 +0000 (10:06 +0000)]
oops, this stopped us turning movl r4=0xFFFFFFFF;; and rX, r4 into zxt4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21299
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 14 Apr 2005 09:45:08 +0000 (09:45 +0000)]
Implement multi-way branches through logical ops on condition registers.
This can generate considerably shorter code, reducing the size of crafty
by almost 1%. Also fix the printing of mcrf. The code is currently
disabled until it gets a bit more testing, but should work as-is.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21298
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 14 Apr 2005 08:56:52 +0000 (08:56 +0000)]
Add a couple missing transforms in getSetCC that were triggering assertions
in the PPC Pattern ISel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21297
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Thu, 14 Apr 2005 08:37:32 +0000 (08:37 +0000)]
we have zextloads, not sextloads!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21296
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Thu, 14 Apr 2005 03:20:38 +0000 (03:20 +0000)]
Add the necessary support to codegen condition register logical ops with
register allocated condition registers. Make sure that the printed
output is gas compatible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21295
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Wed, 13 Apr 2005 23:15:44 +0000 (23:15 +0000)]
Start allocating condition registers. Almost all explicit uses of CR0 are
now gone. Next step is to get rid of the remaining ones and then start
allocating bools to CRs where appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21294
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Wed, 13 Apr 2005 22:14:14 +0000 (22:14 +0000)]
Implement the fold shift X, zext(Y) -> shift X, Y at the target level,
where it is safe to do so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21293
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Wed, 13 Apr 2005 21:45:13 +0000 (21:45 +0000)]
Add CodeGen tests for the recent SelectionDAG transforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21292
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Wed, 13 Apr 2005 21:23:31 +0000 (21:23 +0000)]
Disbale the broken fold of shift + sz[ext] for now
Move the transform for select (a < 0) ? b : 0 into the dag from ppc isel
Enable the dag to fold and (setcc, 1) -> setcc for targets where setcc
always produces zero or one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21291
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 20:06:29 +0000 (20:06 +0000)]
fix an infinite loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21289
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 19:53:40 +0000 (19:53 +0000)]
fix some serious miscompiles on ia64, alpha, and ppc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21288
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 19:41:05 +0000 (19:41 +0000)]
avoid work when possible, perhaps fix the problem nate and andrew are seeing
with != 0 comparisons vanishing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21287
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Wed, 13 Apr 2005 17:17:28 +0000 (17:17 +0000)]
WOW, function calls still seem to work after this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21286
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Wed, 13 Apr 2005 16:19:50 +0000 (16:19 +0000)]
prepare for func call optimization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21285
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Wed, 13 Apr 2005 16:16:01 +0000 (16:16 +0000)]
regression case for faster call sequence
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21284
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Wed, 13 Apr 2005 13:00:16 +0000 (13:00 +0000)]
check that casts still use zap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21283
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Wed, 13 Apr 2005 06:12:04 +0000 (06:12 +0000)]
* add the shladd instruction
* fold left shifts of 1, 2, 3 or 4 bits into adds
This doesn't save much now, but should get a serious workout once
multiplies by constants get converted to shift/add/sub sequences.
Hold on! :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21282
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Wed, 13 Apr 2005 05:19:55 +0000 (05:19 +0000)]
add matches for SxADDL and company, as well as simplify the SxADDQ code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21281
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 05:09:42 +0000 (05:09 +0000)]
Implement expansion of unsigned i64 -> FP.
Note that this probably only works for little endian targets, but is enough
to get siod working :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21280
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Wed, 13 Apr 2005 04:50:54 +0000 (04:50 +0000)]
* if ANDing with a constant of the form:
0x00000..00FFF..FF
^ ^
^ ^
any number of
0's followed by
some number of
1's
then we use dep.z to just paste zeros over the input. For the special
cases where this is zxt1/zxt2/zxt4, we use those instructions instead,
because we're all about readability!!!
that's what it's about!! readability!
*twitch* ;D
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21279
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Wed, 13 Apr 2005 04:41:06 +0000 (04:41 +0000)]
added s4addl matching test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21277
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Wed, 13 Apr 2005 03:47:03 +0000 (03:47 +0000)]
added all flavors of zap for anding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21276
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 03:42:14 +0000 (03:42 +0000)]
Make expansion of uint->fp cast assert out instead of infinitely recurse.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21275
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 03:29:53 +0000 (03:29 +0000)]
Fix some mysteriously missing {}'s which cause the miscompilation of
Olden/mst, Ptrdist/bc, Obsequi, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21274
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:58:13 +0000 (02:58 +0000)]
add back the optimization that Nate added for shl X, (zext_inreg y)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21273
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:47:57 +0000 (02:47 +0000)]
Oops, remove these too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21272
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:46:17 +0000 (02:46 +0000)]
remove one more occurance of this that snuck in
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21271
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:43:40 +0000 (02:43 +0000)]
Remove support for ZERO_EXTEND_INREG. This pessimizes code, genering stuff
like this:
ldah $1,1($31)
lda $1,-1($1)
and $0,$1,$24
instead of this:
zap $0,252,$24
To get this back, the selector should recognize the ISD::AND case where this
happens and emit the appropriate ZAP instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21270
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:41:52 +0000 (02:41 +0000)]
Remove special handling of ZERO_EXTEND_INREG. This pessimizes code, causing
things like this:
mov r9 = 65535;;
and r8 = r8, r9;;
To be emitted instead of:
zxt2 r8 = r8;;
To get this back, the selector for ISD::AND should recognize this case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21269
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:40:26 +0000 (02:40 +0000)]
Elimate handling of ZERO_EXTEND_INREG. This causes the PPC backend to emit
andi instructions instead of rlwinm instructions for zero extend, but they
seem like they would take the same time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21268
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:39:05 +0000 (02:39 +0000)]
Z_E_I is gone
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21267
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:38:47 +0000 (02:38 +0000)]
Instead of making ZERO_EXTEND_INREG nodes, use the helper method in
SelectionDAG to do the job with AND. Don't legalize Z_E_I anymore as
it is gone
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21266
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:38:18 +0000 (02:38 +0000)]
Remove all foldings of ZERO_EXTEND_INREG, moving them to work for AND nodes
instead. OVerall, this increases the amount of folding we can do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21265
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:37:19 +0000 (02:37 +0000)]
Add a new helper method which returns the and that is equivalent to what
ZERO_EXTEND_INREG was.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21264
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 13 Apr 2005 02:36:41 +0000 (02:36 +0000)]
Remove the ZERO_EXTEND_INREG node which is redundant with AND
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21263
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Tue, 12 Apr 2005 23:32:28 +0000 (23:32 +0000)]
Fold shift x, [sz]ext(y) -> shift x, y
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21262
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Tue, 12 Apr 2005 23:12:17 +0000 (23:12 +0000)]
Fold shift by size larger than type size to undef
Make llvm undef values generate ISD::UNDEF nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21261
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Tue, 12 Apr 2005 21:22:28 +0000 (21:22 +0000)]
Implement setcc op, -1 sequences
Remove dead setcc op, 0 sequences
Coming later: generalization of op, imm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21260
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 20:30:10 +0000 (20:30 +0000)]
promote extload i1 -> extload i8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21258
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 18:52:14 +0000 (18:52 +0000)]
add an argument to allow avoiding deleting phi nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21255
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 18:51:53 +0000 (18:51 +0000)]
add an argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21254
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 18:51:33 +0000 (18:51 +0000)]
Get rid of this for_each loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21253
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Tue, 12 Apr 2005 18:42:59 +0000 (18:42 +0000)]
* OK, after changing to use liveIn/liveOut instead of IDEFs,
to avoid redundant mov out3=r44 type instructions, we need to
tell the register allocator the truth about out? registers.
FIXME: unfortunately, since the list of allocatable registers is immutable,
we can't simply 'delete r127' from the allocation order, say, if 'out0' is
used. The only correct thing we can do is have a linear order of regs:
out7, out6 ... out2, out1, out0, r32, r33, r34 ... r126, r127
and slide a 'window' of 96 registers along this line, depending on how many
of the out? regs a function actually uses. The only downside of this is
that the out? registers will be allocated _first_, which makes the
resulting assembly ugly. :( Note this in the README. Hope this gets fixed
soon. :) (note the 3rd person speech there)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21252
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Tue, 12 Apr 2005 17:47:57 +0000 (17:47 +0000)]
Get rid of idefs for arguments (oops)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21251
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Lenharth [Tue, 12 Apr 2005 17:35:16 +0000 (17:35 +0000)]
Get rid of idefs for arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21250
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 15:12:51 +0000 (15:12 +0000)]
Put out* into the allocation order, allowing the register allocator to
coallesce moves into outgoing args.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21249
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 15:12:19 +0000 (15:12 +0000)]
Make sure to realize that calls use their argument regs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21248
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Tue, 12 Apr 2005 14:54:44 +0000 (14:54 +0000)]
stop emitting IDEFs for args - change to using liveIn/liveOut
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21247
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Tue, 12 Apr 2005 07:04:16 +0000 (07:04 +0000)]
Initial support for allocation condition registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21246
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 03:59:27 +0000 (03:59 +0000)]
Fix a crash analyzing MultiSource/Benchmarks/MallocBench/gs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21245
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 02:54:39 +0000 (02:54 +0000)]
Remove some redundant checks, add a couple of new ones. This allows us to
compile this:
int foo (unsigned long a, unsigned long long g) {
return a >= g;
}
To:
foo:
movl 8(%esp), %eax
cmpl %eax, 4(%esp)
setae %al
cmpl $0, 12(%esp)
sete %cl
andb %al, %cl
movzbl %cl, %eax
ret
instead of:
foo:
movl 8(%esp), %eax
cmpl %eax, 4(%esp)
setae %al
movzbw %al, %cx
movl 12(%esp), %edx
cmpl $0, %edx
sete %al
movzbw %al, %ax
cmpl $0, %edx
cmove %cx, %ax
movzbl %al, %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21244
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 02:19:10 +0000 (02:19 +0000)]
Emit comparisons against the sign bit better. Codegen this:
bool %test1(long %X) {
%A = setlt long %X, 0
ret bool %A
}
like this:
test1:
cmpl $0, 8(%esp)
setl %al
movzbl %al, %eax
ret
instead of:
test1:
movl 8(%esp), %ecx
cmpl $0, %ecx
setl %al
movzbw %al, %ax
cmpl $0, 4(%esp)
setb %dl
movzbw %dl, %dx
cmpl $0, %ecx
cmove %dx, %ax
movzbl %al, %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21243
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 01:46:05 +0000 (01:46 +0000)]
Emit long comparison against -1 better. Instead of this (x86):
test2:
movl 8(%esp), %eax
notl %eax
movl 4(%esp), %ecx
notl %ecx
orl %eax, %ecx
cmpl $0, %ecx
sete %al
movzbl %al, %eax
ret
or this (PPC):
_test2:
nor r2, r4, r4
nor r3, r3, r3
or r2, r2, r3
cntlzw r2, r2
srwi r3, r2, 5
blr
Emit this:
test2:
movl 8(%esp), %eax
andl 4(%esp), %eax
cmpl $-1, %eax
sete %al
movzbl %al, %eax
ret
or this:
_test2:
.LBB_test2_0: ;
and r2, r4, r3
cmpwi cr0, r2, -1
li r3, 1
li r2, 0
beq .LBB_test2_2 ;
.LBB_test2_1: ;
or r3, r2, r2
.LBB_test2_2: ;
blr
it seems like the PPC isel could do better for R32 == -1 case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21242
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 12 Apr 2005 00:28:49 +0000 (00:28 +0000)]
canonicalize x <u 1 -> x == 0. On this testcase:
unsigned long long g;
unsigned long foo (unsigned long a) {
return (a >= g) ? 1 : 0;
}
It changes the ppc code from:
_foo:
.LBB_foo_0: ; entry
mflr r11
stw r11, 8(r1)
bl "L00000$pb"
"L00000$pb":
mflr r2
addis r2, r2, ha16(L_g$non_lazy_ptr-"L00000$pb")
lwz r2, lo16(L_g$non_lazy_ptr-"L00000$pb")(r2)
lwz r4, 0(r2)
lwz r2, 4(r2)
cmplw cr0, r3, r2
li r2, 1
li r3, 0
bge .LBB_foo_2 ; entry
.LBB_foo_1: ; entry
or r2, r3, r3
.LBB_foo_2: ; entry
cmplwi cr0, r4, 1
li r3, 1
li r5, 0
blt .LBB_foo_4 ; entry
.LBB_foo_3: ; entry
or r3, r5, r5
.LBB_foo_4: ; entry
cmpwi cr0, r4, 0
beq .LBB_foo_6 ; entry
.LBB_foo_5: ; entry
or r2, r3, r3
.LBB_foo_6: ; entry
rlwinm r3, r2, 0, 31, 31
lwz r11, 8(r1)
mtlr r11
blr
to:
_foo:
.LBB_foo_0: ; entry
mflr r11
stw r11, 8(r1)
bl "L00000$pb"
"L00000$pb":
mflr r2
addis r2, r2, ha16(L_g$non_lazy_ptr-"L00000$pb")
lwz r2, lo16(L_g$non_lazy_ptr-"L00000$pb")(r2)
lwz r4, 0(r2)
lwz r2, 4(r2)
cmplw cr0, r3, r2
li r2, 1
li r3, 0
bge .LBB_foo_2 ; entry
.LBB_foo_1: ; entry
or r2, r3, r3
.LBB_foo_2: ; entry
cntlzw r3, r4
srwi r3, r3, 5
cmpwi cr0, r4, 0
beq .LBB_foo_4 ; entry
.LBB_foo_3: ; entry
or r2, r3, r3
.LBB_foo_4: ; entry
rlwinm r3, r2, 0, 31, 31
lwz r11, 8(r1)
mtlr r11
blr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21241
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Tue, 12 Apr 2005 00:10:02 +0000 (00:10 +0000)]
Implement bitfield clears
Implement divide by negative power of two
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21240
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 11 Apr 2005 20:48:57 +0000 (20:48 +0000)]
Update PPC readme. Remove things that are done or aren't ppc specific
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21232
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 11 Apr 2005 20:29:59 +0000 (20:29 +0000)]
Teach the dag mechanism that this:
long long test2(unsigned A, unsigned B) {
return ((unsigned long long)A << 32) + B;
}
is equivalent to this:
long long test1(unsigned A, unsigned B) {
return ((unsigned long long)A << 32) | B;
}
Now they are both codegen'd to this on ppc:
_test2:
blr
or this on x86:
test2:
movl 4(%esp), %edx
movl 8(%esp), %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21231
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 11 Apr 2005 20:08:52 +0000 (20:08 +0000)]
Fix expansion of shifts by exactly NVT bits on arch's (like X86) that have
masking shifts.
This fixes the miscompilation of this:
long long test1(unsigned A, unsigned B) {
return ((unsigned long long)A << 32) | B;
}
into this:
test1:
movl 4(%esp), %edx
movl %edx, %eax
orl 8(%esp), %eax
ret
allowing us to generate this instead:
test1:
movl 4(%esp), %edx
movl 8(%esp), %eax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21230
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 11 Apr 2005 18:55:36 +0000 (18:55 +0000)]
IA64 supports this operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21228
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 11 Apr 2005 15:03:48 +0000 (15:03 +0000)]
ORo sets CR0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21227
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 11 Apr 2005 15:03:41 +0000 (15:03 +0000)]
Revert the previous patch, which I didn't mean to check in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21226
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 11 Apr 2005 15:01:39 +0000 (15:01 +0000)]
Fix a minor bug (ORo didn't mark that it set CR0).
Refactor how . instructions are handled. In particular, instead of passing
the RC flag all the way up the inheritance hierarchy, just make a new tblgen
class 'DOT' which can be added to an instruction definition.
For example, instead of this:
-def AND : XForm_6<31, 28, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
-let Defs = [CR0] in
-def ANDo : XForm_6<31, 28, 1, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
- "and. $rA, $rS, $rB">;
We now have this:
+def AND : XForm_6<31, 28, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
"and $rA, $rS, $rB">;
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21225
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Mon, 11 Apr 2005 07:16:39 +0000 (07:16 +0000)]
hmm, should probably change addImm() to take 64-bit arguments one day anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21224
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Mon, 11 Apr 2005 07:14:41 +0000 (07:14 +0000)]
rename addU64Imm() to addImm64()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21223
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 11 Apr 2005 06:34:10 +0000 (06:34 +0000)]
Add recording variants of ISD::AND and ISD::OR. This kills almost 1000
(1.5%) instructions in 186.crafty
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21222
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Mon, 11 Apr 2005 05:55:56 +0000 (05:55 +0000)]
assorted fixes:
* clean up immediates (we use 14, 22 and 64 bit immediates now. sane.)
* fold r0/f0/f1 registers into comparisons against 0/0.0/1.0
* fix nasty thinko - didn't use two-address form of conditional add
for extending bools to integers, so occasionally there would be
garbage in the result. it's amazing how often zeros are just
sitting around in registers ;) - this should fix a bunch of tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21221
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Mon, 11 Apr 2005 05:48:04 +0000 (05:48 +0000)]
Ensure that the arguments passed to sys::Program::ExecuteAndWait include
the program name as the first argument. Thanks go to Markus Oberhumer for
noticing this problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21220
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Mon, 11 Apr 2005 03:44:22 +0000 (03:44 +0000)]
Eliminate tabs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21216
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeff Cohen [Mon, 11 Apr 2005 03:38:28 +0000 (03:38 +0000)]
Eliminate major source of VC++ "possible loss of data" warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21215
91177308-0d34-0410-b5e6-
96231b3b80d8
Nate Begeman [Mon, 11 Apr 2005 03:01:51 +0000 (03:01 +0000)]
Fix libcall code to not pass a NULL Chain to LowerCallTo
Fix libcall code to not crash or assert looking for an ADJCALLSTACKUP node
when it is known that there is no ADJCALLSTACKDOWN to match.
Expand i64 multiply when ISD::MULHU is legal for the target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21214
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 10 Apr 2005 23:37:16 +0000 (23:37 +0000)]
Don't bother sign/zext_inreg'ing the result of an and operation if we know
the result does change as a result of the extend.
This improves codegen for Alpha on this testcase:
int %a(ushort* %i) {
%tmp.1 = load ushort* %i
%tmp.2 = cast ushort %tmp.1 to int
%tmp.4 = and int %tmp.2, 1
ret int %tmp.4
}
Generating:
a:
ldgp $29, 0($27)
ldwu $0,0($16)
and $0,1,$0
ret $31,($26),1
instead of:
a:
ldgp $29, 0($27)
ldwu $0,0($16)
and $0,1,$0
addl $0,0,$0
ret $31,($26),1
btw, alpha really should switch to livein/outs for args :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21213
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 10 Apr 2005 22:54:25 +0000 (22:54 +0000)]
Teach legalize to deal with targets that don't support some SEXTLOAD/ZEXTLOADs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21212
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 10 Apr 2005 20:59:38 +0000 (20:59 +0000)]
The first argument to ExecuteAndWait should be the program name, but pointed
out by Markus F.X.J. Oberhumer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21211
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 10 Apr 2005 20:45:35 +0000 (20:45 +0000)]
fix this testcase so the regex doesn't match the function name
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21210
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 10 Apr 2005 17:40:35 +0000 (17:40 +0000)]
don't zextload fp values!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21209
91177308-0d34-0410-b5e6-
96231b3b80d8
Duraid Madina [Sun, 10 Apr 2005 09:18:55 +0000 (09:18 +0000)]
* store immediate values as int64_t, not int. come on, we should be happy
when there are immediates, let's not worry about the memory overhead of
this :)
* add addU64Imm(uint64_t val) to machineinstrbuilder
(seriously: this seems required to support 64-bit immediates cleanly. if it
_really_ gets on your nerves, feel free to pull it out ;) )
coming up next week: "all your floating point constants are belong to us"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21208
91177308-0d34-0410-b5e6-
96231b3b80d8