summaryrefslogtreecommitdiff
path: root/Runtime/Math/Matrix4x4_VFP.s
blob: 1745cc33285a7225d663f25cd3b6ac4adf564447 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#define UNITY_ASSEMBLER
#include "Configuration/PrefixConfigure.h"
#include "Runtime/Utilities/VFPUtility.h"

#if UNITY_SUPPORTS_VFP

.syntax unified

.set device,0
.set device,__arm__
 
.if device

//.code32

.globl _MultiplyMatrices4x4_VFP
.globl _MultiplyMatrixArray4x4_VFP

#if UNITY_ANDROID

.hidden _MultiplyMatrices4x4_VFP
.hidden _MultiplyMatrixArray4x4_VFP

#endif


//===========================================================================================================================================


// void MultiplyMatrices4x4_VFP(const Matrix4x4f* __restrict lhs, const Matrix4x4f* __restrict rhs, Matrix4x4f* __restrict res)
_MultiplyMatrices4x4_VFP:
// r0: A
// r1: B
// r2: dst

vpush		{d8-d15}

mov			ip, r0

// VFP_VECTOR_LENGTH(3)

mov			r0, ip

vldmia.32	r0,  {s8-s23}
vldmia.32	r1!, {s0-s7}

FMULS4		(24,25,26,27,	8,9,10,11,		0,0,0,0)
FMULS4		(28,29,30,31,	8,9,10,11,		4,4,4,4)

FMACS4		(24,25,26,27,	12,13,14,15,	1,1,1,1)
FMACS4		(28,29,30,31,	12,13,14,15,	5,5,5,5)

FMACS4		(24,25,26,27,	16,17,18,19,	2,2,2,2)
FMACS4		(28,29,30,31,	16,17,18,19,	6,6,6,6)

FMACS4		(24,25,26,27,	20,21,22,23,	3,3,3,3)
FMACS4		(28,29,30,31,	20,21,22,23,	7,7,7,7)


vstmia.32	r2!, {s24-s31}
vldmia.32	r1,  {s0-s7}
                
FMULS4		(24,25,26,27,	8,9,10,11,		0,0,0,0)
FMULS4		(28,29,30,31,	8,9,10,11,		4,4,4,4)

FMACS4		(24,25,26,27,	12,13,14,15,	1,1,1,1)
FMACS4		(28,29,30,31,	12,13,14,15,	5,5,5,5)

FMACS4		(24,25,26,27,	16,17,18,19,	2,2,2,2)
FMACS4		(28,29,30,31,	16,17,18,19,	6,6,6,6)

FMACS4		(24,25,26,27,	20,21,22,23,	3,3,3,3)
FMACS4		(28,29,30,31,	20,21,22,23,	7,7,7,7)

vstmia.32	r2,  {s24-s31}

// VFP_VECTOR_LENGTH_ZERO

vpop		{d8-d15}
bx			lr


//===========================================================================================================================================

// void MultiplyMatrixArray4x4_VFP(const Matrix4x4f* arrayA, const Matrix4x4f* arrayB, Matrix4x4f* arrayRes, size_t count)
_MultiplyMatrixArray4x4_VFP:
// r0: A
// r1: B
// r2: dst
// r3: A end

vpush		{d8-d15}

mov			ip, r0

// VFP_VECTOR_LENGTH(3)

mov			r0, ip
add			r3, r0, r3, lsl #6

	 
.align 4
_MultiplyMatrixArray4x4_VFP_loop:
	 
vldmia.32	r0!, {s16-s31}
vldmia.32	r1!, {s0-s7}

FMULS4		(8,9,10,11,		16,17,18,19,	0,0,0,0)
FMULS4		(12,13,14,15,	16,17,18,19,	4,4,4,4)

FMACS4		(8,9,10,11,		20,21,22,23,	1,1,1,1)
FMACS4		(12,13,14,15,	20,21,22,23,	5,5,5,5)

FMACS4		(8,9,10,11,		24,25,26,27,	2,2,2,2)
FMACS4		(12,13,14,15,	24,25,26,27,	6,6,6,6)

FMACS4		(8,9,10,11,		28,29,30,31,	3,3,3,3)
FMACS4		(12,13,14,15,	28,29,30,31,	7,7,7,7)


vldmia.32	r1!, {s0-s7}
vstmia.32	r2!, {s8-s15}
	 
FMULS4		(8,9,10,11,		16,17,18,19,	0,0,0,0)
FMULS4		(12,13,14,15,	16,17,18,19,	4,4,4,4)

FMACS4		(8,9,10,11,		20,21,22,23,	1,1,1,1)
FMACS4		(12,13,14,15,	20,21,22,23,	5,5,5,5)

FMACS4		(8,9,10,11,		24,25,26,27,	2,2,2,2)
FMACS4		(12,13,14,15,	24,25,26,27,	6,6,6,6)

FMACS4		(8,9,10,11,		28,29,30,31,	3,3,3,3)
FMACS4		(12,13,14,15,	28,29,30,31,	7,7,7,7)

vstmia.32	r2!, {s8-s15}

cmp			r0, r3
bcc			_MultiplyMatrixArray4x4_VFP_loop
	 
// VFP_VECTOR_LENGTH_ZERO

vpop		{d8-d15}
bx			lr


.endif

#endif