Skip to content
  1. Dec 06, 2005
  2. Dec 05, 2005
    • Andrew Lenharth's avatar
      move this over to the dag · 5bfcd1e6
      Andrew Lenharth authored
      llvm-svn: 24609
      5bfcd1e6
    • Chris Lattner's avatar
      getRawValue zero extens for unsigned values, use getsextvalue so that we · 07720073
      Chris Lattner authored
      know that small negative values fit into the immediate field of addressing
      modes.
      
      llvm-svn: 24608
      07720073
    • Andrew Lenharth's avatar
      fix constant pool loads · 94104339
      Andrew Lenharth authored
      llvm-svn: 24607
      94104339
    • Chris Lattner's avatar
      Fix the #1 code quality problem that I have seen on X86 (and it also affects · 35397788
      Chris Lattner authored
      PPC and other targets).  In a particular, consider code like this:
      
      struct Vector3 { double x, y, z; };
      struct Matrix3 { Vector3 a, b, c; };
      double dot(Vector3 &a, Vector3 &b) {
         return a.x * b.x  +  a.y * b.y  +  a.z * b.z;
      }
      Vector3 mul(Vector3 &a, Matrix3 &b) {
         Vector3 r;
         r.x = dot( a, b.a );
         r.y = dot( a, b.b );
         r.z = dot( a, b.c );
         return r;
      }
      void transform(Matrix3 &m, Vector3 *x, int n) {
         for (int i = 0; i < n; i++)
            x[i] = mul( x[i], m );
      }
      
      we compile transform to a loop with all of the GEP instructions for indexing
      into 'm' pulled out of the loop (9 of them).  Because isel occurs a bb at a time
      we are unable to fold the constant index into the loads in the loop, leading to
      PPC code that looks like this:
      
      LBB3_1: ; no_exit.preheader
              li r2, 0
              addi r6, r3, 64        ;; 9 values live across the loop body!
              addi r7, r3, 56
              addi r8, r3, 48
              addi r9, r3, 40
              addi r10, r3, 32
              addi r11, r3, 24
              addi r12, r3, 16
              addi r30, r3, 8
      LBB3_2: ; no_exit
              lfd f0, 0(r30)
              lfd f1, 8(r4)
              fmul f0, f1, f0
              lfd f2, 0(r3)        ;; no constant indices folded into the loads!
              lfd f3, 0(r4)
              lfd f4, 0(r10)
              lfd f5, 0(r6)
              lfd f6, 0(r7)
              lfd f7, 0(r8)
              lfd f8, 0(r9)
              lfd f9, 0(r11)
              lfd f10, 0(r12)
              lfd f11, 16(r4)
              fmadd f0, f3, f2, f0
              fmul f2, f1, f4
              fmadd f0, f11, f10, f0
              fmadd f2, f3, f9, f2
              fmul f1, f1, f6
              stfd f0, 0(r4)
              fmadd f0, f11, f8, f2
              fmadd f1, f3, f7, f1
              stfd f0, 8(r4)
              fmadd f0, f11, f5, f1
              addi r29, r4, 24
              stfd f0, 16(r4)
              addi r2, r2, 1
              cmpw cr0, r2, r5
              or r4, r29, r29
              bne cr0, LBB3_2 ; no_exit
      
      uh, yuck.  With this patch, we now sink the constant offsets into the loop, producing
      this code:
      
      LBB3_1: ; no_exit.preheader
              li r2, 0
      LBB3_2: ; no_exit
              lfd f0, 8(r3)
              lfd f1, 8(r4)
              fmul f0, f1, f0
              lfd f2, 0(r3)
              lfd f3, 0(r4)
              lfd f4, 32(r3)       ;; much nicer.
              lfd f5, 64(r3)
              lfd f6, 56(r3)
              lfd f7, 48(r3)
              lfd f8, 40(r3)
              lfd f9, 24(r3)
              lfd f10, 16(r3)
              lfd f11, 16(r4)
              fmadd f0, f3, f2, f0
              fmul f2, f1, f4
              fmadd f0, f11, f10, f0
              fmadd f2, f3, f9, f2
              fmul f1, f1, f6
              stfd f0, 0(r4)
              fmadd f0, f11, f8, f2
              fmadd f1, f3, f7, f1
              stfd f0, 8(r4)
              fmadd f0, f11, f5, f1
              addi r6, r4, 24
              stfd f0, 16(r4)
              addi r2, r2, 1
              cmpw cr0, r2, r5
              or r4, r6, r6
              bne cr0, LBB3_2 ; no_exit
      
      This is much nicer as it reduces register pressure in the loop a lot.  On X86,
      this takes the function from having 9 spilled registers to 2.  This should help
      some spec programs on X86 (gzip?)
      
      This is currently only enabled with -enable-gep-isel-opt to allow perf testing
      tonight.
      
      llvm-svn: 24606
      35397788
    • Chris Lattner's avatar
      Add a flag to Module::getGlobalVariable to allow it to return vars with · 7d4d93c5
      Chris Lattner authored
      internal linkage.
      
      Patch provided by Evan Jones, thanks!
      
      llvm-svn: 24604
      7d4d93c5
    • Chris Lattner's avatar
      Wrap a long line, never internalize llvm.used. · 16599820
      Chris Lattner authored
      llvm-svn: 24602
      16599820
    • Chris Lattner's avatar
      Several things: · 3c0b8f57
      Chris Lattner authored
      1. Remove redundant type casts now that PR673 is implemented.
      2. Implement the OUT*ir instructions correctly.  The port number really
         *is* a 16-bit value, but the patterns should only match if the number
         is 0-255.  Update the patterns so they now match.
      3. Fix patterns for shifts to reflect that the shift amount is always an
         i8, not an i16 as they were believed to be before.  This previous fib
         stopped working when we started knowing that CL has type i8.
      4. Change use of i16i8imm in SH*ri patterns to all be imm.
      
      llvm-svn: 24599
      3c0b8f57
    • Chris Lattner's avatar
      On some targets (e.g. X86), shift amounts are not the same as the value · 282c2af4
      Chris Lattner authored
      being shifted.  Don't assume they are.
      
      llvm-svn: 24598
      282c2af4
    • Chris Lattner's avatar
      Add some explicit type casts so that tblgen knows the type of the shiftamount,... · c54cddd2
      Chris Lattner authored
      Add some explicit type casts so that tblgen knows the type of the shiftamount, which is not necessarily the same as the type being shifted.
      
      llvm-svn: 24595
      c54cddd2
    • Chris Lattner's avatar
      Add some explicit type casts so that tblgen knows the type of the shift · f3322af5
      Chris Lattner authored
      amount, which is not necessarily the same as the type being shifted.
      
      llvm-svn: 24594
      f3322af5
  3. Dec 04, 2005
  4. Dec 03, 2005
  5. Dec 02, 2005
  6. Dec 01, 2005
  7. Nov 30, 2005
Loading