Skip to content
  • Chris Lattner's avatar
    For functions that use vector registers, save VRSAVE, mark used · 02e2c18c
    Chris Lattner authored
    registers, and update it on entry to each function, then restore it on exit.
    
    This compiles:
    
    void func(vfloat *a, vfloat *b, vfloat *c) {
            *a = *b * *c + *c;
    }
    
    to this:
    
    _func:
            mfspr r2, 256
            oris r6, r2, 49152
            mtspr 256, r6
            lvx v0, 0, r5
            lvx v1, 0, r4
            vmaddfp v0, v1, v0, v0
            stvx v0, 0, r3
            mtspr 256, r2
            blr
    
    GCC produces this (which has additional stack accesses):
    
    _func:
            mfspr r0,256
            stw r0,-4(r1)
            oris r0,r0,0xc000
            mtspr 256,r0
            lvx v0,0,r5
            lvx v1,0,r4
            lwz r12,-4(r1)
            vmaddfp v0,v0,v1,v0
            stvx v0,0,r3
            mtspr 256,r12
            blr
    
    llvm-svn: 26733
    02e2c18c
Loading