Chris Lattner
6a31b878f8
recognize some patterns as fabs operations, so that fabs at the source level
...
is deconstructed then reconstructed here. This catches 19 fabs's in 177.mesa
9 in 168.wupwise, 5 in 171.swim, 3 in 172.mgrid, and 14 in 173.applu out of
specfp2000.
This allows the X86 code generator to make MUCH better code than before for
each of these and saves one instr on ppc.
This depends on the previous CFE patch to expose these correctly.
llvm-svn: 21171
2005-04-09 05:15:53 +00:00
Chris Lattner
d9748bcae5
make this test more interesting
...
llvm-svn: 21170
2005-04-09 04:55:14 +00:00
Chris Lattner
ec90861662
add a test for fnabs
...
llvm-svn: 21169
2005-04-09 04:03:16 +00:00
Chris Lattner
b9a11b8b7f
add a partial test for the fma operations that ppc supports. I'm sure I'm
...
missing some and not all of these match yet, but I'm sure that Nate will
clean up my mess :)
llvm-svn: 21168
2005-04-09 04:01:32 +00:00
Chris Lattner
8a98c7f337
Emit BRCONDTWOWAY when possible.
...
llvm-svn: 21167
2005-04-09 03:30:29 +00:00
Chris Lattner
fd98678a8a
Legalize BRCONDTWOWAY into a BRCOND/BR pair if a target doesn't support it.
...
llvm-svn: 21166
2005-04-09 03:30:19 +00:00
Chris Lattner
b0713c74a2
print and fold BRCONDTWOWAY correctly
...
llvm-svn: 21165
2005-04-09 03:27:28 +00:00
Chris Lattner
a3a135a9f7
This target does not support/want ISD::BRCONDTWOWAY
...
llvm-svn: 21164
2005-04-09 03:22:37 +00:00
Chris Lattner
4f77badaa3
This target does not yet support ISD::BRCONDTWOWAY
...
llvm-svn: 21163
2005-04-09 03:22:30 +00:00
Chris Lattner
4b1323e846
Add a new node
...
llvm-svn: 21162
2005-04-09 03:21:50 +00:00
Nate Begeman
e8ce0cda40
64b: Expand S/UREM
...
32b: No longer pattern match fneg(fsub(fmul)) as fnmsub
Pattern match fsub a, mul(b, c) as fnmsub
Pattern match fadd a, mul(b, c) as fmadd
Those changes speed up hydro2d by 2.5%, distray by 6%, and scimark by 8%
llvm-svn: 21161
2005-04-09 03:05:51 +00:00
Chris Lattner
0ea81f9db4
canonicalize a bunch of operations involving fneg
...
llvm-svn: 21160
2005-04-09 03:02:46 +00:00
Nate Begeman
f50b597f67
Fix 64b shifts
...
llvm-svn: 21159
2005-04-08 23:45:01 +00:00
Chris Lattner
61b6f04ae9
fix this method for 64-bit constants
...
llvm-svn: 21158
2005-04-08 21:31:29 +00:00
Nate Begeman
705d3c18e8
Match Mac OS X 64 bit calling conventions
...
llvm-svn: 21157
2005-04-08 21:26:05 +00:00
Andrew Lenharth
de5aed3f12
collect a few statistics, factor constants (constant loading and mult), fix logic operation pattern matchs, supress FP div when int dividing by a constant
...
llvm-svn: 21156
2005-04-08 17:28:49 +00:00
Andrew Lenharth
ce9e043c78
oops
...
llvm-svn: 21155
2005-04-08 16:55:15 +00:00
Andrew Lenharth
2e184e2522
added some tests to check stupid pattern matching mistakes
...
llvm-svn: 21154
2005-04-08 16:46:44 +00:00
Duraid Madina
41ff502549
fix bogus division-by-power-of-2 (was wrong for negative input, adds extr insn)
...
fix hack in division (clean up frcpa instruction)
llvm-svn: 21153
2005-04-08 10:01:48 +00:00
Chris Lattner
4236261930
Fix bug: InstCombine/2005-05-07-UDivSelectCrash.ll
...
llvm-svn: 21152
2005-04-08 04:03:26 +00:00
Chris Lattner
9e2b5fc65a
new testcase that crashes the instcombiner.
...
llvm-svn: 21151
2005-04-08 03:58:21 +00:00
Nate Begeman
b1f66d1af2
Optimized code sequences for setcc reg, 0
...
Optimized code sequence for (a < 0) ? b : 0
llvm-svn: 21150
2005-04-07 20:30:01 +00:00
Andrew Lenharth
534eebb317
Alpha zero extends setcc results
...
llvm-svn: 21149
2005-04-07 20:11:32 +00:00
Chris Lattner
b32d9318d2
If a target zero or sign extends the result of its setcc, allow folding of
...
this into sign/zero extension instructions later.
On PPC, for example, this testcase:
%G = external global sbyte
implementation
void %test(int %X, int %Y) {
%C = setlt int %X, %Y
%D = cast bool %C to sbyte
store sbyte %D, sbyte* %G
ret void
}
Now codegens to:
cmpw cr0, r3, r4
li r3, 1
li r4, 0
blt .LBB_test_2 ;
.LBB_test_1: ;
or r3, r4, r4
.LBB_test_2: ;
addis r2, r2, ha16(L_G$non_lazy_ptr-"L00000$pb")
lwz r2, lo16(L_G$non_lazy_ptr-"L00000$pb")(r2)
stb r3, 0(r2)
instead of:
cmpw cr0, r3, r4
li r3, 1
li r4, 0
blt .LBB_test_2 ;
.LBB_test_1: ;
or r3, r4, r4
.LBB_test_2: ;
*** rlwinm r3, r3, 0, 31, 31
addis r2, r2, ha16(L_G$non_lazy_ptr-"L00000$pb")
lwz r2, lo16(L_G$non_lazy_ptr-"L00000$pb")(r2)
stb r3, 0(r2)
llvm-svn: 21148
2005-04-07 19:43:53 +00:00
Chris Lattner
532ac79122
PowerPC zero extends setcc results
...
llvm-svn: 21147
2005-04-07 19:41:49 +00:00
Chris Lattner
38fd97084b
X86 zero extends setcc results
...
llvm-svn: 21146
2005-04-07 19:41:46 +00:00
Chris Lattner
693e797be9
Allow targets which produce setcc results in non-MVT::i1 registers to describe
...
what the contents of the top bits of these registers are, in the common cases
of targets that sign and zero extend the results.
llvm-svn: 21145
2005-04-07 19:41:18 +00:00
Chris Lattner
dfed7355c9
Remove somethign I had for testing
...
llvm-svn: 21144
2005-04-07 18:58:54 +00:00
Andrew Lenharth
9807ac5d3c
fix a small optimization opertunity and make gcc happy
...
llvm-svn: 21143
2005-04-07 18:15:28 +00:00
Chris Lattner
6b03a0cba1
This patch does two things. First, it canonicalizes 'X >= C' -> 'X > C-1'
...
(likewise for <= >=u >=u).
Second, it implements a special case hack to turn 'X gtu SINTMAX' -> 'X lt 0'
On powerpc, for example, this changes this:
lis r2, 32767
ori r2, r2, 65535
cmplw cr0, r3, r2
bgt .LBB_test_2
into:
cmpwi cr0, r3, 0
blt .LBB_test_2
llvm-svn: 21142
2005-04-07 18:14:58 +00:00
Andrew Lenharth
31f5e2f73f
match case change in codegen
...
llvm-svn: 21141
2005-04-07 17:47:00 +00:00
Andrew Lenharth
6b492bec30
fixup magic constant making code. tested by thousands of random divisions.... by 10000. ok, so random divisors would be good too, but this at least fixes some things
...
llvm-svn: 21140
2005-04-07 17:19:16 +00:00
Andrew Lenharth
d2da7177f2
lowercase instructions, makes diff happier
...
llvm-svn: 21139
2005-04-07 17:17:48 +00:00
Chris Lattner
4706046e68
Implement the following xforms:
...
(X-Y)-X --> -Y
A + (B - A) --> B
(B - A) + A --> B
llvm-svn: 21138
2005-04-07 17:14:51 +00:00
Chris Lattner
679c1119e8
new test
...
llvm-svn: 21137
2005-04-07 16:41:45 +00:00
Chris Lattner
c7f3c1a00e
Implement InstCombine/add.ll:test28, transforming C1-(X+C2) --> (C1-C2)-X.
...
This occurs several dozen times in specint2k, particularly in crafty and gcc
apparently.
llvm-svn: 21136
2005-04-07 16:28:01 +00:00
Chris Lattner
dd83183c1e
new testcase
...
llvm-svn: 21135
2005-04-07 16:24:59 +00:00
Chris Lattner
a9be4490d8
Transform X-(X+Y) == -Y and X-(Y+X) == -Y
...
llvm-svn: 21134
2005-04-07 16:15:25 +00:00
Andrew Lenharth
05e51d92e0
It wasn't happy about this either
...
llvm-svn: 21133
2005-04-07 14:18:13 +00:00
Andrew Lenharth
85f34a5682
Yea, it wasn't happy
...
llvm-svn: 21132
2005-04-07 13:55:53 +00:00
Duraid Madina
a7abda3989
teach asmprinter to print s8/s14 operands
...
llvm-svn: 21131
2005-04-07 12:34:36 +00:00
Duraid Madina
8419da8acf
codegen immediate forms of add/sub/shift
...
llvm-svn: 21130
2005-04-07 12:33:38 +00:00
Duraid Madina
b484f7c55e
add immediate forms of add, sub, shift
...
llvm-svn: 21129
2005-04-07 12:32:24 +00:00
Chris Lattner
7d13eae254
Fix a really scary bug that Nate found where we weren't deleting the right
...
elements auto of the autoCSE maps.
llvm-svn: 21128
2005-04-07 00:30:13 +00:00
Nate Begeman
d20628ff7d
Pattern match bitfield insert, which helps shift long by immediate, among
...
other things.
llvm-svn: 21127
2005-04-06 23:51:40 +00:00
Nate Begeman
505f6b760d
Fix some shift bugs
...
llvm-svn: 21126
2005-04-06 22:42:08 +00:00
Alkis Evlogimenos
7ca0947274
Make these 64 bit constants so that this compiles on x86-32 as well.
...
llvm-svn: 21125
2005-04-06 22:09:40 +00:00
Andrew Lenharth
3ea17c6cfe
added sdiv by 2^k and works for neg divisors also
...
llvm-svn: 21124
2005-04-06 22:03:13 +00:00
Chris Lattner
747eee2707
Don't make this require loopsimplify. It works BETTER with loop simplify
...
but should not require it.
llvm-svn: 21123
2005-04-06 21:45:00 +00:00
Nate Begeman
b067492535
Teach ExpandShift how to handle shifts by a constant. This allows targets
...
like PowerPC to codegen long shifts in many fewer instructions.
llvm-svn: 21122
2005-04-06 21:13:14 +00:00