1;
2;  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3;
4;  Use of this source code is governed by a BSD-style license
5;  that can be found in the LICENSE file in the root of the source
6;  tree. An additional intellectual property rights grant can be found
7;  in the file PATENTS.  All contributing project authors may
8;  be found in the AUTHORS file in the root of the source tree.
9;
10
11
12    .globl vp8_block_error_ppc
13
14    .align 2
15;# r3 short *Coeff
16;# r4 short *dqcoeff
17vp8_block_error_ppc:
18    mfspr   r11, 256            ;# get old VRSAVE
19    oris    r12, r11, 0xf800
20    mtspr   256, r12            ;# set VRSAVE
21
22    stwu    r1,-32(r1)          ;# create space on the stack
23
24    stw     r5, 12(r1)          ;# tranfer dc to vector register
25
26    lvx     v0, 0, r3           ;# Coeff
27    lvx     v1, 0, r4           ;# dqcoeff
28
29    li      r10, 16
30
31    vspltisw v3, 0
32
33    vsubshs v0, v0, v1
34
35    vmsumshm v2, v0, v0, v3     ;# multiply differences
36
37    lvx     v0, r10, r3         ;# Coeff
38    lvx     v1, r10, r4         ;# dqcoeff
39
40    vsubshs v0, v0, v1
41
42    vmsumshm v1, v0, v0, v2     ;# multiply differences
43    vsumsws v1, v1, v3          ;# sum up
44
45    stvx    v1, 0, r1
46    lwz     r3, 12(r1)          ;# return value
47
48    addi    r1, r1, 32          ;# recover stack
49    mtspr   256, r11            ;# reset old VRSAVE
50
51    blr
52