Subversion Repositories Kolibri OS

Rev

Rev 1905 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1905 Rev 3960
1
/*
1
/*
2
	tabinit_mmx: make_decode_tables_mmx
2
	tabinit_mmx: make_decode_tables_mmx
3
 
3
 
4
	copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
4
	copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
5
	see COPYING and AUTHORS files in distribution or http://mpg123.org
5
	see COPYING and AUTHORS files in distribution or http://mpg123.org
6
	initially written by the mysterious higway (apparently)
6
	initially written by the mysterious higway (apparently)
7
*/
7
*/
8
 
8
 
9
#include "mangle.h"
9
#include "mangle.h"
10
 
10
 
11
.data
11
.data
12
	ALIGN32
12
	ALIGN32
13
.globl ASM_NAME(costab_mmxsse)
13
.globl ASM_NAME(costab_mmxsse)
14
ASM_NAME(costab_mmxsse):
14
ASM_NAME(costab_mmxsse):
15
	.long 1056974725
15
	.long 1056974725
16
	.long 1057056395
16
	.long 1057056395
17
	.long 1057223771
17
	.long 1057223771
18
	.long 1057485416
18
	.long 1057485416
19
	.long 1057855544
19
	.long 1057855544
20
	.long 1058356026
20
	.long 1058356026
21
	.long 1059019886
21
	.long 1059019886
22
	.long 1059897405
22
	.long 1059897405
23
	.long 1061067246
23
	.long 1061067246
24
	.long 1062657950
24
	.long 1062657950
25
	.long 1064892987
25
	.long 1064892987
26
	.long 1066774581
26
	.long 1066774581
27
	.long 1069414683
27
	.long 1069414683
28
	.long 1073984175
28
	.long 1073984175
29
	.long 1079645762
29
	.long 1079645762
30
	.long 1092815430
30
	.long 1092815430
31
	.long 1057005197
31
	.long 1057005197
32
	.long 1057342072
32
	.long 1057342072
33
	.long 1058087743
33
	.long 1058087743
34
	.long 1059427869
34
	.long 1059427869
35
	.long 1061799040
35
	.long 1061799040
36
	.long 1065862217
36
	.long 1065862217
37
	.long 1071413542
37
	.long 1071413542
38
	.long 1084439708
38
	.long 1084439708
39
	.long 1057128951
39
	.long 1057128951
40
	.long 1058664893
40
	.long 1058664893
41
	.long 1063675095
41
	.long 1063675095
42
	.long 1076102863
42
	.long 1076102863
43
	.long 1057655764
43
	.long 1057655764
44
	.long 1067924853
44
	.long 1067924853
45
	.long 1060439283
45
	.long 1060439283
46
	ALIGN32
46
	ALIGN32
47
intwinbase:
47
intwinbase:
48
	.value      0,    -1,    -1,    -1,    -1,    -1,    -1,    -2
48
	.short      0,    -1,    -1,    -1,    -1,    -1,    -1,    -2
49
	.value     -2,    -2,    -2,    -3,    -3,    -4,    -4,    -5
49
	.short     -2,    -2,    -2,    -3,    -3,    -4,    -4,    -5
50
	.value     -5,    -6,    -7,    -7,    -8,    -9,   -10,   -11
50
	.short     -5,    -6,    -7,    -7,    -8,    -9,   -10,   -11
51
	.value    -13,   -14,   -16,   -17,   -19,   -21,   -24,   -26
51
	.short    -13,   -14,   -16,   -17,   -19,   -21,   -24,   -26
52
	.value    -29,   -31,   -35,   -38,   -41,   -45,   -49,   -53
52
	.short    -29,   -31,   -35,   -38,   -41,   -45,   -49,   -53
53
	.value    -58,   -63,   -68,   -73,   -79,   -85,   -91,   -97
53
	.short    -58,   -63,   -68,   -73,   -79,   -85,   -91,   -97
54
	.value   -104,  -111,  -117,  -125,  -132,  -139,  -147,  -154
54
	.short   -104,  -111,  -117,  -125,  -132,  -139,  -147,  -154
55
	.value   -161,  -169,  -176,  -183,  -190,  -196,  -202,  -208
55
	.short   -161,  -169,  -176,  -183,  -190,  -196,  -202,  -208
56
	.value   -213,  -218,  -222,  -225,  -227,  -228,  -228,  -227
56
	.short   -213,  -218,  -222,  -225,  -227,  -228,  -228,  -227
57
	.value   -224,  -221,  -215,  -208,  -200,  -189,  -177,  -163
57
	.short   -224,  -221,  -215,  -208,  -200,  -189,  -177,  -163
58
	.value   -146,  -127,  -106,   -83,   -57,   -29,     2,    36
58
	.short   -146,  -127,  -106,   -83,   -57,   -29,     2,    36
59
	.value     72,   111,   153,   197,   244,   294,   347,   401
59
	.short     72,   111,   153,   197,   244,   294,   347,   401
60
	.value    459,   519,   581,   645,   711,   779,   848,   919
60
	.short    459,   519,   581,   645,   711,   779,   848,   919
61
	.value    991,  1064,  1137,  1210,  1283,  1356,  1428,  1498
61
	.short    991,  1064,  1137,  1210,  1283,  1356,  1428,  1498
62
	.value   1567,  1634,  1698,  1759,  1817,  1870,  1919,  1962
62
	.short   1567,  1634,  1698,  1759,  1817,  1870,  1919,  1962
63
	.value   2001,  2032,  2057,  2075,  2085,  2087,  2080,  2063
63
	.short   2001,  2032,  2057,  2075,  2085,  2087,  2080,  2063
64
	.value   2037,  2000,  1952,  1893,  1822,  1739,  1644,  1535
64
	.short   2037,  2000,  1952,  1893,  1822,  1739,  1644,  1535
65
	.value   1414,  1280,  1131,   970,   794,   605,   402,   185
65
	.short   1414,  1280,  1131,   970,   794,   605,   402,   185
66
	.value    -45,  -288,  -545,  -814, -1095, -1388, -1692, -2006
66
	.short    -45,  -288,  -545,  -814, -1095, -1388, -1692, -2006
67
	.value  -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788
67
	.short  -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788
68
	.value  -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597
68
	.short  -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597
69
	.value  -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585
69
	.short  -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585
70
	.value  -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750
70
	.short  -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750
71
	.value  -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134
71
	.short  -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134
72
	.value  -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082
72
	.short  -6574, -5959, -5288, -4561, -3776, -2935, -2037, -1082
73
	.value    -70,   998,  2122,  3300,  4533,  5818,  7154,  8540
73
	.short    -70,   998,  2122,  3300,  4533,  5818,  7154,  8540
74
	.value   9975, 11455, 12980, 14548, 16155, 17799, 19478, 21189
74
	.short   9975, 11455, 12980, 14548, 16155, 17799, 19478, 21189
75
	.value  22929, 24694, 26482, 28289, 30112, 31947,-26209,-24360
75
	.short  22929, 24694, 26482, 28289, 30112, 31947,-26209,-24360
76
	.value -22511,-20664,-18824,-16994,-15179,-13383,-11610, -9863
76
	.short -22511,-20664,-18824,-16994,-15179,-13383,-11610, -9863
77
	.value  -8147, -6466, -4822, -3222, -1667,  -162,  1289,  2684
77
	.short  -8147, -6466, -4822, -3222, -1667,  -162,  1289,  2684
78
	.value   4019,  5290,  6494,  7629,  8692,  9679, 10590, 11420
78
	.short   4019,  5290,  6494,  7629,  8692,  9679, 10590, 11420
79
	.value  12169, 12835, 13415, 13908, 14313, 14630, 14856, 14992
79
	.short  12169, 12835, 13415, 13908, 14313, 14630, 14856, 14992
80
	.value  15038
80
	.short  15038
81
 
81
 
82
intwindiv:
82
intwindiv:
83
	.long 0x47800000			# 65536.0
83
	.long 0x47800000			# 65536.0
84
.text
84
.text
85
	ALIGN32
85
	ALIGN32
86
/* void make_decode_tables_mmx_asm(long scaleval, float* decwin_mmx, float *decwins); */
86
/* void make_decode_tables_mmx_asm(long scaleval, float* decwin_mmx, float *decwins); */
87
.globl ASM_NAME(make_decode_tables_mmx_asm)
87
.globl ASM_NAME(make_decode_tables_mmx_asm)
88
ASM_NAME(make_decode_tables_mmx_asm):
88
ASM_NAME(make_decode_tables_mmx_asm):
89
	pushl %edi
89
	pushl %edi
90
	pushl %esi
90
	pushl %esi
91
	pushl %ebx
91
	pushl %ebx
92
/* stack: 0=ebx, 4=esi, 8=edi, 12=back, 16=scaleval, 20=decwin_mmx, 24=decwins */
92
/* stack: 0=ebx, 4=esi, 8=edi, 12=back, 16=scaleval, 20=decwin_mmx, 24=decwins */
93
 
93
 
94
	xorl %ecx,%ecx
94
	xorl %ecx,%ecx
95
	xorl %ebx,%ebx
95
	xorl %ebx,%ebx
96
	movl $32,%esi
96
	movl $32,%esi
97
	movl $intwinbase,%edi
97
	movl $intwinbase,%edi
98
	negl 16(%esp)	/* scaleval */
98
	negl 16(%esp)	/* scaleval */
99
	pushl $2	/* intwinbase step */
99
	pushl $2	/* intwinbase step */
100
/* stack: 20=scaleval 24=decwin_mmx, 28=decwins */
100
/* stack: 20=scaleval 24=decwin_mmx, 28=decwins */
101
.L00:
101
.L00:
102
	cmpl $528,%ecx
102
	cmpl $528,%ecx
103
	jnc .L02
103
	jnc .L02
104
	movswl (%edi),%eax
104
	movswl (%edi),%eax
105
	cmpl $intwinbase+444,%edi
105
	cmpl $intwinbase+444,%edi
106
	jc .L01
106
	jc .L01
107
	addl $60000,%eax
107
	addl $60000,%eax
108
.L01:
108
.L01:
109
	pushl %eax
109
	pushl %eax
110
/* stack: 24=scaleval 28=decwin_mmx, 32=decwins */
110
/* stack: 24=scaleval 28=decwin_mmx, 32=decwins */
111
	fildl (%esp)
111
	fildl (%esp)
112
	fdivs intwindiv
112
	fdivs intwindiv
113
	fimull 24(%esp) /* scaleval */
113
	fimull 24(%esp) /* scaleval */
114
/* eax used to be popped the line before... I'll just use it here a bit */
114
/* eax used to be popped the line before... I'll just use it here a bit */
115
	movl 28(%esp),%eax /* decwin_mmx */
115
	movl 28(%esp),%eax /* decwin_mmx */
116
	fsts    (%eax,%ecx,4)
116
	fsts    (%eax,%ecx,4)
117
	fstps 64(%eax,%ecx,4)
117
	fstps 64(%eax,%ecx,4)
118
	popl %eax
118
	popl %eax
119
/* stack: 20=scaleval 24=decwin_mmx, 28=decwins */
119
/* stack: 20=scaleval 24=decwin_mmx, 28=decwins */
120
.L02:
120
.L02:
121
	leal -1(%esi),%edx
121
	leal -1(%esi),%edx
122
	and %ebx,%edx
122
	andl %ebx,%edx
123
	cmp $31,%edx
123
	cmpl $31,%edx
124
	jnz .L03
124
	jnz .L03
125
	addl $-1023,%ecx
125
	addl $-1023,%ecx
126
	test %esi,%ebx
126
	testl %esi,%ebx
127
	jz  .L03
127
	jz  .L03
128
	negl 20(%esp)
128
	negl 20(%esp)
129
.L03:
129
.L03:
130
	addl %esi,%ecx
130
	addl %esi,%ecx
131
	addl (%esp),%edi
131
	addl (%esp),%edi
132
	incl %ebx
132
	incl %ebx
133
	cmpl $intwinbase,%edi
133
	cmpl $intwinbase,%edi
134
	jz .L04
134
	jz .L04
135
	cmp $256,%ebx
135
	cmpl $256,%ebx
136
	jnz .L00
136
	jnz .L00
137
	negl (%esp)
137
	negl (%esp)
138
	jmp .L00
138
	jmp .L00
139
.L04:
139
.L04:
140
	popl %eax
140
	popl %eax
141
 
141
 
142
	xorl %ecx,%ecx
142
	xorl %ecx,%ecx
143
	xorl %ebx,%ebx
143
	xorl %ebx,%ebx
144
	pushl $2 /* paired with popl above */
144
	pushl $2 /* paired with popl above */
145
.L05:
145
.L05:
146
	cmpl $528,%ecx
146
	cmpl $528,%ecx
147
	jnc .L11
147
	jnc .L11
148
	movswl (%edi),%eax
148
	movswl (%edi),%eax
149
	cmpl $intwinbase+444,%edi
149
	cmpl $intwinbase+444,%edi
150
	jc .L06
150
	jc .L06
151
	addl $60000,%eax
151
	addl $60000,%eax
152
.L06:
152
.L06:
153
	cltd
153
	cltd
154
	imull 20(%esp)
154
	imull 20(%esp)
155
	shrdl $17,%edx,%eax
155
	shrdl $17,%edx,%eax
156
	cmpl $32767,%eax
156
	cmpl $32767,%eax
157
	movl $1055,%edx
157
	movl $1055,%edx
158
	jle .L07
158
	jle .L07
159
	movl $32767,%eax
159
	movl $32767,%eax
160
	jmp .L08
160
	jmp .L08
161
.L07:
161
.L07:
162
	cmpl $-32767,%eax
162
	cmpl $-32767,%eax
163
	jge .L08
163
	jge .L08
164
	movl $-32767,%eax
164
	movl $-32767,%eax
165
.L08:
165
.L08:
166
/* going to use ebx for decwins, watch the jumps */
166
/* going to use ebx for decwins, watch the jumps */
167
	pushl %ebx 
167
	pushl %ebx 
168
/* stack: 24=scaleval 28=decwin_mmx, 32=decwins */
168
/* stack: 24=scaleval 28=decwin_mmx, 32=decwins */
169
	movl 32(%esp),%ebx
169
	movl 32(%esp),%ebx
170
	cmpl $512,%ecx
170
	cmpl $512,%ecx
171
	jnc .L09
171
	jnc .L09
172
	subl %ecx,%edx
172
	subl %ecx,%edx
173
	movw %ax,(%ebx,%edx,2) /* decwins */
173
	movw %ax,(%ebx,%edx,2) /* decwins */
174
	movw %ax,-32(%ebx,%edx,2)
174
	movw %ax,-32(%ebx,%edx,2)
175
.L09:
175
.L09:
176
	testl $1,%ecx
176
	testl $1,%ecx
177
	jnz .L10
177
	jnz .L10
178
	negl %eax
178
	negl %eax
179
.L10:
179
.L10:
180
	movw %ax,(%ebx,%ecx,2)
180
	movw %ax,(%ebx,%ecx,2)
181
	movw %ax,32(%ebx,%ecx,2)
181
	movw %ax,32(%ebx,%ecx,2)
182
	popl %ebx /* that has to match the pushl before */
182
	popl %ebx /* that has to match the pushl before */
183
.L11:
183
.L11:
184
	leal -1(%esi),%edx
184
	leal -1(%esi),%edx
185
	and %ebx,%edx
185
	andl %ebx,%edx
186
	cmp $31,%edx
186
	cmpl $31,%edx
187
	jnz .L12
187
	jnz .L12
188
	addl $-1023,%ecx
188
	addl $-1023,%ecx
189
	test %esi,%ebx
189
	testl %esi,%ebx
190
	jz  .L12
190
	jz  .L12
191
	negl 20(%esp)
191
	negl 20(%esp)
192
.L12:
192
.L12:
193
	addl %esi,%ecx
193
	addl %esi,%ecx
194
	addl (%esp),%edi
194
	addl (%esp),%edi
195
	incl %ebx
195
	incl %ebx
196
	cmpl $intwinbase,%edi
196
	cmpl $intwinbase,%edi
197
	jz .L13
197
	jz .L13
198
	cmp $256,%ebx
198
	cmpl $256,%ebx
199
	jnz .L05
199
	jnz .L05
200
	negl (%esp)
200
	negl (%esp)
201
	jmp .L05
201
	jmp .L05
202
.L13:
202
.L13:
203
	popl %eax
203
	popl %eax
204
	
204
	
205
	popl %ebx
205
	popl %ebx
206
	popl %esi
206
	popl %esi
207
	popl %edi
207
	popl %edi
208
	ret
208
	ret
209
 
-
 
210
/* Mark non-executable stack. */
-
 
211
#if defined(__linux__) && defined(__ELF__)
-
 
212
.section .note.GNU-stack,"",%progbits
209
 
213
#endif
210
NONEXEC_STACK