1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     math_Quaternion.cpp
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 #include <nn/math.h>
17 
18 #include <cmath>
19 #include <nn/math/math_Quaternion.h>
20 
21 #if !defined(NN_MATH_AS_INLINE)
22 #include <nn/math/inline/math_Quaternion.ipp>
23 #include <nn/math/ARMv6/inline/math_Quaternion.ipp>
24 #endif
25 
26 
27 namespace nn {
28 namespace math {
29 namespace ARMv6 {
30 #include <nn/hw/ARM/code32.h>
31 
32 NN_FUNC_ATTR_PRIVATE_SECTION
QUATMultAsm(QUAT *,const QUAT *,const QUAT *)33 asm QUAT* QUATMultAsm(QUAT*, const QUAT*, const QUAT* )
34 {
35     VLDMIA      r1,{s4-s7}        // All q1 vectors are put in the [S4-S7] registers
36     VLDMIA      r2,{s8-s11}       // All q2 vectors are put in the [S8-S11] registers
37 
38     VMUL.F32    s0,s7,s8
39     VMUL.F32    s1,s7,s9
40     VMUL.F32    s2,s7,s10
41     VMUL.F32    s3,s7,s11
42 
43     VMLA.F32    s0,s4,s11
44     VMLA.F32    s1,s5,s11
45     VMLA.F32    s2,s6,s11
46     VMLS.F32    s3,s4,s8
47 
48     VMLA.F32    s0,s5,s10
49     VMLA.F32    s1,s6,s8
50     VMLA.F32    s2,s4,s9
51     VMLS.F32    s3,s5,s9
52 
53     VMLS.F32    s0,s6,s9
54     VMLS.F32    s1,s4,s10
55     VMLS.F32    s2,s5,s8
56     VMLS.F32    s3,s6,s10
57 
58     VSTMIA      r0,{s0-s3}          // Store result
59     BX          lr                  // Return
60 }
61 
62 
63 #include <nn/hw/ARM/codereset.h>
64 
65 }  // namespace ARMv6
66 }}  // nw::math
67 
68