1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-28 14:32:51 +01:00
Commit Graph

18753 Commits

Author SHA1 Message Date
Chris Lattner
b953e27f85 DCE intrinsic instructions without side effects.
llvm-svn: 21719
2005-05-06 05:27:34 +00:00
Chris Lattner
4f7bba1106 These intrinsics do not access memory
llvm-svn: 21718
2005-05-06 05:21:04 +00:00
Chris Lattner
2b4c801d10 Teach instcombine propagate zeroness through shl instructions, implementing
and.ll:test31

llvm-svn: 21717
2005-05-06 04:53:20 +00:00
Chris Lattner
d3797164f9 new testcases
llvm-svn: 21716
2005-05-06 04:52:46 +00:00
Chris Lattner
ead76729cc Implement shift.ll:test23. If we are shifting right then immediately truncating
the result, turn signed shift rights into unsigned shift rights if possible.

This leads to later simplification and happens *often* in 176.gcc.  For example,
this testcase:

struct xxx { unsigned int code : 8; };
enum codes { A, B, C, D, E, F };
int foo(struct xxx *P) {
  if ((enum codes)P->code == A)
     bar();
}

used to be compiled to:

int %foo(%struct.xxx* %P) {
        %tmp.1 = getelementptr %struct.xxx* %P, int 0, uint 0           ; <uint*> [#uses=1]
        %tmp.2 = load uint* %tmp.1              ; <uint> [#uses=1]
        %tmp.3 = cast uint %tmp.2 to int                ; <int> [#uses=1]
        %tmp.4 = shl int %tmp.3, ubyte 24               ; <int> [#uses=1]
        %tmp.5 = shr int %tmp.4, ubyte 24               ; <int> [#uses=1]
        %tmp.6 = cast int %tmp.5 to sbyte               ; <sbyte> [#uses=1]
        %tmp.8 = seteq sbyte %tmp.6, 0          ; <bool> [#uses=1]
        br bool %tmp.8, label %then, label %UnifiedReturnBlock

Now it is compiled to:

        %tmp.1 = getelementptr %struct.xxx* %P, int 0, uint 0           ; <uint*> [#uses=1]
        %tmp.2 = load uint* %tmp.1              ; <uint> [#uses=1]
        %tmp.2 = cast uint %tmp.2 to sbyte              ; <sbyte> [#uses=1]
        %tmp.8 = seteq sbyte %tmp.2, 0          ; <bool> [#uses=1]
        br bool %tmp.8, label %then, label %UnifiedReturnBlock

which is the difference between this:

foo:
        subl $4, %esp
        movl 8(%esp), %eax
        movl (%eax), %eax
        shll $24, %eax
        sarl $24, %eax
        testb %al, %al
        jne .LBBfoo_2

and this:

foo:
        subl $4, %esp
        movl 8(%esp), %eax
        movl (%eax), %eax
        testb %al, %al
        jne .LBBfoo_2

This occurs 3243 times total in the External tests, 215x in povray,
6x in each f2c'd program, 1451x in 176.gcc, 7x in crafty, 20x in perl,
25x in gap, 3x in m88ksim, 25x in ijpeg.

Maybe this will cause a little jump on gcc tommorow :)

llvm-svn: 21715
2005-05-06 04:18:52 +00:00
Chris Lattner
8f567bbc2a new testcase
llvm-svn: 21714
2005-05-06 04:11:32 +00:00
Chris Lattner
20b5bce229 Implement xor.ll:test22
llvm-svn: 21713
2005-05-06 02:07:39 +00:00
Chris Lattner
27f6e62cac implement and.ll:test30 and set.ll:test21
llvm-svn: 21712
2005-05-06 01:53:19 +00:00
Chris Lattner
88ef664af0 new testcase for unneeded and
llvm-svn: 21711
2005-05-06 01:52:52 +00:00
Chris Lattner
a2b995acae new testcase
llvm-svn: 21710
2005-05-06 01:51:05 +00:00
Chris Lattner
d38c600c9d implement or.ll:test20
llvm-svn: 21709
2005-05-06 00:58:50 +00:00
Chris Lattner
1f2cdab20f new testcase
llvm-svn: 21708
2005-05-06 00:58:09 +00:00
Misha Brukman
1996bf6ea5 * Order #includes alphabetically
* Remove commented-out debug printouts

llvm-svn: 21707
2005-05-05 23:45:17 +00:00
Misha Brukman
d29b27d73b Remove extra blank line
llvm-svn: 21706
2005-05-05 23:43:47 +00:00
Misha Brukman
3ae7b6af05 * Use consistent spacing for function arguments
* Output single-character strings as chars

llvm-svn: 21705
2005-05-05 22:38:21 +00:00
Misha Brukman
f52511fcc6 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
llvm-svn: 21704
2005-05-05 22:33:09 +00:00
Misha Brukman
e2e8059814 Convert tabs to spaces
llvm-svn: 21703
2005-05-05 22:30:40 +00:00
Chris Lattner
3e946df29b new testcase for PR541
llvm-svn: 21702
2005-05-05 22:23:10 +00:00
Chris Lattner
64134a43a1 add support for undef values of opaque type, addressing PR541
llvm-svn: 21701
2005-05-05 22:21:19 +00:00
Chris Lattner
c390fbea0d Add some extra checks. Opaque types don't have a null marker.
llvm-svn: 21700
2005-05-05 20:57:00 +00:00
Chris Lattner
f83598edd5 new testcase
llvm-svn: 21699
2005-05-05 17:57:24 +00:00
Chris Lattner
6e8167d1c2 When hitting an unsupported intrinsic, actually print it
Lower debug info to noops.

llvm-svn: 21698
2005-05-05 17:55:17 +00:00
Andrew Lenharth
09c3c4add4 ctpop lowering in legalize
llvm-svn: 21697
2005-05-05 15:55:21 +00:00
Chris Lattner
adcc532d05 Fix a bug compimling Ruby, fixing this testcase:
LowerSetJmp/2005-05-05-OldUses.ll

llvm-svn: 21696
2005-05-05 15:47:43 +00:00
Chris Lattner
07e6a7ac34 new testcase for a bug Jim found
llvm-svn: 21695
2005-05-05 15:47:16 +00:00
Andrew Lenharth
8e2beec4d1 fix typo
llvm-svn: 21693
2005-05-04 19:25:37 +00:00
Andrew Lenharth
58ff51b153 Well, add support for ct* for 21264 only.
21164 is broken until expand works.

llvm-svn: 21692
2005-05-04 19:12:09 +00:00
Andrew Lenharth
9282d00d4f Make promoteOp work for CT*
Proof?

ubyte %bar(ubyte %x) {
entry:
        %tmp.1 = call ubyte %llvm.ctlz( ubyte %x )
        ret ubyte %tmp.1
}

==>

zapnot $16,1,$0
CTLZ $0,$0
subq $0,56,$0
zapnot $0,1,$0
ret $31,($26),1

llvm-svn: 21691
2005-05-04 19:11:05 +00:00
Chris Lattner
1c462db06f Instcombine: cast (X != 0) to int, cast (X == 1) to int -> X iff X has only the low bit set.
This implements set.ll:test20.

This triggers 2x on povray, 9x on mesa, 11x on gcc, 2x on crafty, 1x on eon,
6x on perlbmk and 11x on m88ksim.

It allows us to compile these two functions into the same code:

struct s { unsigned int bit : 1; };
unsigned foo(struct s *p) {
  if (p->bit)
    return 1;
  else
    return 0;
}
unsigned bar(struct s *p) { return p->bit; }

llvm-svn: 21690
2005-05-04 19:10:26 +00:00
Chris Lattner
207e92ec5f new testcase
llvm-svn: 21689
2005-05-04 19:05:02 +00:00
Reid Spencer
c564fd819c Implement the IsDigitOptimization for simplifying calls to the isdigit
library function:
  isdigit(chr) -> 0 or 1 if chr is constant
  isdigit(chr) -> chr - '0' <= 9 otherwise

Although there are many calls to isdigit in llvm-test, most of them are
compiled away by macros leaving only this:

2 MultiSource/Applications/hexxagon

llvm-svn: 21688
2005-05-04 18:58:28 +00:00
Reid Spencer
793d169d29 Make sure both optimization cases get tested.
llvm-svn: 21687
2005-05-04 17:45:10 +00:00
Reid Spencer
04242d8b3a Add a test case for the IsDigitOptimization class.
llvm-svn: 21686
2005-05-04 17:34:55 +00:00
Andrew Lenharth
3cde1721c7 comment fix
llvm-svn: 21685
2005-05-04 15:56:34 +00:00
Andrew Lenharth
0ecfe05b76 see if the legalize code propery compensates for the additional zeros introduced
llvm-svn: 21684
2005-05-04 15:51:07 +00:00
Reid Spencer
d06dc0f95d Correct the descriptions of WHILE...END and RROT. Thanks to Lalo Martins
for pointing out these errors.

llvm-svn: 21683
2005-05-04 15:43:40 +00:00
Reid Spencer
dc2ab16e6f WHILE does not "pop" a value, it "examines" to top of stack. Make this
clear in the applicable comment.

llvm-svn: 21682
2005-05-04 15:33:48 +00:00
Andrew Lenharth
315a093ece added a use of ctpop to debug stuff with
llvm-svn: 21681
2005-05-04 15:20:16 +00:00
Andrew Lenharth
fd47801152 fixup argument
llvm-svn: 21680
2005-05-04 14:58:31 +00:00
Reid Spencer
8d2736401b * Correct the function prototypes for some of the functions to match the
actual spec (int -> uint)
* Add the ability to get/cache the strlen function prototype.
* Make sure generated values are appropriately named for debugging purposes
* Add the SPrintFOptimiation for 4 casts of sprintf optimization:
    sprintf(str,cstr) -> llvm.memcpy(str,cstr) (if cstr has no %)
    sprintf(str,"")   -> store sbyte 0, str
    sprintf(str,"%s",src) -> llvm.memcpy(str,src) (if src is constant)
    sprintf(str,"%c",chr) -> store chr, str   ; store sbyte 0, str+1

The sprintf optimization didn't fire as much as I had hoped:

  2 MultiSource/Applications/SPASS
  5 MultiSource/Benchmarks/McCat/18-imp
 22 MultiSource/Benchmarks/Prolangs-C/TimberWolfMC
  1 MultiSource/Benchmarks/Prolangs-C/assembler
  6 MultiSource/Benchmarks/Prolangs-C/unix-smail
  2 MultiSource/Benchmarks/mediabench/mpeg2/mpeg2dec

llvm-svn: 21679
2005-05-04 03:20:21 +00:00
Misha Brukman
fc2b6af1b1 Minor clean-ups
llvm-svn: 21678
2005-05-03 20:30:34 +00:00
Andrew Lenharth
583f305fca initial descriptions of count intrinsics
llvm-svn: 21677
2005-05-03 18:01:48 +00:00
Andrew Lenharth
8b64bd0fd5 Implement count leading zeros (ctlz), count trailing zeros (cttz), and count
population (ctpop).  Generic lowering is implemented, however only promotion
is implemented for SelectionDAG at the moment.

More coming soon.

llvm-svn: 21676
2005-05-03 17:19:30 +00:00
Reid Spencer
b28a320411 Fix this test to succeed even if "strchr" is on a call instruction.
llvm-svn: 21675
2005-05-03 17:09:38 +00:00
Reid Spencer
04b3cda068 Add a test case for SPrintFOptimization.
llvm-svn: 21674
2005-05-03 17:08:45 +00:00
Andrew Lenharth
0d415d9fa4 yea yea yea
llvm-svn: 21673
2005-05-03 17:00:48 +00:00
Andrew Lenharth
56638cf76c note the vararg change, and other stuff
llvm-svn: 21672
2005-05-03 16:59:09 +00:00
Andrew Lenharth
84cde851a5 pre add count tests
llvm-svn: 21671
2005-05-03 16:49:48 +00:00
Chris Lattner
9620dd281d fix a bug in the 1 index GEP handling code
llvm-svn: 21670
2005-05-03 16:44:45 +00:00
Reid Spencer
f52c228416 Implement optimizations for the strchr and llvm.memset library calls.
Neither of these activated as many times as was hoped:

strchr:
9 MultiSource/Applications/siod
1 MultiSource/Applications/d
2 MultiSource/Prolangs-C/archie-client
1 External/SPEC/CINT2000/176.gcc/176.gcc

llvm.memset:
no hits

llvm-svn: 21669
2005-05-03 07:23:44 +00:00