sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\misc\t_cp0.cia
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
#include <cpudefs.h>
|
sl@0
|
20 |
#include "nk_cpu.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
__NAKED__ TUint32 BCUCTL()
|
sl@0
|
23 |
{
|
sl@0
|
24 |
asm("mrc p13, 0, r0, c0, c1, 0 ");
|
sl@0
|
25 |
__JUMP(,lr);
|
sl@0
|
26 |
}
|
sl@0
|
27 |
|
sl@0
|
28 |
__NAKED__ void GetAcc0(TInt64&)
|
sl@0
|
29 |
{
|
sl@0
|
30 |
MRA(0,1,2);
|
sl@0
|
31 |
asm("stmia r0, {r1,r2} ");
|
sl@0
|
32 |
__JUMP(,lr);
|
sl@0
|
33 |
}
|
sl@0
|
34 |
|
sl@0
|
35 |
__NAKED__ void SetAcc0(const TInt64&)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
asm("ldmia r0, {r1,r2} ");
|
sl@0
|
38 |
MAR(0,1,2);
|
sl@0
|
39 |
__JUMP(,lr);
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
__NAKED__ void InnerProduct(TInt64& /*aResult*/, const TInt16* /*aVec1*/, const TInt16* /*aVec2*/, TInt /*aLength*/)
|
sl@0
|
43 |
//
|
sl@0
|
44 |
// Calculate the inner product of vectors using the DSP coprocessor
|
sl@0
|
45 |
//
|
sl@0
|
46 |
{
|
sl@0
|
47 |
asm("str lr, [sp, #-4]! ");
|
sl@0
|
48 |
asm("mov r12, #0 ");
|
sl@0
|
49 |
asm("mov r14, #0 ");
|
sl@0
|
50 |
MAR(0,12,14);
|
sl@0
|
51 |
asm("1: ");
|
sl@0
|
52 |
asm("ldrh r12, [r1], #2 ");
|
sl@0
|
53 |
asm("ldrh r14, [r2], #2 ");
|
sl@0
|
54 |
MIABB(0,12,14);
|
sl@0
|
55 |
asm("subs r3, r3, #1 ");
|
sl@0
|
56 |
asm("bne 1b ");
|
sl@0
|
57 |
MRA(0,12,14);
|
sl@0
|
58 |
asm("stmia r0, {r12,r14} ");
|
sl@0
|
59 |
asm("ldr pc, [sp], #4 ");
|
sl@0
|
60 |
}
|
sl@0
|
61 |
|
sl@0
|
62 |
__NAKED__ void InnerProduct2(TInt64& /*aResult*/, const TInt16* /*aVec1*/, const TInt16* /*aVec2*/, TInt /*aLength*/)
|
sl@0
|
63 |
//
|
sl@0
|
64 |
// Calculate the inner product of vectors using the normal multiply instructions
|
sl@0
|
65 |
//
|
sl@0
|
66 |
{
|
sl@0
|
67 |
asm("stmfd sp!, {r4-r5,lr} ");
|
sl@0
|
68 |
asm("mov r4, #0 ");
|
sl@0
|
69 |
asm("mov r5, #0 ");
|
sl@0
|
70 |
asm("1: ");
|
sl@0
|
71 |
asm("ldrsh r12, [r1], #2 ");
|
sl@0
|
72 |
asm("ldrsh r14, [r2], #2 ");
|
sl@0
|
73 |
asm("smlal r4, r5, r12, r14 ");
|
sl@0
|
74 |
asm("subs r3, r3, #1 ");
|
sl@0
|
75 |
asm("bne 1b ");
|
sl@0
|
76 |
asm("stmia r0, {r4,r5} ");
|
sl@0
|
77 |
asm("ldmfd sp!, {r4-r5,pc} ");
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|