Commit Graph

2619 Commits

Author SHA1 Message Date
Chris Lattner 83df5d25b7 Fix a FIXME: Select instructions on longs were miscompiled.
While we're at it, improve codegen of select instructions.  For this
testcase:

int %test(bool %C, int %A, int %B) {
  %D = select bool %C, int %A, int %B
  ret int %D
}

We used to generate this code:

_test:
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        b .LBB_test_3   ;
.LBB_test_2:    ;
        or r5, r4, r4
.LBB_test_3:    ;
        or r3, r5, r5
        blr

Now we emit:

_test:
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        or r4, r5, r5
.LBB_test_2:    ;
        or r3, r4, r4
        blr

-Chris

llvm-svn: 19214
2005-01-01 16:10:12 +00:00
Chris Lattner 78394258ae Substantially improve the code generated by non-folded setcc instructions.
In particular, instead of compiling this:

bool %test(int %A, int %B) {
  %C = setlt int %A, %B
  ret bool %C
}

to this:

test:
        save %sp, -96, %sp
        subcc %i0, %i1, %g0
        bl .LBBtest_1   !
        nop
        ba .LBBtest_2   !
        nop
.LBBtest_1:     !
        or %g0, 1, %i0
        ba .LBBtest_3   !
        nop
.LBBtest_2:     !
        or %g0, 0, %i0
        ba .LBBtest_3   !
        nop
.LBBtest_3:     !
        restore %g0, %g0, %g0
        retl
        nop

We now compile it to this:

test:
        save %sp, -96, %sp
        subcc %i0, %i1, %g0
        or %g0, 1, %i0
        bl .LBBtest_2   !
        nop
.LBBtest_1:     !
        or %g0, %g0, %i0
.LBBtest_2:     !
        restore %g0, %g0, %g0
        retl
        nop

llvm-svn: 19213
2005-01-01 16:06:57 +00:00
Chris Lattner 93feeb18f1 Fix PR490
Fix testcase CodeGen/CBackend/2004-12-28-LogicalConstantExprs.ll

llvm-svn: 19176
2004-12-29 04:00:09 +00:00
Chris Lattner 45382d34cc Remove unused enum value
llvm-svn: 19024
2004-12-17 22:41:46 +00:00
Chris Lattner 227010bb31 Remove unused #include
llvm-svn: 19021
2004-12-17 19:07:04 +00:00
Chris Lattner db0bf10e4a Change the sentinal
llvm-svn: 19007
2004-12-17 00:46:51 +00:00
Chris Lattner 979b903916 Create a stack slot for the return address lazily instead of eagerly. This
save small amounts of time for functions that don't call llvm.returnaddress
or llvm.frameaddress (which is almost all functions).

llvm-svn: 19006
2004-12-17 00:07:46 +00:00
Tanya Lattner 991b5e9457 Chris is a pain ;) Removing reassociate.
llvm-svn: 19005
2004-12-16 23:16:16 +00:00
Tanya Lattner a5528e89fd Removing commented out lines.
llvm-svn: 19004
2004-12-16 23:13:16 +00:00
Tanya Lattner 08e19bb412 Removed LICM and GCSE.
llvm-svn: 19003
2004-12-16 23:07:36 +00:00
Chris Lattner 5a4c66cfe9 Remove dead #include
llvm-svn: 18994
2004-12-16 19:32:38 +00:00
Chris Lattner 20d74fd986 Adjust to changes in asmwriter filenames
llvm-svn: 18987
2004-12-16 17:33:24 +00:00
Chris Lattner a38954dd64 Specify all of the targets built.
llvm-svn: 18985
2004-12-16 17:26:44 +00:00
Chris Lattner 03227509c0 Use the rules in Makefile.rules to build SparcV9GenCodeEmitter.inc instead
of custom rules.

llvm-svn: 18984
2004-12-16 16:47:56 +00:00
Chris Lattner 0bc3333ff4 Fix header
llvm-svn: 18983
2004-12-16 16:47:03 +00:00
Chris Lattner 0782e27d85 Factor out common .td file chunks.
llvm-svn: 18982
2004-12-16 16:31:57 +00:00
Chris Lattner 298a7f8d8b Fix PR485, instead of emitting zero sized arrays, emit arrays of size 1.
llvm-svn: 18974
2004-12-15 23:13:15 +00:00
Brian Gaeke 4bc39bef79 The mystery of Olden/tsp solved, and more opportunities for speedup.
llvm-svn: 18932
2004-12-14 09:10:10 +00:00
Brian Gaeke 36c14da84f Get rid of shifts by zero in most cases.
llvm-svn: 18931
2004-12-14 08:21:02 +00:00
Chris Lattner b3b1c279a2 When generating code for X86 targets, make sure the fp control word is set
to 64-bit precision, not 80 bits.

llvm-svn: 18915
2004-12-13 21:52:52 +00:00
Chris Lattner 951e94e867 Add some notes
llvm-svn: 18911
2004-12-13 20:13:10 +00:00
Chris Lattner c97cac3d32 Set the rounding mode for the X86 FPU to 64-bits instead of 80-bits. We
don't support long double anyway, and this gives us FP results closer to
other targets.

This also speeds up 179.art from 41.4s to 18.32s, by eliminating a problem
with extra precision that causes an FP == comparison to fail (leading to
extra loop iterations).

llvm-svn: 18895
2004-12-13 17:23:11 +00:00
Brian Gaeke cf2c1866cb Add V8 SPEC status.
llvm-svn: 18844
2004-12-13 00:27:35 +00:00
Chris Lattner cbd47631ea Fix Regression/CodeGen/PowerPC/2004-12-12-ZeroSizeCommon.ll, and all programs
when compiled with debug information.

llvm-svn: 18835
2004-12-12 20:36:19 +00:00
Chris Lattner 10b637eade CSE calls to getTypeSize.
llvm-svn: 18833
2004-12-12 20:31:00 +00:00
Chris Lattner 17550c456c Use the target triple to pick this target.
llvm-svn: 18830
2004-12-12 17:40:28 +00:00
Brian Gaeke 23b2bc54b0 Complete the list of MultiSource failures.
llvm-svn: 18826
2004-12-12 08:22:11 +00:00
Brian Gaeke ed9346820d hbd should be working now.
llvm-svn: 18824
2004-12-12 07:42:59 +00:00
Brian Gaeke 27358a44d1 Finally enable the setcc-branch folding code.
Also, fix a bug where ubyte 255 would sometimes be output as -1. This
was afflicting hbd.

llvm-svn: 18823
2004-12-12 07:42:58 +00:00
Brian Gaeke e5351ad5f0 Add (currently disabled) code for canFoldSetCC
llvm-svn: 18820
2004-12-12 06:22:30 +00:00
Brian Gaeke aa40b7d080 Add stubs for setcc-branch folding support.
llvm-svn: 18818
2004-12-12 06:01:26 +00:00
Brian Gaeke 25ac83565e Print llvm code one function at a time.
llvm-svn: 18805
2004-12-11 22:17:07 +00:00
Brian Gaeke 72daaa46eb JIT should print LLVM each function before selecting instructions for it.
llvm-svn: 18803
2004-12-11 18:41:09 +00:00
Brian Gaeke b3095dd88f Bools are *also* not ints. Sigh. Furthermore, most of the TargetMachine
ctor parameters can be defaulted.

Print the transformed llvm code input to the instruction selector
when -print-machineinstrs is on, just like V9.

llvm-svn: 18794
2004-12-11 05:19:04 +00:00
Brian Gaeke ba5e9f107c Look for many more moves to fold (previously, we only
*or g0, x      add g0, x          recognized * as a move)
 or  x, g0     add  x, g0
 or  0, x      add  0, x
 or  x, 0      add  x, 0

llvm-svn: 18793
2004-12-11 05:19:03 +00:00
Brian Gaeke 52a9ed63b5 Make GEPs not suck so much:
* Don't emit the Index * ElementSize multiply if Index is a constant.
* Use a shift, not a multiply, if ElementSize is 1/2/4/8.
* If ElementSize fits in the immediate field of SMUL, then put it there.

Fix a bug where struct offsets might be truncated (ConstantSInt::get is
now used instead of ConstantInt::get).

llvm-svn: 18792
2004-12-11 05:19:02 +00:00
Brian Gaeke cba3135ba8 Update lists of failing benchmarks, including info on which
ones are failing in cbe.

llvm-svn: 18791
2004-12-11 05:19:01 +00:00
Brian Gaeke 2e2f3e26ba Move -lowerselect later in the chain; some select instructions were
slipping through into the instruction selector, which can't deal with
them yet.

llvm-svn: 18758
2004-12-10 08:39:30 +00:00
Brian Gaeke 2ccff7c256 Add the rest of the multiply instructions.
llvm-svn: 18757
2004-12-10 08:39:29 +00:00
Brian Gaeke 4bfd3f7c98 Support binary operations with immediates for <= cInt.
llvm-svn: 18756
2004-12-10 08:39:28 +00:00
Brian Gaeke 428037be05 Update lists of failing benchmarks (except C++...something is the
matter with my sparcv8 libstdc++.a) and to-do list.

llvm-svn: 18755
2004-12-10 08:39:27 +00:00
Brian Gaeke 81c7fd2fce Emit correct prototype for __builtin_alloca on V8.
llvm-svn: 18745
2004-12-10 05:44:45 +00:00
Brian Gaeke 836727ea84 Add SparcV8 target back into the build
llvm-svn: 18738
2004-12-10 04:54:21 +00:00
Brian Gaeke 1d0fe16906 Adjust paths: Sparc/V8 --> SparcV8
llvm-svn: 18737
2004-12-10 04:48:57 +00:00
Brian Gaeke a14476c9bf Make this file self-contained.
llvm-svn: 18736
2004-12-10 04:46:30 +00:00
Brian Gaeke cb3b98586d Update list of failing MultiSource benchmarks. It works out to +5 -5, but I
think some of these might be the CFE's fault; a rebuild should come soon.

llvm-svn: 18735
2004-12-10 04:42:46 +00:00
Brian Gaeke 5183f22a64 When FpMOVDs appeared in pairs, we were mistakenly skipping over the latter of
each pair. I think this fixes that.

One of these days, I swear I'm going to get the hang of C++ iterators.
Really.

llvm-svn: 18734
2004-12-10 04:42:45 +00:00
Brian Gaeke 34f7c3d37a We're continuing to make progress on MultiSource.
llvm-svn: 18714
2004-12-09 18:54:31 +00:00
Brian Gaeke 847c05deef Bytes and shorts are aligned differently from words.
llvm-svn: 18713
2004-12-09 18:51:02 +00:00
Brian Gaeke bac69b7df9 Fix asm-printing directives (how did we not see this before...apparently,
everything was an int!)

llvm-svn: 18712
2004-12-09 18:51:01 +00:00