Skip to content
  1. Nov 14, 2004
  2. Nov 13, 2004
    • Chris Lattner's avatar
      Hack around stupidity in GCC, fixing Burg with the CBE and · 073f6ca3
      Chris Lattner authored
      CBackend/2004-11-13-FunctionPointerCast.llx
      
      llvm-svn: 17710
      073f6ca3
    • Chris Lattner's avatar
      · 049d33a7
      Chris Lattner authored
      shld is a very high latency operation. Instead of emitting it for shifts of
      two or three, open code the equivalent operation which is faster on athlon
      and P4 (by a substantial margin).
      
      For example, instead of compiling this:
      
      long long X2(long long Y) { return Y << 2; }
      
      to:
      
      X3_2:
              movl 4(%esp), %eax
              movl 8(%esp), %edx
              shldl $2, %eax, %edx
              shll $2, %eax
              ret
      
      Compile it to:
      
      X2:
              movl 4(%esp), %eax
              movl 8(%esp), %ecx
              movl %eax, %edx
              shrl $30, %edx
              leal (%edx,%ecx,4), %edx
              shll $2, %eax
              ret
      
      Likewise, for << 3, compile to:
      
      X3:
              movl 4(%esp), %eax
              movl 8(%esp), %ecx
              movl %eax, %edx
              shrl $29, %edx
              leal (%edx,%ecx,8), %edx
              shll $3, %eax
              ret
      
      This matches icc, except that icc open codes the shifts as adds on the P4.
      
      llvm-svn: 17707
      049d33a7
    • Chris Lattner's avatar
      Add missing check · ef6bd92a
      Chris Lattner authored
      llvm-svn: 17706
      ef6bd92a
    • Chris Lattner's avatar
      Compile: · 8d521bb1
      Chris Lattner authored
      long long X3_2(long long Y) { return Y+Y; }
      int X(int Y) { return Y+Y; }
      
      into:
      
      X3_2:
              movl 4(%esp), %eax
              movl 8(%esp), %edx
              addl %eax, %eax
              adcl %edx, %edx
              ret
      X:
              movl 4(%esp), %eax
              addl %eax, %eax
              ret
      
      instead of:
      
      X3_2:
              movl 4(%esp), %eax
              movl 8(%esp), %edx
              shldl $1, %eax, %edx
              shll $1, %eax
              ret
      
      X:
              movl 4(%esp), %eax
              shll $1, %eax
              ret
      
      llvm-svn: 17705
      8d521bb1
Loading