Skip to content
  1. Apr 07, 2004
  2. Apr 06, 2004
    • Jakub Staszak's avatar
      · b8955205
      Jakub Staszak authored
      file based off InstSelectSimple.cpp, slowly being replaced by generated code from the really simple X86 instruction selector tablegen backend
      
      llvm-svn: 12715
      b8955205
    • Jakub Staszak's avatar
      · de647007
      Jakub Staszak authored
      Tablgen files for really simple instruction selector
      
      llvm-svn: 12714
      de647007
    • Chris Lattner's avatar
      Fix PR313: [x86] JIT miscompiles unsigned short to floating point · 4b936125
      Chris Lattner authored
      llvm-svn: 12711
      4b936125
    • Chris Lattner's avatar
      Fix incorrect encoding of some ADC and SBB instuctions · ba33ae58
      Chris Lattner authored
      llvm-svn: 12710
      ba33ae58
    • Chris Lattner's avatar
      Fix a minor bug in previous checking · 19c8b13e
      Chris Lattner authored
      Enable folding of long seteq/setne comparisons into branches and select instructions
      Implement unfolded long relational comparisons against a constants a bit more efficiently
      
      Folding comparisons changes code that looks like this:
              mov %EAX, DWORD PTR [%ESP + 4]
              mov %EDX, DWORD PTR [%ESP + 8]
              mov %ECX, %EAX
              or %ECX, %EDX
              sete %CL
              test %CL, %CL
              je .LBB2 # PC rel: F
      
      into code that looks like this:
              mov %EAX, DWORD PTR [%ESP + 4]
              mov %EDX, DWORD PTR [%ESP + 8]
              mov %ECX, %EAX
              or %ECX, %EDX
              jne .LBB2 # PC rel: F
      
      This speeds up 186.crafty by 6% with llc-ls.
      
      llvm-svn: 12702
      19c8b13e
    • Chris Lattner's avatar
      Improve codegen of long == and != comparisons against constants. Before, · f2ee88eb
      Chris Lattner authored
      comparing a long against zero got us this:
      
              sub %ESP, 8
              mov DWORD PTR [%ESP + 4], %ESI
              mov DWORD PTR [%ESP], %EDI
              mov %EAX, DWORD PTR [%ESP + 12]
              mov %EDX, DWORD PTR [%ESP + 16]
              mov %ECX, 0
              mov %ESI, 0
              mov %EDI, %EAX
              xor %EDI, %ECX
              mov %ECX, %EDX
              xor %ECX, %ESI
              or %EDI, %ECX
              sete %CL
              test %CL, %CL
              je .LBB2 # PC rel: F
      
      Now it gets us this:
      
              mov %EAX, DWORD PTR [%ESP + 4]
              mov %EDX, DWORD PTR [%ESP + 8]
              mov %ECX, %EAX
              or %ECX, %EDX
              sete %CL
              test %CL, %CL
              je .LBB2 # PC rel: F
      
      llvm-svn: 12696
      f2ee88eb
    • Chris Lattner's avatar
      Handle various other important cases of multiplying a long constant immediate. For · 6c3bf13f
      Chris Lattner authored
      example, multiplying X*(1 + (1LL << 32)) now produces:
      
      test:
              mov %ECX, DWORD PTR [%ESP + 4]
              mov %EDX, DWORD PTR [%ESP + 8]
              mov %EAX, %ECX
              add %EDX, %ECX
              ret
      
      [[[Note to Alkis: why isn't linear scan generating this code??  This might be a
       problem with your intervals being too conservative:
      
      test:
              mov %EAX, DWORD PTR [%ESP + 4]
              mov %EDX, DWORD PTR [%ESP + 8]
              add %EDX, %EAX
              ret
      
      end note]]]
      
      Whereas GCC produces this:
      
      T:
              sub     %esp, 12
              mov     %edx, DWORD PTR [%esp+16]
              mov     DWORD PTR [%esp+8], %edi
              mov     %ecx, DWORD PTR [%esp+20]
              xor     %edi, %edi
              mov     DWORD PTR [%esp], %ebx
              mov     %ebx, %edi
              mov     %eax, %edx
              mov     DWORD PTR [%esp+4], %esi
              add     %ebx, %edx
              mov     %edi, DWORD PTR [%esp+8]
              lea     %edx, [%ecx+%ebx]
              mov     %esi, DWORD PTR [%esp+4]
              mov     %ebx, DWORD PTR [%esp]
              add     %esp, 12
              ret
      
      I'm not sure example what GCC is smoking here, but it looks like it has just
      confused itself with a bunch of stack slots or something.  The intel compiler
      is better, but still not good:
      
      T:
              movl      4(%esp), %edx                                 #2.11
              movl      8(%esp), %eax                                 #2.11
              lea       (%eax,%edx), %ecx                             #3.12
              movl      $1, %eax                                      #3.12
              mull      %edx                                          #3.12
              addl      %ecx, %edx                                    #3.12
              ret                                                     #3.12
      
      llvm-svn: 12693
      6c3bf13f
    • Chris Lattner's avatar
      Efficiently handle a long multiplication by a constant. For this testcase: · 1f6024cb
      Chris Lattner authored
      long %test(long %X) {
              %Y = mul long %X, 123
              ret long %Y
      }
      
      we used to generate:
      
      test:
              sub %ESP, 12
              mov DWORD PTR [%ESP + 8], %ESI
              mov DWORD PTR [%ESP + 4], %EDI
              mov DWORD PTR [%ESP], %EBX
              mov %ECX, DWORD PTR [%ESP + 16]
              mov %ESI, DWORD PTR [%ESP + 20]
              mov %EDI, 123
              mov %EBX, 0
              mov %EAX, %ECX
              mul %EDI
              imul %ESI, %EDI
              add %ESI, %EDX
              imul %ECX, %EBX
              add %ESI, %ECX
              mov %EDX, %ESI
              mov %EBX, DWORD PTR [%ESP]
              mov %EDI, DWORD PTR [%ESP + 4]
              mov %ESI, DWORD PTR [%ESP + 8]
              add %ESP, 12
              ret
      
      Now we emit:
      test:
              mov %EAX, DWORD PTR [%ESP + 4]
              mov %ECX, DWORD PTR [%ESP + 8]
              mov %EDX, 123
              mul %EDX
              imul %ECX, %ECX, 123
              add %ECX, %EDX
              mov %EDX, %ECX
              ret
      
      Which, incidently, is substantially nicer than what GCC manages:
      T:
              sub     %esp, 8
              mov     %eax, 123
              mov     DWORD PTR [%esp], %ebx
              mov     %ebx, DWORD PTR [%esp+16]
              mov     DWORD PTR [%esp+4], %esi
              mov     %esi, DWORD PTR [%esp+12]
              imul    %ecx, %ebx, 123
              mov     %ebx, DWORD PTR [%esp]
              mul     %esi
              mov     %esi, DWORD PTR [%esp+4]
              add     %esp, 8
              lea     %edx, [%ecx+%edx]
              ret
      
      llvm-svn: 12692
      1f6024cb
    • Chris Lattner's avatar
      Improve code generation of long shifts by 32. · 2448baea
      Chris Lattner authored
      On this testcase:
      
      long %test(long %X) {
              %Y = shr long %X, ubyte 32
              ret long %Y
      }
      
      instead of:
      t:
              mov %EAX, DWORD PTR [%ESP + 4]
              mov %EAX, DWORD PTR [%ESP + 8]
              sar %EAX, 0
              mov %EDX, 0
              ret
      
      
      we now emit:
      test:
              mov %EAX, DWORD PTR [%ESP + 4]
              mov %EAX, DWORD PTR [%ESP + 8]
              mov %EDX, 0
              ret
      
      llvm-svn: 12688
      2448baea
    • Chris Lattner's avatar
      Bugfixes: inc/dec don't set the carry flag! · 7332d4c5
      Chris Lattner authored
      llvm-svn: 12687
      7332d4c5
    • Chris Lattner's avatar
      Improve code for passing constant longs as arguments to function calls. · decce5bc
      Chris Lattner authored
      For example, on this instruction:
      
              call void %test(long 1234)
      
      Instead of this:
              mov %EAX, 1234
              mov %ECX, 0
              mov DWORD PTR [%ESP], %EAX
              mov DWORD PTR [%ESP + 4], %ECX
              call test
      
      We now emit this:
              mov DWORD PTR [%ESP], 1234
              mov DWORD PTR [%ESP + 4], 0
              call test
      
      llvm-svn: 12686
      decce5bc
    • Chris Lattner's avatar
      Emit more efficient 64-bit operations when the RHS is a constant, and one · 5fc6f77b
      Chris Lattner authored
      of the words of the constant is zeros.  For example:
        Y = and long X, 1234
      
      now generates:
        Yl = and Xl, 1234
        Yh = 0
      
      instead of:
        Yl = and Xl, 1234
        Yh = and Xh, 0
      
      llvm-svn: 12685
      5fc6f77b
Loading