Skip to content
  1. Apr 18, 2006
    • Chris Lattner's avatar
      Implement an important entry from README_ALTIVEC: · 9754d142
      Chris Lattner authored
      If an altivec predicate compare is used immediately by a branch, don't
      use a (serializing) MFCR instruction to read the CR6 register, which requires
      a compare to get it back to CR's.  Instead, just branch on CR6 directly. :)
      
      For example, for:
      void foo2(vector float *A, vector float *B) {
        if (!vec_any_eq(*A, *B))
          *B = (vector float){0,0,0,0};
      }
      
      We now generate:
      
      _foo2:
              mfspr r2, 256
              oris r5, r2, 12288
              mtspr 256, r5
              lvx v2, 0, r4
              lvx v3, 0, r3
              vcmpeqfp. v2, v3, v2
              bne cr6, LBB1_2 ; UnifiedReturnBlock
      LBB1_1: ; cond_true
              vxor v2, v2, v2
              stvx v2, 0, r4
              mtspr 256, r2
              blr
      LBB1_2: ; UnifiedReturnBlock
              mtspr 256, r2
              blr
      
      instead of:
      
      _foo2:
              mfspr r2, 256
              oris r5, r2, 12288
              mtspr 256, r5
              lvx v2, 0, r4
              lvx v3, 0, r3
              vcmpeqfp. v2, v3, v2
              mfcr r3, 2
              rlwinm r3, r3, 27, 31, 31
              cmpwi cr0, r3, 0
              beq cr0, LBB1_2 ; UnifiedReturnBlock
      LBB1_1: ; cond_true
              vxor v2, v2, v2
              stvx v2, 0, r4
              mtspr 256, r2
              blr
      LBB1_2: ; UnifiedReturnBlock
              mtspr 256, r2
              blr
      
      This implements CodeGen/PowerPC/vec_br_cmp.ll.
      
      llvm-svn: 27804
      9754d142
    • Chris Lattner's avatar
      move some stuff around, clean things up · 68c16a20
      Chris Lattner authored
      llvm-svn: 27802
      68c16a20
    • Chris Lattner's avatar
      Use vmladduhm to do v8i16 multiplies which is faster and simpler than doing · 96d50487
      Chris Lattner authored
      even/odd halves.  Thanks to Nate telling me what's what.
      
      llvm-svn: 27793
      96d50487
    • Chris Lattner's avatar
      Implement v16i8 multiply with this code: · d6d82aa8
      Chris Lattner authored
              vmuloub v5, v3, v2
              vmuleub v2, v3, v2
              vperm v2, v2, v5, v4
      
      This implements CodeGen/PowerPC/vec_mul.ll.  With this, v16i8 multiplies are
      6.79x faster than before.
      
      Overall, UnitTests/Vector/multiplies.c is now 2.45x faster with LLVM than with
      GCC.
      
      Remove the 'integer multiplies' todo from the README file.
      
      llvm-svn: 27792
      d6d82aa8
    • Chris Lattner's avatar
      Lower v8i16 multiply into this code: · 7e439874
      Chris Lattner authored
              li r5, lo16(LCPI1_0)
              lis r6, ha16(LCPI1_0)
              lvx v4, r6, r5
              vmulouh v5, v3, v2
              vmuleuh v2, v3, v2
              vperm v2, v2, v5, v4
      
      where v4 is:
      LCPI1_0:                                        ;  <16 x ubyte>
              .byte   2
              .byte   3
              .byte   18
              .byte   19
              .byte   6
              .byte   7
              .byte   22
              .byte   23
              .byte   10
              .byte   11
              .byte   26
              .byte   27
              .byte   14
              .byte   15
              .byte   30
              .byte   31
      
      This is 5.07x faster on the G5 (measured) than lowering to scalar code +
      loads/stores.
      
      llvm-svn: 27789
      7e439874
    • Chris Lattner's avatar
      Custom lower v4i32 multiplies into a cute sequence, instead of having legalize · a2cae1bb
      Chris Lattner authored
      scalarize the sequence into 4 mullw's and a bunch of load/store traffic.
      
      This speeds up v4i32 multiplies 4.1x (measured) on a G5.  This implements
      PowerPC/vec_mul.ll
      
      llvm-svn: 27788
      a2cae1bb
  2. Apr 17, 2006
  3. Apr 16, 2006
  4. Apr 15, 2006
  5. Apr 14, 2006
  6. Apr 13, 2006
  7. Apr 12, 2006
    • Chris Lattner's avatar
      Add a new way to match vector constants, which make it easier to bang bits of · 147e50e1
      Chris Lattner authored
      different types.
      
      Codegen spltw(0x7FFFFFFF) and spltw(0x80000000) without a constant pool load,
      implementing PowerPC/vec_constants.ll:test1.  This compiles:
      
      typedef float vf __attribute__ ((vector_size (16)));
      typedef int vi __attribute__ ((vector_size (16)));
      void test(vi *P1, vi *P2, vf *P3) {
        *P1 &= (vi){0x80000000,0x80000000,0x80000000,0x80000000};
        *P2 &= (vi){0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF,0x7FFFFFFF};
        *P3 = vec_abs((vector float)*P3);
      }
      
      to:
      
      _test:
              mfspr r2, 256
              oris r6, r2, 49152
              mtspr 256, r6
              vspltisw v0, -1
              vslw v0, v0, v0
              lvx v1, 0, r3
              vand v1, v1, v0
              stvx v1, 0, r3
              lvx v1, 0, r4
              vandc v1, v1, v0
              stvx v1, 0, r4
              lvx v1, 0, r5
              vandc v0, v1, v0
              stvx v0, 0, r5
              mtspr 256, r2
              blr
      
      instead of (with two constant pool entries):
      
      _test:
              mfspr r2, 256
              oris r6, r2, 49152
              mtspr 256, r6
              li r6, lo16(LCPI1_0)
              lis r7, ha16(LCPI1_0)
              li r8, lo16(LCPI1_1)
              lis r9, ha16(LCPI1_1)
              lvx v0, r7, r6
              lvx v1, 0, r3
              vand v0, v1, v0
              stvx v0, 0, r3
              lvx v0, r9, r8
              lvx v1, 0, r4
              vand v1, v1, v0
              stvx v1, 0, r4
              lvx v1, 0, r5
              vand v0, v1, v0
              stvx v0, 0, r5
              mtspr 256, r2
              blr
      
      GCC produces (with 2 cp entries):
      
      _test:
              mfspr r0,256
              stw r0,-4(r1)
              oris r0,r0,0xc00c
              mtspr 256,r0
              lis r2,ha16(LC0)
              lis r9,ha16(LC1)
              la r2,lo16(LC0)(r2)
              lvx v0,0,r3
              lvx v1,0,r5
              la r9,lo16(LC1)(r9)
              lwz r12,-4(r1)
              lvx v12,0,r2
              lvx v13,0,r9
              vand v0,v0,v12
              stvx v0,0,r3
              vspltisw v0,-1
              vslw v12,v0,v0
              vandc v1,v1,v12
              stvx v1,0,r5
              lvx v0,0,r4
              vand v0,v0,v13
              stvx v0,0,r4
              mtspr 256,r12
              blr
      
      llvm-svn: 27624
      147e50e1
    • Chris Lattner's avatar
      Rename get_VSPLI_elt -> get_VSPLTI_elt · 74cf9ff7
      Chris Lattner authored
      Canonicalize BUILD_VECTOR's that match VSPLTI's into a single type for each
      form, eliminating a bunch of Pat patterns in the .td file and allowing us to
      CSE stuff more aggressively.  This implements
      PowerPC/buildvec_canonicalize.ll:VSPLTI
      
      llvm-svn: 27614
      74cf9ff7
    • Chris Lattner's avatar
      Ensure that zero vectors are always v4i32, which forces them to CSE with · e318a757
      Chris Lattner authored
      each other.  This implements CodeGen/PowerPC/vxor-canonicalize.ll
      
      llvm-svn: 27609
      e318a757
  8. Apr 11, 2006
Loading