Commit Graph

31410 Commits

Author SHA1 Message Date
Reid Spencer 5899dd1dc3 Make the generated code for ConstantInt nicer.
llvm-svn: 35902
2007-04-11 13:02:56 +00:00
Reid Spencer c49f2ef236 Fix an approximate calculation in an assertion not to give false negatives.
llvm-svn: 35901
2007-04-11 13:00:04 +00:00
Reid Spencer f4fd92907e Make sure this test uses llvm-upgrade.
Don't allow false positives.

llvm-svn: 35900
2007-04-11 12:46:06 +00:00
Reid Spencer 56ea4e8ad3 Teach llvm2cpp about packed structure types.
llvm-svn: 35899
2007-04-11 12:41:49 +00:00
Reid Spencer ff6e0eda94 Fix several bugs relating to changes in the LLVM IR API or just outright
typos in the output. This is sufficient to get most of the llvm2cpp tests
working again.

llvm-svn: 35898
2007-04-11 12:28:56 +00:00
Reid Spencer d73f84ed7b Regenerate.
llvm-svn: 35897
2007-04-11 12:10:58 +00:00
Reid Spencer 2844b0a225 Fix a crash-by-unknown-exception caused by attempting to use a null pointer
as the key for a map insertion.

llvm-svn: 35896
2007-04-11 12:10:08 +00:00
Reid Spencer e165d7c3d7 Fix to not give false positives.
llvm-svn: 35895
2007-04-11 12:04:33 +00:00
Reid Spencer 77df76a3f5 Fix some issues with param attrs.
llvm-svn: 35894
2007-04-11 10:01:32 +00:00
Reid Spencer 3318579108 Add support for parameter attributes.
llvm-svn: 35893
2007-04-11 09:54:08 +00:00
Chris Lattner 81f14c63da sext of compares.
llvm-svn: 35892
2007-04-11 06:57:54 +00:00
Chris Lattner 74ff60ff84 Turn stuff like:
icmp slt i32 %X, 0              ; <i1>:0 [#uses=1]
        sext i1 %0 to i32               ; <i32>:1 [#uses=1]

into:

        %X.lobit = ashr i32 %X, 31              ; <i32> [#uses=1]

This implements InstCombine/icmp.ll:test[34]

llvm-svn: 35891
2007-04-11 06:57:46 +00:00
Chris Lattner d0f7942e23 Simplify some comparisons to arithmetic, this implements:
Transforms/InstCombine/icmp.ll

llvm-svn: 35890
2007-04-11 06:53:04 +00:00
Chris Lattner 764ec15b3f new testcase
llvm-svn: 35889
2007-04-11 06:52:24 +00:00
Chris Lattner a083ffcad7 Fix this harder.
llvm-svn: 35888
2007-04-11 06:50:51 +00:00
Chris Lattner c5f85d3738 don't create shifts by zero, fix some problems with my previous patch
llvm-svn: 35887
2007-04-11 06:43:25 +00:00
Chris Lattner 20f2372a7c canonicalize (x <u 2147483648) -> (x >s -1) and (x >u 2147483647) -> (x <s 0)
llvm-svn: 35886
2007-04-11 06:12:58 +00:00
Chris Lattner 7ddbff090a fix a miscompilation of:
define i32 @test(i32 %X) {
entry:
        %Y = and i32 %X, 4              ; <i32> [#uses=1]
        icmp eq i32 %Y, 0               ; <i1>:0 [#uses=1]
        sext i1 %0 to i32               ; <i32>:1 [#uses=1]
        ret i32 %1
}

by moving code out of commonIntCastTransforms into visitZExt.  Simplify the
APInt gymnastics in it etc.

llvm-svn: 35885
2007-04-11 05:45:39 +00:00
Chris Lattner a6aa0319f1 done
llvm-svn: 35884
2007-04-11 05:34:00 +00:00
Chris Lattner 65786b078c Teach the codegen to turn [aez]ext (setcc) -> selectcc of 1/0, which often
allows other simplifications.  For example, this compiles:
int isnegative(unsigned int X) {
   return !(X < 2147483648U);
}

Into this code:

x86:
        movl 4(%esp), %eax
        shrl $31, %eax
        ret
arm:
        mov r0, r0, lsr #31
        bx lr
thumb:
        lsr r0, r0, #31
        bx lr

instead of:

x86:
        cmpl $0, 4(%esp)
        sets %al
        movzbl %al, %eax
        ret

arm:
        mov r3, #0
        cmp r0, #0
        movlt r3, #1
        mov r0, r3
        bx lr

thumb:
        mov r2, #1
        mov r1, #0
        cmp r0, #0
        blt LBB1_2      @entry
LBB1_1: @entry
        cpy r2, r1
LBB1_2: @entry
        cpy r0, r2
        bx lr

Testcase here: test/CodeGen/Generic/ispositive.ll

llvm-svn: 35883
2007-04-11 05:32:27 +00:00
Chris Lattner 05362ffdce new testcase
llvm-svn: 35882
2007-04-11 05:32:13 +00:00
Chris Lattner 41189c63cc Codegen integer abs more efficiently using the trick from the PPC CWG. This
improves codegen on many architectures.  Tests committed as CodeGen/*/iabs.ll

X86 Old:			X86 New:
_test:				_test:
   movl 4(%esp), %ecx		   movl 4(%esp), %eax
   movl %ecx, %eax		   movl %eax, %ecx
   negl %eax			   sarl $31, %ecx
   testl %ecx, %ecx		   addl %ecx, %eax
   cmovns %ecx, %eax		   xorl %ecx, %eax
   ret				   ret

PPC Old:			PPC New:
_test:				_test:
   cmpwi cr0, r3, -1		   srawi r2, r3, 31
   neg r2, r3			   add r3, r3, r2
   bgt cr0, LBB1_2 ;		   xor r3, r3, r2
LBB1_1: ;			   blr
   mr r3, r2
LBB1_2: ;
   blr

ARM Old:			ARM New:
_test:				_test:
   rsb r3, r0, #0		   add r3, r0, r0, asr #31
   cmp r0, #0			   eor r0, r3, r0, asr #31
   movge r3, r0			   bx lr
   mov r0, r3
   bx lr

Thumb Old:			Thumb New:
_test:				_test:
   neg r2, r0			   asr r2, r0, #31
   cmp r0, #0			   add r0, r0, r2
   bge LBB1_2			   eor r0, r2
LBB1_1: @			   bx lr
   cpy r0, r2
LBB1_2: @
   bx lr


Sparc Old:			Sparc New:
test:				test:
   save -96, %o6, %o6		   save -96, %o6, %o6
   sethi 0, %l0			   sra %i0, 31, %l0
   sub %l0, %i0, %l0		   add %i0, %l0, %l1
   subcc %i0, -1, %l1		   xor %l1, %l0, %i0
   bg .BB1_2			   restore %g0, %g0, %g0
   nop				   retl
.BB1_1:				   nop
   or %g0, %l0, %i0
.BB1_2:
   restore %g0, %g0, %g0
   retl
   nop

It also helps alpha/ia64 :)

llvm-svn: 35881
2007-04-11 05:11:38 +00:00
Chris Lattner 9f780e339e new testcases for integer abs function
llvm-svn: 35880
2007-04-11 05:02:57 +00:00
Chris Lattner 32104034f8 fix a regression introduced by my last patch.
llvm-svn: 35879
2007-04-11 03:27:24 +00:00
Chris Lattner 098ea183b8 Hack to get sys::Path to recognize macho dylibs.
llvm-svn: 35878
2007-04-11 03:15:35 +00:00
Reid Spencer a472f66dd0 For PR1146:
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.

llvm-svn: 35877
2007-04-11 02:44:20 +00:00
Reid Spencer d3f622e0d5 Teach sys::Path how to recognize different kinds of object files for ELF
and Mach-O systems. Additionally, correct the Mach-O logic code to look at
byte 12 not byte 15. Hopefully this fixes the llvm-ld warning on Darwin.

llvm-svn: 35876
2007-04-11 02:02:09 +00:00
Chris Lattner daa012d1fb Simplify SROA conversion to integer in some ways, make it more general in others.
We now tolerate small amounts of undefined behavior, better emulating what
would happen if the transaction actually occurred in memory.  This fixes
SingleSource/UnitTests/2007-04-10-BitfieldTest.c on PPC, at least until
Devang gets a chance to fix the CFE from doing undefined things with bitfields :)

llvm-svn: 35875
2007-04-11 00:57:54 +00:00
Reid Spencer ccd4d2c8e4 Make isDynamicLibrary detect more than just an ELF file.
llvm-svn: 35874
2007-04-11 00:49:39 +00:00
Reid Spencer 5f6ee131b1 Hack the shared library extension for dylib. The existing code just looks
plain wrong since $module was never defined so we always get .so which is
broken on Darwin. Just force it to .dylib.

llvm-svn: 35873
2007-04-11 00:33:43 +00:00
Reid Spencer 28d3e72a07 Hopefully fix LTDL_SHLIB_EXT on Darwin
llvm-svn: 35872
2007-04-11 00:27:39 +00:00
Bill Wendling f099841573 Add support for our first SSSE3 instruction "pmulhrsw".
llvm-svn: 35869
2007-04-10 22:10:25 +00:00
Devang Patel 6d474cd37c New test case.
llvm-svn: 35868
2007-04-10 21:43:01 +00:00
Chris Lattner d4a9b92a13 new micro optzn
llvm-svn: 35867
2007-04-10 21:14:01 +00:00
Jeff Cohen ba1c0cd4e9 Correctly report version of GCC used.
llvm-svn: 35866
2007-04-10 19:13:43 +00:00
Devang Patel d284fd1145 Add test case for PR 1154.
llvm-svn: 35865
2007-04-10 16:57:08 +00:00
Chris Lattner b05e1727ef fix a comment bug Reid noticed
llvm-svn: 35864
2007-04-10 16:33:06 +00:00
Devang Patel ada3ca2234 Enable loop rotate pass.
llvm-svn: 35863
2007-04-10 15:43:36 +00:00
Chris Lattner 2cc9c488e8 add missing methods, mark stuff const
llvm-svn: 35862
2007-04-10 07:06:21 +00:00
Chris Lattner 338bd30f19 getLimitedValue now just forward to APInt's getLimitedValue. Mark it const.
llvm-svn: 35861
2007-04-10 06:44:12 +00:00
Chris Lattner c43883c8a9 add a method
llvm-svn: 35860
2007-04-10 06:43:18 +00:00
Chris Lattner 9b6d69e0c2 restore support for negative strides
llvm-svn: 35859
2007-04-10 03:48:29 +00:00
Chris Lattner f269d84ca0 apparently some people commit without building the tree, or they forget to
commit a LOT of files.

llvm-svn: 35858
2007-04-10 03:20:39 +00:00
Chris Lattner 0e772b7726 unbreak the build :(
llvm-svn: 35857
2007-04-10 03:18:19 +00:00
Jeff Cohen a8644a6534 Fix build problem.
llvm-svn: 35856
2007-04-10 03:10:46 +00:00
Reid Spencer 782ae66e41 Drop the "bit" prefix for the part.select intrinsic.
llvm-svn: 35854
2007-04-10 02:52:46 +00:00
Reid Spencer ea2945e8e2 Fix name of an intrinsic: bit.part_select -> part.select
llvm-svn: 35853
2007-04-10 02:51:31 +00:00
Chris Lattner 467b69cabb Strengthen the boundary conditions of this fold, implementing
InstCombine/set.ll:test25

llvm-svn: 35852
2007-04-09 23:52:13 +00:00
Chris Lattner ec0020433b new testcase
llvm-svn: 35851
2007-04-09 23:51:49 +00:00
Jeff Cohen e0bbbd3774 No longer needed.
llvm-svn: 35850
2007-04-09 23:42:32 +00:00