aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86ISelPattern.cpp
AgeCommit message (Collapse)Author
2005-01-14Adjust to CopyFromREg changes.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19561 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Add new ImplicitDef node, rename CopyRegSDNode class to RegSDNode.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19535 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Codegen factor nodes more intelligently according to perceived register ↵Chris Lattner
pressure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19532 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Initial trivial (but stupid) codegen for this node.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19529 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-13Add some really pedantic assertions to the load folding code. Fix a bunchChris Lattner
of cases where we accidentally emitted a load folded once and unfolded elsewhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19522 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12We can only fold a load into an op if there is exactly one use of the value.Chris Lattner
Checking to see if the load has two uses is not equivalent, as the chain value may have zero uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19518 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Try both ways to fold an add together. This allows us to generate this codeChris Lattner
imul %EAX, %EAX, 400 add %ECX, %EAX add %ESI, DWORD PTR [%ECX + 4*%EDX] inc %EDX cmp %EDX, 100 instead of this: imul %EAX, %EAX, 400 add %ECX, %EAX mov %EAX, %EDX shl %EAX, 2 add %ECX, %EAX add %ESI, DWORD PTR [%ECX] inc %EDX cmp %EDX, 100 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19513 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Fix a major miscompilation where we were overwriting the scale reg.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19511 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Do not use the type of the RHS constant to determine the type of the operation.Chris Lattner
This fails for shifts because the constant is always 8 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19508 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Fix C++ more compilatiom errorsJeff Cohen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19504 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Fix a compile error with VC++, which things that static const arrays needChris Lattner
to be dynamically initialized. :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19503 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Fix a bug that caused us to crash on povray. We weren't emitting an ↵Chris Lattner
FP_REG_KILL into a block that had a successor with a FP PHI node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19502 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Fix a crash compiling povray on UINT_TO_FP from i16.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19499 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12There are no [mem] op= reg instructions for FP, so remove their entries.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19496 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Fix a bug where we didn't insert FP_REG_KILL instructions into MBB's thatChris Lattner
contain FP PHI nodes but no other FP defining instructions. This fixes 183.equake git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19495 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Fold TRUNCATE (LOAD P) into a smaller load from P.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19494 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Be more careful about order of arg evalution for CopyToReg nodes. This shrinksChris Lattner
256.bzip2 from 7142 to 7103 lines of .s file. Second, add initial support for folding loads into compares, though this code is dynamically dead for now. :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19493 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-12Fold some more [mem] op= val operators. This allows us to things like thisChris Lattner
several times in 256.bzip2: mov %EAX, DWORD PTR [%ESP + 204] - mov %EAX, DWORD PTR [%EAX] - or %EAX, 2097152 - mov %ECX, DWORD PTR [%ESP + 204] - mov DWORD PTR [%ECX], %EAX + or DWORD PTR [%EAX], 2097152 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19492 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Fold loads into sign/zero extends. instead of:Chris Lattner
mov %AL, BYTE PTR [%EDX + l18_length_code] movzx %EAX, %AL Emit: movzx %EAX, BYTE PTR [%EDX + l18_length_code] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19489 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Comment out debug code :)Chris Lattner
Select [mem] += Val operations. For constants, we used to get: mov %ECX, -32768 add %ECX, DWORD PTR [l4_match_start] mov DWORD PTR [l4_match_start], %ECX Now we get: add DWORD PTR [l4_match_start], -32768 For other values we used to get: mov %EBP, %EDI ;; because the add destroys the value add %EBP, DWORD PTR [l4_input_len] mov DWORD PTR [l4_input_len], %EBP now we get: add DWORD PTR [l4_input_len], %EDI Both of these use less registers than the alternative, are faster and smaller. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19488 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Treat int constants as not requiring a register, since they are almost alwaysChris Lattner
folded into an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19486 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11* Factor a bunch of binary operator cases into shared code.Chris Lattner
* Fold loads into Add, sub, and, or, xor and mul when possible. * Codegen shl X, 1 as add X, X git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19483 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Fold multiplies by 3,5,9 into addressing modes when possible.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19480 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Instead of generating stuff like this:Chris Lattner
mov %ECX, %EAX add %ECX, 32768 mov %SI, WORD PTR [2*%ECX + l13_prev] Generate this: mov %SI, WORD PTR [2*%ECX + l13_prev + 65536] This occurs when you have a GEP instruction where an index is "something + imm". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19472 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Implement MEMCPY natively in terms of rep movs*Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19468 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Implement memset -> rep stos*Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19467 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Announce that we don't support mem ops yet.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19466 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Teach the address selector to make 'reg+reg' addressing modes.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19457 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Emit NOT instructions.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19455 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Fix a bug emitting branches that broke a lot of programs.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19452 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Be more careful where we set ContainsFPCode. We were missing a set in theChris Lattner
int -> FP casting code. Note that we don't have to set it for FP operations that take FP values as operands: whatever produces the FP value will set the flag. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19451 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Fix a major bug in setcc/cmov folding, where we accidentallyChris Lattner
inverted the sense of the comparison. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19450 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-11Take register pressure into account when we have to decide whether toChris Lattner
evaluate the LHS or the RHS of an operation first. This causes good things to happen. For example, instead of compiling a loop to this: .LBBstrength_result7_1: # loopentry movl 16(%esp), %edi movl (%edi), %edi ;;; LOAD movl (%ecx), %ebx movl $2, (%eax,%ebx,4) movl (%edx), %ebx movl %esi, %ebp addl $21, %ebp addl $42, %esi cmpl $0, %edi ;;; USE cmovne %esi, %ebp cmpl %ebp, %ebx movl %ebp, %esi jg .LBBstrength_result7_1 We now compile it to this: .LBBstrength_result7_1: # loopentry movl %edi, %ebx addl $42, %ebx addl $21, %edi movl (%ecx), %ebp ;; LOAD cmpl $0, %ebp ;; USE cmovne %ebx, %edi movl (%edx), %ebx movl $2, (%eax,%ebx,4) movl (%esi), %ebx cmpl %edi, %ebx jg .LBBstrength_result7_1 Which reduces register pressure enough (in this case) to avoid spilling in the loop. As another example, consider the CodeGen/X86/regpressure.ll testcase. We used to generate this code for both cases: regpressure1: subl $32, %esp movl %esi, 12(%esp) movl %edi, 8(%esp) movl %ebx, 4(%esp) movl %ebp, (%esp) movl 36(%esp), %ecx movl (%ecx), %eax movl 4(%ecx), %edx movl %edx, 24(%esp) movl 8(%ecx), %edx movl %edx, 16(%esp) movl 12(%ecx), %edx movl 16(%ecx), %esi movl 20(%ecx), %edi movl 24(%ecx), %ebx movl %ebx, 28(%esp) movl 28(%ecx), %ebx movl 32(%ecx), %ebp movl %ebp, 20(%esp) movl 36(%ecx), %ecx imull 24(%esp), %eax imull 16(%esp), %eax imull %edx, %eax imull %esi, %eax imull %edi, %eax imull 28(%esp), %eax imull %ebx, %eax imull 20(%esp), %eax imull %ecx, %eax movl (%esp), %ebp movl 4(%esp), %ebx movl 8(%esp), %edi movl 12(%esp), %esi addl $32, %esp ret This code is basically trying to do all of the loads first, then execute all of the multiplies. Because we run out of registers, lots of spill code happens. We now generate this code for both cases: regpressure1: movl 4(%esp), %ecx movl (%ecx), %eax movl 4(%ecx), %edx imull %edx, %eax movl 8(%ecx), %edx imull %edx, %eax movl 12(%ecx), %edx imull %edx, %eax movl 16(%ecx), %edx imull %edx, %eax movl 20(%ecx), %edx imull %edx, %eax movl 24(%ecx), %edx imull %edx, %eax movl 28(%ecx), %edx imull %edx, %eax movl 32(%ecx), %edx imull %edx, %eax movl 36(%ecx), %ecx imull %ecx, %eax ret which is much nicer (when we fold loads into the muls it will be even better). The old instruction selector used to produce the good code for regpressure1 but not for regpressure2, as it depended on the order of operations in the LLVM code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19449 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-10Fold setcc instructions into selects.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19438 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-10Implement 8-bit multiply for X86.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19435 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09Codegen (Reg|imm)+&GV as an LEA, because we cannot put it into the immediate ↵Chris Lattner
field of an ADDri (due to current restrictions on MachineOperand :( ). This allows us to generate: leal Data+16000, %edx instead of: movl $Data, %edx addl $16000, %edx git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19420 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09Fix copy and pasto's for FP -> Int. This fixes fldryChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19418 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09Initial implementation of FP->INT and INT->FP castsChris Lattner
Also, fix zero_extend from bool to i8, which fixes Shootout/objinst. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19414 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09Implement varargs and returnaddress/frameaddress intrinsics. With thisChris Lattner
patch, all of SingleSource/UnitTests passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19408 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Okay 15th time is the charm. Looking at the vector size is useless as itChris Lattner
gets clobbered by a previous statement. This fixes all calls finally. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19399 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Okay, my off by one was actually off by two. This fixes ↵Chris Lattner
Generic/2003-07-07-BadLongConst.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19398 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Fix off by one errorChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19396 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-08Adjust to changes in LowerCallTo interfaceChris Lattner
Minor bugfixes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19376 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07Reimplementation of the X86 pattern isel. This is still missing many largeChris Lattner
pieces, but can already do amazing things in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19334 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-07This file is now dead.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19333 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-15Disable the pattern iselChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15787 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26Fix file header as it has been renamed.Misha Brukman
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15239 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04Add #include <iostream> since Value.h does not #include it any more.Reid Spencer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14622 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28Clean up a lot of the code I added yesterday by exposing the IntrinsicLoweringChris Lattner
implementation from the TargetMachine directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10636 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-28implement support for the intrinsic lowering functionalityChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10629 91177308-0d34-0410-b5e6-96231b3b80d8