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