Commit Graph

8464 Commits

Author SHA1 Message Date
Gordon Henriksen
86737665b8 Refactoring the x86 and x86-64 calling convention implementations,
unifying the copied algorithms and saving over 500 LOC. There should
be no functionality change, but please test on your favorite x86
target.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45627 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 16:56:59 +00:00
Bill Wendling
df303bd7f2 Chris and Evan noticed that this check was compleatly fubared. I was
checking that there was a from a global instead of a load from the stub
for a global, which is the one that's safe to hoist.

Consider this program:

volatile char G[100];
int B(char *F, int N) {
  for (; N > 0; --N)
    F[N] = G[N];
}

In static mode, we shouldn't be hoisting the load from G:

$ llc -relocation-model=static -o - a.bc -march=x86 -machine-licm

LBB1_1: # bb.preheader
        leal    -1(%eax), %edx
        testl   %edx, %edx
        movl    $1, %edx
        cmovns  %eax, %edx
        xorl    %esi, %esi
LBB1_2: # bb
        movb    _G(%eax), %bl
        movb    %bl, (%ecx,%eax)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45626 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 09:18:04 +00:00
Chris Lattner
f29495a22f enable sinking and licm of loads from the argument area. I'd like to enable this
for remat, but can't due to an RA bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 06:10:42 +00:00
Chris Lattner
3b5a221f81 simplify some code by using shorter accessors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 05:28:30 +00:00
Chris Lattner
a83b34bbeb revert my previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 05:26:26 +00:00
Chris Lattner
505d4abd05 factor some code better to avoid redundancy between
isReallySideEffectFree and isReallyTriviallyReMaterializable.  Why is a load from
a global considered side-effect-free but not rematable?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45620 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 05:19:56 +00:00
Chris Lattner
e9648f8981 getting the pic base has no side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 03:54:32 +00:00
Evan Cheng
2a3e08b596 X86 JIT PIC jumptable support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45616 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 02:26:58 +00:00
Evan Cheng
0475ab58b8 Combine MovePCtoStack + POP32r into one instruction MOVPC32r so it can be moved if needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 00:41:47 +00:00
Owen Anderson
d94b6a16fe Move some more functionality from MRegisterInfo to TargetInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 23:57:37 +00:00
Evan Cheng
991500e329 Unbreak tailcall opt in JIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45576 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 10:50:28 +00:00
Evan Cheng
be8c03fc66 X86 PIC JIT support fixes: encoding bugs, add lazy pointer stubs support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 10:46:51 +00:00
Evan Cheng
165b60de0b Correct order of parameters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45562 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 02:22:21 +00:00
Gordon Henriksen
ae636f8e99 First steps in in X86 calling convention cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45536 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 16:47:34 +00:00
Evan Cheng
02aabbf96b Change MachineRelocation::DoesntNeedFnStub to NeedStub. This fields will be used
for non-function GV relocations that require function address stubs (e.g. Mac OS X in non-static mode).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 02:56:28 +00:00
Evan Cheng
306cbdbee7 X86 PIC JIT bug fix: relocations for constantpool and jumptable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 23:38:59 +00:00
Bill Wendling
3100afaf3f Machine LICM will check that operands are defined outside of the loop. Also
check that register isn't 0 before going further.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 21:10:40 +00:00
Chris Lattner
7ad92d81e2 darwin9 and above support aligned common symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 19:44:55 +00:00
Chris Lattner
564da5d646 leopard and above support alignment for common symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45493 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 19:35:16 +00:00
Owen Anderson
f6372aa1cc Move some more instruction creation methods from RegisterInfo into InstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-01 21:11:32 +00:00
Chris Lattner
264e6fec9f Fix a bug in my previous patch: refer to the impl not the pure virtual version. It's unclear why gcc would ever compile this...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-01 01:05:34 +00:00
Chris Lattner
6410552250 Fix a problem where lib/Target/TargetInstrInfo.h would include and use
a header file from libcodegen.  This violates a layering order: codegen
depends on target, not the other way around.  The fix to this is to 
split TII into two classes, TII and TargetInstrInfoImpl, which defines
stuff that depends on libcodegen.  It is defined in libcodegen, where 
the base is not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45475 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-01 01:03:04 +00:00
Owen Anderson
d10fd9791c Move copyRegToReg from MRegisterInfo to TargetInstrInfo. This is part of the
Machine-level API cleanup instigated by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45470 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-31 06:32:00 +00:00
Chris Lattner
84bc5427d6 Rename SSARegMap -> MachineRegisterInfo in keeping with the idea
that "machine" classes are used to represent the current state of
the code being compiled.  Given this expanded name, we can start 
moving other stuff into it.  For now, move the UsedPhysRegs and
LiveIn/LoveOuts vectors from MachineFunction into it.

Update all the clients to match.

This also reduces some needless #includes, such as MachineModuleInfo
from MachineFunction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45467 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-31 04:13:23 +00:00
Chris Lattner
8aa797aa51 Add new shorter predicates for testing machine operands for various types:
e.g. MO.isMBB() instead of MO.isMachineBasicBlock().  I don't plan on 
switching everything over, so new clients should just start using the 
shorter names.

Remove old long accessors, switching everything over to use the short
accessor: getMachineBasicBlock() -> getMBB(), 
getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45464 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 23:10:15 +00:00
Chris Lattner
f73823000e More cleanups for MachineOperand:
- Eliminate the static "print" method for operands, moving it
    into MachineOperand::print.
  - Change various set* methods for register flags to take a bool
    for the value to set it to.  Remove unset* methods.
  - Group methods more logically by operand flavor in MachineOperand.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45461 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 21:56:09 +00:00
Chris Lattner
9a1ceaedc2 Use MachineOperand::getImm instead of MachineOperand::getImmedValue. Likewise setImmedValue -> setImm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45453 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 20:49:49 +00:00
Bill Wendling
6259d51c91 If we have a load of a global address that's not modified during the
function, then go ahead and hoist it out of the loop. This is the result:

$ cat a.c
volatile int G;

int A(int N) {
  for (; N > 0; --N)
    G++;
}
$ llc -o - -relocation-model=pic
_A:
...
LBB1_2: # bb
        movl    L_G$non_lazy_ptr-"L1$pb"(%eax), %esi
        incl    (%esi)
        incl    %edx
        cmpl    %ecx, %edx
        jne     LBB1_2  # bb
...
$ llc -o - -relocation-model=pic -machine-licm
_A:
...
        movl    L_G$non_lazy_ptr-"L1$pb"(%eax), %eax
LBB1_2: # bb
        incl    (%eax)
        incl    %edx
        cmpl    %ecx, %edx
        jne     LBB1_2  # bb
...

I'm limiting this to the MOV32rm x86 instruction for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45444 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 03:18:58 +00:00
Chris Lattner
c8bd287f3c use simplified operand addition methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45437 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 01:01:54 +00:00
Chris Lattner
39697a83b5 Shrinkify the machine operand creation method names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45433 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 00:45:46 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Chris Lattner
fc643c5e88 remove attribution from lib Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:09:26 +00:00
Chris Lattner
a5e90d7b74 this is done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:38:02 +00:00
Chris Lattner
03c079d5fc One readme entry is done, one is really easy (Evan, want to investigate
eliminating the llvm.x86.sse2.loadl.pd intrinsic?), one shuffle optzn
may be done (if shufps is better than pinsw, Evan, please review), and
we already know about LICM of simple instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45407 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:31:47 +00:00
Chris Lattner
63079f0757 Fold comparisons against a constant nan, and optimize ORD/UNORD
comparisons with a constant.  This allows us to compile isnan to:

_foo:
	fcmpu cr7, f1, f1
	mfcr r2
	rlwinm r3, r2, 0, 31, 31
	blr 

instead of:

LCPI1_0:					;  float
	.space	4
_foo:
	lis r2, ha16(LCPI1_0)
	lfs f0, lo16(LCPI1_0)(r2)
	fcmpu cr7, f1, f0
	mfcr r2
	rlwinm r3, r2, 0, 31, 31
	blr 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45405 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 08:37:08 +00:00
Chris Lattner
69bfbdfaee this xform is implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45404 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 08:19:39 +00:00
Chris Lattner
d60eedca01 Codegen:
as:

_bar:
	pushl	%esi
	subl	$8, %esp
	movl	16(%esp), %esi
	call	L_foo$stub
	fstps	(%esi)
	addl	$8, %esp
	popl	%esi
	#FP_REG_KILL
	ret

instead of:

_bar:
	pushl	%esi
	subl	$8, %esp
	movl	16(%esp), %esi
	call	L_foo$stub
	fstpl	(%esi)
	cvtsd2ss	(%esi), %xmm0
	movss	%xmm0, (%esi)
	addl	$8, %esp
	popl	%esi
	#FP_REG_KILL
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45401 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 06:57:38 +00:00
Chris Lattner
112dedc520 avoid going through a stack slot to convert from fpstack to xmm reg
if we are just going to store it back anyway.  This improves things 
like:
double foo();
void bar(double *P) { *P = foo(); }



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45399 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 06:41:28 +00:00
Chris Lattner
7ede51b964 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45397 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 05:51:58 +00:00
Chris Lattner
92c06a01de expand note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45393 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 01:05:01 +00:00
Chris Lattner
a1643ba71a add a note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45388 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-28 22:30:05 +00:00
Chris Lattner
9bfcc624ba add a note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45387 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-28 21:50:40 +00:00
Chris Lattner
166a268656 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45377 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-28 04:42:05 +00:00
Chris Lattner
44cb8efdc1 add a simple hack
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45343 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-24 19:27:46 +00:00
Gordon Henriksen
81361d6a28 Setting GlobalDirective in TargetAsmInfo by default rather than
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45338 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-23 20:58:16 +00:00
Chris Lattner
52ec375438 fix some warnings. This code needs to be de-tabified :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45325 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 22:47:03 +00:00
Chris Lattner
d3ada751c3 fix strict-aliasing violation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45324 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 22:45:38 +00:00
Anton Korobeynikov
d07310af64 Erm, really disable :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45319 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 20:46:24 +00:00
Anton Korobeynikov
144a45eb94 Disable, until we'll really need it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45318 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 20:41:12 +00:00
Evan Cheng
aabe38bf0c Preliminary PIC JIT support for X86 (32-bit) / Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45313 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 09:40:20 +00:00
Evan Cheng
a9ab846669 Oops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45312 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 09:14:34 +00:00
Evan Cheng
f02ca69951 Fix JIT code emission of X86::MovePCtoStack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45307 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 02:26:46 +00:00
Evan Cheng
889ac61113 Allow JIT with non-static relocation model.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45304 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 01:12:14 +00:00
Anton Korobeynikov
dceadaf8df Fix silly typo in the FP CEP handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45300 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 23:33:44 +00:00
Duncan Sands
5819799fa7 Fix a brain fart by our beloved leader (the content
of this patch is the last line).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45289 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 20:18:41 +00:00
Nicolas Geoffray
5a6c91a3ec Fix unintented change from last commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45282 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 12:22:29 +00:00
Nicolas Geoffray
616585bbff Enable EH for linux/ppc32 targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45281 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 12:19:44 +00:00
Evan Cheng
0b0102b172 New entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45280 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 01:31:58 +00:00
Evan Cheng
700a0fba97 Fix JIT encoding for CMPSD as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45268 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 19:57:09 +00:00
Scott Michel
86c041f50e More working CellSPU tests:
- vec_const.ll: Vector constant loads
- immed64.ll: i64, f64 constant loads


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45242 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 00:44:13 +00:00
Dale Johannesen
696f768daf Enable EH on PPC Darwin. This basically works; there
are a couple of issues that show up with the optimizer,
but I don't think they're really EH problems.
(llvm-gcc testsuite users note:  By default the testsuite
uses the unwinding code that's built as part of your local
llvm-gcc, which does not work.  You need to trick it into
using the installed system unwinding code to get useful
results.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45221 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 21:54:36 +00:00
Scott Michel
0e5665bf03 CellSPU testcase, extract_elt.ll: extract vector element.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45219 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 21:17:42 +00:00
Scott Michel
170783a5fc Two more test cases: or_ops.ll (arithmetic or operations) and vecinsert.ll
(vector insertions)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45216 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 20:15:47 +00:00
Scott Michel
9999e685ea Add new immed16.ll test case, fix CellSPU errata to make test case work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45196 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 07:35:06 +00:00
Bill Wendling
ee912540e7 Mark the "isRemat" instruction as never having side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45190 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 06:07:48 +00:00
Chris Lattner
4185b52183 add an obvious load folding missed optzn.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45161 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 16:48:14 +00:00
Christopher Lamb
30f017ad89 Fold certain additions through selects (and their compares) so as to eliminate subtractions. This code is often produced by the SMAX expansion in SCEV.
This implements test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45158 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 09:34:41 +00:00
Chris Lattner
fd2025e9db add a missed case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45141 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 01:19:18 +00:00
Bill Wendling
627c00b663 Add "mayHaveSideEffects" and "neverHasSideEffects" flags to some instructions. I
based what flag to set on whether it was already marked as
"isRematerializable". If there was a further check to determine if it's "really"
rematerializable, then I marked it as "mayHaveSideEffects" and created a check
in the X86 back-end similar to the remat one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45132 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 23:07:56 +00:00
Scott Michel
504c369213 - Restore some i8 functionality in CellSPU
- New test case: nand.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45130 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 22:32:34 +00:00
Bill Wendling
691de38295 LD_Fp64m should have "isRematerializable" set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45128 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 22:17:14 +00:00
Bill Wendling
7d9e97c2ac As per feedback, revised comments to (hopefully) make the different side effect
flags clearer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45120 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 21:02:07 +00:00
Christopher Lamb
43ad6b3e0d Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 01:12:55 +00:00
Chris Lattner
10d724af26 don't violate C TBAA rules, use FloatToBits instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45076 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-16 20:41:33 +00:00
Chris Lattner
48b0133b83 fix a questionable cast, thanks to Mike Stump for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45075 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-16 20:26:54 +00:00
Chris Lattner
d7610e16fc Fix the JIT encoding of cmp*ss, which aborts with this assertion currently:
X86CodeEmitter.cpp:378: failed assertion `0 && "Immediate size not set!"'

I *think* this is right, but Evan, please verify.  It also looks like
CMPSDrr and maybe others are missing this info.  Evan, plz investigate.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45074 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-16 20:12:41 +00:00
Evan Cheng
7a831ce85f Make better use of instructions that clear high bits; fix various 2-wide shuffle bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45058 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-15 03:00:47 +00:00
Scott Michel
ec2a08ff06 Start committing working test cases for CellSPU.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45050 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-15 00:38:50 +00:00
Evan Cheng
0c5a507fcb Actually, MOVPQIto64mr is a dup of MOVPQI2QImr, MOV64toPQIrm is a dup of MOVQI2PQIrm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45041 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 20:08:14 +00:00
Evan Cheng
2023ed720e Fix (mem) <-> low 64-bits of xmm bugs pointed out by David Greene. Mac OS X Leopard assembler recognizes movq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45040 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 19:54:07 +00:00
Dale Johannesen
6e959b9afe x86-32 long doubles are 4-byte aligned on the stack
for parameter passing (only for that, on Darwin).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45038 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 19:25:34 +00:00
Evan Cheng
fd9e473a82 Fix bsf / bsr jit encoding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45037 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 18:49:43 +00:00
Evan Cheng
8ec861183b Oops. Forgot these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45036 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 18:25:34 +00:00
Dan Gohman
1a8001e665 Fix Intel asm syntax for the bsr and bsf instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45030 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 15:10:00 +00:00
Evan Cheng
152804e9c1 Fix ctlz and cttz. llvm definition requires them to return number of bits in of the src type when value is zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45029 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 08:30:15 +00:00
Evan Cheng
18efe269b1 Implement ctlz and cttz with bsr and bsf.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45024 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 02:13:44 +00:00
Bill Wendling
6b1da9c39f Add flags to indicate that there are "never" side effects or that there "may be"
side effects for machine instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45022 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 01:48:59 +00:00
Evan Cheng
1314b00cf2 Fold some and + shift in x86 addressing mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44970 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13 00:43:27 +00:00
Evan Cheng
6e141fd048 Implicit def instructions, e.g. X86::IMPLICIT_DEF_GR32, are always re-materializable and they should not be spilled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44960 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 23:12:09 +00:00
Duncan Sands
67f1c493d1 Remove host endianness info from TargetData and
put it in a new header System/Host.h instead.
Instead of getting the endianness from configure,
calculate it directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44959 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 23:03:45 +00:00
Dan Gohman
890813243f Allow vector integer constants to be created with
SelectionDAG::getConstant, in the same way as vector floating-point
constants. This allows the legalize expansion code for @llvm.ctpop and
friends to be usable with vector types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44954 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 22:21:26 +00:00
Evan Cheng
794405e6aa Use shuffles to implement insert_vector_elt for i32, i64, f32, and f64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44929 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 07:55:34 +00:00
Evan Cheng
db2d524d5f Lower a build_vector with all constants into a constpool load unless it can be done with a move to low part.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44921 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 06:45:40 +00:00
Scott Michel
a28c6bfef3 Correct typo for Linux: s/esp/%rsp/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44904 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 02:38:28 +00:00
Nate Begeman
6e041c2015 Allow the JIT to encode MMX instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44869 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 18:06:14 +00:00
Evan Cheng
14b32e1941 - Improved v8i16 shuffle lowering. It now uses pshuflw and pshufhw as much as
possible before resorting to pextrw and pinsrw.
- Better codegen for v4i32 shuffles masquerading as v8i16 or v16i8 shuffles.
- Improves (i16 extract_vector_element 0) codegen by recognizing
  (i32 extract_vector_element 0) does not require a pextrw.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44836 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 01:46:18 +00:00
Nate Begeman
844e0f9def x86 doesn't actually want to custom lower v3i32
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44835 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 01:41:33 +00:00
Chris Lattner
57d7d3f2d7 Move TargetData::hostIsLittleEndian out of line, which means we
don't have to #include config.h in it.  #including config.h breaks
other projects that have their own autoconf stuff and try to #include
the llvm headers.  One obscure example is llvm-gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44825 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 00:28:59 +00:00
Anton Korobeynikov
7eb587779e Hey, English is not my native language :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44820 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 23:10:20 +00:00
Anton Korobeynikov
2fb9deef10 Clarify the need of CFI() stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44819 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 23:08:35 +00:00
Anton Korobeynikov
5f68287605 Provide convenient way to disable CFI stuff for old/broken assemblers.
Use it for Darwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44818 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 23:04:38 +00:00
Chris Lattner
ec90cd1bf8 Disable cfi directives for now, darwin does't support them.
These should probably be something like:

  CFI(".cfi_def_cfa_offset 16\n")

where CFI is defined to a noop on darwin and other platforms
that don't support those directives.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44803 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 19:10:18 +00:00
Anton Korobeynikov
3a7bcc4d1b And finally annotate X86-64 version of callback.
All bad stuff from SSE version is implicitely inherited :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 15:27:07 +00:00
Anton Korobeynikov
df7814ce92 Provide annotation for SSE version of callback. It's even more
broken, because doesn't mark xmm regs properly


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44793 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 15:13:55 +00:00
Anton Korobeynikov
a14b6696c0 Annotate JIT callback function with call frame infromation.
This will allow us (theoretically) to unwind through JITer.
The code wasn't verified, so I'm pretty sure offsets are wrong :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44792 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 14:54:42 +00:00
Bill Wendling
041b3f8356 Reverting 44702. It wasn't correct to rename them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44727 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 23:58:46 +00:00
Chris Lattner
5aaddaa7b8 aesthetic changes, no functionality change. Evan, it's not clear
what 'Available' is, please add a comment near it and rename it
if appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44703 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 07:22:58 +00:00
Bill Wendling
320c630c1b Renaming:
isTriviallyReMaterializable -> hasNoSideEffects
  isReallyTriviallyReMaterializable -> isTriviallyReMaterializable


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44702 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 07:17:56 +00:00
Chris Lattner
d96428597b Fix a significant code quality regression I introduced on PPC64 quite
a while ago.  We now produce:

_foo:
	mflr r0
	std r0, 16(r1)
	ld r2, 16(r1)
	std r2, 0(r3)
	ld r0, 16(r1)
	mtlr r0
	blr 

instead of:

_foo:
	mflr r0
	std r0, 16(r1)
	lis r0, 0
	ori r0, r0, 16
	ldx r2, r1, r0
	std r2, 0(r3)
	ld r0, 16(r1)
	mtlr r0
	blr 

for:

void foo(void **X) {
  *X = __builtin_return_address(0);
}

on ppc64.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44701 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 07:04:58 +00:00
Chris Lattner
3fc027df4f implement __builtin_return_addr(0) on ppc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44700 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 06:59:59 +00:00
Chris Lattner
73944fb222 refactor some code to avoid overloading the name 'usesLR' in
different places to mean different things.  Document what the
one in PPCFunctionInfo means and when it is valid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44699 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 06:39:11 +00:00
Evan Cheng
1713d8bcff Doh
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44694 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:01:07 +00:00
Evan Cheng
7658445fa6 Fix a compilation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44692 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:00:31 +00:00
Evan Cheng
5a759616b6 Fix a compilation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44691 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:00:21 +00:00
Bill Wendling
0f940c95d4 Initial commit of the machine code LICM pass. It successfully hoists this:
_foo:
        li r2, 0
LBB1_1: ; bb
        li r5, 0
        stw r5, 0(r3)
        addi r2, r2, 1
        addi r3, r3, 4
        cmplw cr0, r2, r4
        bne cr0, LBB1_1 ; bb
LBB1_2: ; return
        blr 

to:

_foo:
        li r2, 0
        li r5, 0
LBB1_1: ; bb
        stw r5, 0(r3)
        addi r2, r2, 1
        addi r3, r3, 4
        cmplw cr0, r2, r4
        bne cr0, LBB1_1 ; bb
LBB1_2: ; return
        blr

ZOMG!! :-)

Moar to come...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44687 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 21:42:31 +00:00
Evan Cheng
779ccea5b6 Add comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44686 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 21:30:01 +00:00
Evan Cheng
8a86c3f3ae Much improved v8i16 shuffles. (Step 1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44676 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 08:07:39 +00:00
Evan Cheng
1076210ee3 Remove a bogus optimization. It's not possible to do a move to low element to a <8 x i16> or <16 x i8> vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44669 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 22:14:22 +00:00
Chris Lattner
e70da20f9a implement a readme entry, compiling the code into:
_foo:
	movl	$12, %eax
	andl	4(%esp), %eax
	movl	_array(%eax), %eax
	ret

instead of:

_foo:
	movl	4(%esp), %eax
	shrl	$2, %eax
	andl	$3, %eax
	movl	_array(,%eax,4), %eax
	ret

As it turns out, this triggers all the time, in a wide variety of
situations, for example, I see diffs like this in various programs:

-       movl    8(%eax), %eax
-       shll    $2, %eax
-       andl    $1020, %eax
-       movl    (%esi,%eax), %eax
+       movzbl  8(%eax), %eax
+       movl    (%esi,%eax,4), %eax


-       shll    $2, %edx
-       andl    $1020, %edx
-       movl    (%edi,%edx), %edx
+       andl    $255, %edx
+       movl    (%edi,%edx,4), %edx

Unfortunately, I also see stuff like this, which can be fixed in the
X86 backend:

-       andl    $85, %ebx
-       addl    _bit_count(,%ebx,4), %ebp
+       shll    $2, %ebx
+       andl    $340, %ebx
+       addl    _bit_count(%ebx), %ebp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44656 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 07:33:36 +00:00
Chris Lattner
81f2d71d52 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44638 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 23:05:06 +00:00
Chris Lattner
7d13015e32 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44637 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 22:58:19 +00:00
Scott Michel
42aa501491 Minor updates:
- Fix typo in SPUCallingConv.td
- Credit myself for CellSPU work
- Add CellSPU to 'all' host target list


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44627 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 21:23:16 +00:00
Evan Cheng
8c24e74b02 Added canFoldMemoryOperand for PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44623 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:41:29 +00:00
Evan Cheng
7db2811f6e Update foldMemoryOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44621 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:36:37 +00:00
Chris Lattner
4d321c55c4 fix warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:32:18 +00:00
Chris Lattner
58dd8568ee allow this to build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44619 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:30:11 +00:00
Evan Cheng
d64b5c82b9 Add a argument to storeRegToStackSlot and storeRegToAddr to specify whether
the stored register is killed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44600 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 03:14:33 +00:00
Scott Michel
b216a1b0b9 More stuff for CellSPU -- this should be enough to get an error-free
compilation (no files missing). Test cases remain to be checked in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44598 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 02:01:41 +00:00
Scott Michel
2466c3766d Updated source file headers to llvm coding standard.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44597 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 01:40:25 +00:00
Scott Michel
67d5755d69 Two missing files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44596 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 01:31:18 +00:00
Scott Michel
564427eabd Main CellSPU backend files checked in. Intrinsics and autoconf files
remain.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44595 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 01:24:05 +00:00
Scott Michel
6637752998 More files in the CellSPU drop...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44584 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 22:35:58 +00:00
Scott Michel
266bc8f777 More of the Cell SPU code drop from "Team Aerospace".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44582 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 22:23:35 +00:00
Scott Michel
a589a08c91 More CellSPU files... more to follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44559 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 23:14:43 +00:00
Scott Michel
01f4fc1a80 Makefile fragment for CellSPU.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44558 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 23:12:49 +00:00
Scott Michel
f2a2416bb4 First commit to CellSPU. More to follow
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44557 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 23:09:49 +00:00
Duncan Sands
a3355ffb3d Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute.  Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44544 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 20:06:50 +00:00
Evan Cheng
aee4af68ae Remove redundant foldMemoryOperand variants and other code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44517 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 08:30:39 +00:00
Evan Cheng
e62f97c094 Allow some reloads to be folded in multi-use cases. Specifically testl r, r -> cmpl [mem], 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44479 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 02:07:52 +00:00
Chris Lattner
4045e6db8c Work around a GCC bug, producing this code:
unsigned char *llvm_cbe_X;
...
  llvm_cbe_X = 0; *((void**)&llvm_cbe_X) = __builtin_stack_save();

instead of:

  llvm_cbe_X = __builtin_stack_save();

See PR1809 for details.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 21:26:17 +00:00
Chris Lattner
1f87300326 Implement ExpandOperationResult for ppc i64 fp->int, which fixes
CodeGen/Generic/fp_to_int.ll among others.  Its unclear why this 
just started failing...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44407 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 18:44:47 +00:00
Duncan Sands
afa3b6da11 Add some convenience methods for querying attributes, and
use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44403 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 17:07:01 +00:00
Chris Lattner
a3f61df4ff several entries got significantly better, though they still aren't done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44382 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 22:41:52 +00:00
Chris Lattner
f1b1c5ed1a implement a trivial readme entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44380 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 22:36:16 +00:00
Chris Lattner
789db09cde Fix a crash on invalid code due to memcpy lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44378 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 22:14:42 +00:00
Nate Begeman
d73ab8884f Support returning non-power-of-2 vectors to unblock some work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44371 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 19:28:48 +00:00
Andrew Lenharth
19914ed97f something wrong with this opt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 18:31:30 +00:00
Duncan Sands
dc024674ff Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Chris Lattner
8a594489bf Fix a long standing deficiency in the X86 backend: we would
sometimes emit "zero" and "all one" vectors multiple times,
for example:

_test2:
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M1
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M2
	ret

instead of:

_test2:
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M1
	movq	%mm0, _M2
	ret

This patch fixes this by always arranging for zero/one vectors
to be defined as v4i32 or v2i32 (SSE/MMX) instead of letting them be
any random type.  This ensures they get trivially CSE'd on the dag.
This fix is also important for LegalizeDAGTypes, as it gets unhappy
when the x86 backend wants BUILD_VECTOR(i64 0) to be legal even when
'i64' isn't legal.

This patch makes the following changes:

1) X86TargetLowering::LowerBUILD_VECTOR now lowers 0/1 vectors into
   their canonical types.
2) The now-dead patterns are removed from the SSE/MMX .td files.
3) All the patterns in the .td file that referred to immAllOnesV or
   immAllZerosV in the wrong form now use *_bc to match them with a
   bitcast wrapped around them.
4) X86DAGToDAGISel::SelectScalarSSELoad is generalized to handle 
   bitcast'd zero vectors, which simplifies the code actually.
5) getShuffleVectorZeroOrUndef is updated to generate a shuffle that
   is legal, instead of generating one that is illegal and expecting
   a later legalize pass to clean it up.
6) isZeroShuffle is generalized to handle bitcast of zeros.
7) several other minor tweaks.

This patch is definite goodness, but has the potential to cause random
code quality regressions.  Please be on the lookout for these and let 
me know if they happen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44310 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 00:24:49 +00:00
Chris Lattner
ffc04d3e4f add a immAllZerosV_bc pattern fragment for consistency with others.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44303 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-24 19:02:07 +00:00