1 /*---------------------------------------------------------------------------*
2 Project: Horizon
3 File: math_Triangular.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/ARMv6/math_Triangular.h>
20
21 namespace nn { namespace math {
22
23 namespace ARMv6 {
24 #include <nn/hw/ARM/code32.h>
25
26 NN_FUNC_ATTR_PRIVATE_SECTION
SinCosIdxAsm(f32 *,f32 *,u16)27 asm void SinCosIdxAsm(f32* /* s */, f32* /* c */, u16 /* idx */)
28 {
29 IMPORT __cpp(nn::math::internal::gSinCosTbl)[DATA]
30 AND r3,r2,#0xff
31 VMOV s4,r3
32 LSR r3,r2,#8
33 LDR r2,=__cpp(nn::math::internal::gSinCosTbl)
34 VCVT.F32.U32 s4,s4
35 ADD r2,r2,r3,LSL #4
36 VLDR s5,%F0
37 VMUL.F32 s6,s4,s5
38 VLDM r2,{s0-s3}
39 VMLA.F32 s0,s2,s6
40 VMLA.F32 s1,s3,s6
41 VSTR s0,[r0,#0]
42 VSTR s1,[r1,#0]
43 BX lr
44 0
45 DCD 0x3b800000 // 1.0f / 256.0f
46 }
47
48 #include <nn/hw/ARM/codereset.h>
49 } // ARMv6
50 }} // nw::math
51