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 copy_mem16x16_ppc
13
14;# r3 unsigned char *src
15;# r4 int src_stride
16;# r5 unsigned char *dst
17;# r6 int dst_stride
18
19;# Make the assumption that input will not be aligned,
20;#  but the output will be.  So two reads and a perm
21;#  for the input, but only one store for the output.
22copy_mem16x16_ppc:
23    mfspr   r11, 256            ;# get old VRSAVE
24    oris    r12, r11, 0xe000
25    mtspr   256, r12            ;# set VRSAVE
26
27    li      r10, 16
28    mtctr   r10
29
30cp_16x16_loop:
31    lvsl    v0,  0, r3          ;# permutate value for alignment
32
33    lvx     v1,   0, r3
34    lvx     v2, r10, r3
35
36    vperm   v1, v1, v2, v0
37
38    stvx    v1,  0, r5
39
40    add     r3, r3, r4          ;# increment source pointer
41    add     r5, r5, r6          ;# increment destination pointer
42
43    bdnz    cp_16x16_loop
44
45    mtspr   256, r11            ;# reset old VRSAVE
46
47    blr
48