15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
16 |
# |
# |
17 |
# |
# |
18 |
# $Id: cbp_ppc.s,v 1.5 2002-03-22 12:51:22 canard Exp $ |
# $Id: cbp_ppc.s,v 1.8 2002-03-27 15:06:14 canard Exp $ |
19 |
# $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_ppc.s,v $ |
# $Source: /home/xvid/cvs_copy/cvs-server-root/xvid/xvidcore/src/bitstream/ppc_asm/cbp_ppc.s,v $ |
20 |
# $Date: 2002-03-22 12:51:22 $ |
# $Date: 2002-03-27 15:06:14 $ |
21 |
# $Author: canard $ |
# $Author: canard $ |
22 |
# |
# |
23 |
# This is my first PPC ASM attempt. So I might do nasty things. |
# This is my first PPC ASM attempt. So I might do nasty things. |
50 |
# |
# |
51 |
#} |
#} |
52 |
|
|
53 |
|
.data |
54 |
|
.skip: |
55 |
|
.word 0,-1 |
56 |
|
.align 4 |
57 |
|
|
58 |
.text |
.text |
59 |
.global calc_cbp_ppc |
.global calc_cbp_ppc |
60 |
calc_cbp_ppc: |
calc_cbp_ppc: |
63 |
# r8 is the loop counter (rows) |
# r8 is the loop counter (rows) |
64 |
li 8,5 |
li 8,5 |
65 |
# r3 contains the result, therefore we set it to 0 |
# r3 contains the result, therefore we set it to 0 |
66 |
xor 3,3,3 |
li 3,0 |
67 |
.loop: |
.loop: |
68 |
# CTR is the loop2 counter |
# CTR is the loop2 counter |
69 |
li 7,15 |
li 4,16 |
70 |
mtspr 9,7 |
mtctr 4 |
71 |
# r6 is coeff pointer for this line |
# r6 is coeff pointer for this line |
72 |
mr 6,9 |
mr 6,9 |
73 |
|
lis 7,.skip@ha |
74 |
|
addi 7,7,.skip@l |
75 |
|
lwz 7,0(7) |
76 |
.loop2: |
.loop2: |
77 |
# coeffs is a matrix of 16 bits cells |
# coeffs is a matrix of 16 bits cells |
78 |
lha 4,2(6) |
lwz 4,0(6) |
79 |
lha 5,4(6) |
and 4,4,7 |
80 |
or 4,5,4 |
li 7,-1 |
81 |
lha 5,6(6) |
|
82 |
or 4,5,4 |
lwz 5,4(6) |
|
lha 5,8(6) |
|
83 |
# or. updates CR0 |
# or. updates CR0 |
84 |
or. 4,5,4 |
or. 4,5,4 |
85 |
# testing bit 2 (is zero) of CR0 |
# testing bit 2 (is zero) of CR0 |
86 |
bf 2,.cbp |
bf 2,.cbp |
87 |
addi 6,6,8 |
addi 6,6,8 |
88 |
bdnz .loop2 |
bdnz .loop2 |
89 |
# latest line coeffs |
b .newline |
|
lha 4,2(6) |
|
|
lha 5,4(6) |
|
|
or 4,5,4 |
|
|
lha 5,6(6) |
|
|
# or. updates CR0 |
|
|
or. 4,5,4 |
|
|
# testing bit 2 (is zero) of CR0 |
|
|
bt 2,.newline |
|
90 |
.cbp: |
.cbp: |
91 |
li 4,1 |
li 4,1 |
92 |
slw 4,4,8 |
slw 4,4,8 |