annotate tremor/asm_arm.h @ 20052:33c40d61bf33

Detect sse/2 on intel mac, Valtteri Vuorikoski(vuori@sci.fi)
author nplourde
date Thu, 05 Oct 2006 00:12:04 +0000
parents 8631a3803289
children e83eef58b30a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14280
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
1 /********************************************************************
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
2 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
4 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
8 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
11 * *
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
12 ********************************************************************
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
13
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
14 function: arm7 and later wide math functions
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
15
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
16 ********************************************************************/
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
17
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
18 #ifdef _ARM_ASSEM_
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
19
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
20 #if !defined(_V_WIDE_MATH) && !defined(_LOW_ACCURACY_)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
21 #define _V_WIDE_MATH
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
22
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
23 static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
24 int lo,hi;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
25 asm volatile("smull\t%0, %1, %2, %3"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
26 : "=&r"(lo),"=&r"(hi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
27 : "%r"(x),"r"(y)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
28 : "cc");
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
29 return(hi);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
30 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
31
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
32 static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
33 return MULT32(x,y)<<1;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
34 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
35
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
36 static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
37 int lo,hi;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
38 asm volatile("smull %0, %1, %2, %3\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
39 "movs %0, %0, lsr #15\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
40 "adc %1, %0, %1, lsl #17\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
41 : "=&r"(lo),"=&r"(hi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
42 : "%r"(x),"r"(y)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
43 : "cc");
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
44 return(hi);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
45 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
46
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
47 #define MB() asm volatile ("" : : : "memory")
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
48
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
49 static inline void XPROD32(ogg_int32_t a, ogg_int32_t b,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
50 ogg_int32_t t, ogg_int32_t v,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
51 ogg_int32_t *x, ogg_int32_t *y)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
52 {
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
53 int x1, y1, l;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
54 asm( "smull %0, %1, %4, %6\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
55 "smlal %0, %1, %5, %7\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
56 "rsb %3, %4, #0\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
57 "smull %0, %2, %5, %6\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
58 "smlal %0, %2, %3, %7"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
59 : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
60 : "3" (a), "r" (b), "r" (t), "r" (v)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
61 : "cc" );
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
62 *x = x1;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
63 MB();
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
64 *y = y1;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
65 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
66
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
67 static inline void XPROD31(ogg_int32_t a, ogg_int32_t b,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
68 ogg_int32_t t, ogg_int32_t v,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
69 ogg_int32_t *x, ogg_int32_t *y)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
70 {
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
71 int x1, y1, l;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
72 asm( "smull %0, %1, %4, %6\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
73 "smlal %0, %1, %5, %7\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
74 "rsb %3, %4, #0\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
75 "smull %0, %2, %5, %6\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
76 "smlal %0, %2, %3, %7"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
77 : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
78 : "3" (a), "r" (b), "r" (t), "r" (v)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
79 : "cc" );
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
80 *x = x1 << 1;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
81 MB();
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
82 *y = y1 << 1;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
83 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
84
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
85 static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
86 ogg_int32_t t, ogg_int32_t v,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
87 ogg_int32_t *x, ogg_int32_t *y)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
88 {
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
89 int x1, y1, l;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
90 asm( "rsb %2, %4, #0\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
91 "smull %0, %1, %3, %5\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
92 "smlal %0, %1, %2, %6\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
93 "smull %0, %2, %4, %5\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
94 "smlal %0, %2, %3, %6"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
95 : "=&r" (l), "=&r" (x1), "=&r" (y1)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
96 : "r" (a), "r" (b), "r" (t), "r" (v)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
97 : "cc" );
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
98 *x = x1 << 1;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
99 MB();
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
100 *y = y1 << 1;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
101 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
102
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
103 #endif
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
104
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
105 #ifndef _V_CLIP_MATH
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
106 #define _V_CLIP_MATH
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
107
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
108 static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
109 int tmp;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
110 asm volatile("subs %1, %0, #32768\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
111 "movpl %0, #0x7f00\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
112 "orrpl %0, %0, #0xff\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
113 "adds %1, %0, #32768\n\t"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
114 "movmi %0, #0x8000"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
115 : "+r"(x),"=r"(tmp)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
116 :
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
117 : "cc");
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
118 return(x);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
119 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
120
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
121 #endif
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
122
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
123 #ifndef _V_LSP_MATH_ASM
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
124 #define _V_LSP_MATH_ASM
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
125
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
126 static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
127 ogg_int32_t *qexpp,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
128 ogg_int32_t *ilsp,ogg_int32_t wi,
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
129 ogg_int32_t m){
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
130
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
131 ogg_uint32_t qi=*qip,pi=*pip;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
132 ogg_int32_t qexp=*qexpp;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
133
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
134 asm("mov r0,%3;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
135 "mov r1,%5,asr#1;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
136 "add r0,r0,r1,lsl#3;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
137 "1:"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
138
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
139 "ldmdb r0!,{r1,r3};"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
140 "subs r1,r1,%4;" //ilsp[j]-wi
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
141 "rsbmi r1,r1,#0;" //labs(ilsp[j]-wi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
142 "umull %0,r2,r1,%0;" //qi*=labs(ilsp[j]-wi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
143
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
144 "subs r1,r3,%4;" //ilsp[j+1]-wi
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
145 "rsbmi r1,r1,#0;" //labs(ilsp[j+1]-wi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
146 "umull %1,r3,r1,%1;" //pi*=labs(ilsp[j+1]-wi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
147
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
148 "cmn r2,r3;" // shift down 16?
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
149 "beq 0f;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
150 "add %2,%2,#16;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
151 "mov %0,%0,lsr #16;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
152 "orr %0,%0,r2,lsl #16;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
153 "mov %1,%1,lsr #16;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
154 "orr %1,%1,r3,lsl #16;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
155 "0:"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
156 "cmp r0,%3;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
157 "bhi 1b;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
158
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
159 // odd filter assymetry
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
160 "ands r0,%5,#1;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
161 "beq 2f;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
162 "add r0,%3,%5,lsl#2;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
163
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
164 "ldr r1,[r0,#-4];\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
165 "mov r0,#0x4000;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
166
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
167 "subs r1,r1,%4;\n" //ilsp[j]-wi
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
168 "rsbmi r1,r1,#0;\n" //labs(ilsp[j]-wi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
169 "umull %0,r2,r1,%0;\n" //qi*=labs(ilsp[j]-wi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
170 "umull %1,r3,r0,%1;\n" //pi*=labs(ilsp[j+1]-wi)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
171
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
172 "cmn r2,r3;\n" // shift down 16?
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
173 "beq 2f;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
174 "add %2,%2,#16;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
175 "mov %0,%0,lsr #16;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
176 "orr %0,%0,r2,lsl #16;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
177 "mov %1,%1,lsr #16;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
178 "orr %1,%1,r3,lsl #16;\n"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
179
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
180 //qi=(pi>>shift)*labs(ilsp[j]-wi);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
181 //pi=(qi>>shift)*labs(ilsp[j+1]-wi);
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
182 //qexp+=shift;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
183
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
184 //}
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
185
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
186 /* normalize to max 16 sig figs */
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
187 "2:"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
188 "mov r2,#0;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
189 "orr r1,%0,%1;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
190 "tst r1,#0xff000000;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
191 "addne r2,r2,#8;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
192 "movne r1,r1,lsr #8;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
193 "tst r1,#0x00f00000;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
194 "addne r2,r2,#4;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
195 "movne r1,r1,lsr #4;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
196 "tst r1,#0x000c0000;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
197 "addne r2,r2,#2;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
198 "movne r1,r1,lsr #2;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
199 "tst r1,#0x00020000;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
200 "addne r2,r2,#1;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
201 "movne r1,r1,lsr #1;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
202 "tst r1,#0x00010000;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
203 "addne r2,r2,#1;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
204 "mov %0,%0,lsr r2;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
205 "mov %1,%1,lsr r2;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
206 "add %2,%2,r2;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
207
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
208 : "+r"(qi),"+r"(pi),"+r"(qexp)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
209 : "r"(ilsp),"r"(wi),"r"(m)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
210 : "r0","r1","r2","r3","cc");
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
211
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
212 *qip=qi;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
213 *pip=pi;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
214 *qexpp=qexp;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
215 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
216
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
217 static inline void lsp_norm_asm(ogg_uint32_t *qip,ogg_int32_t *qexpp){
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
218
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
219 ogg_uint32_t qi=*qip;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
220 ogg_int32_t qexp=*qexpp;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
221
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
222 asm("tst %0,#0x0000ff00;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
223 "moveq %0,%0,lsl #8;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
224 "subeq %1,%1,#8;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
225 "tst %0,#0x0000f000;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
226 "moveq %0,%0,lsl #4;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
227 "subeq %1,%1,#4;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
228 "tst %0,#0x0000c000;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
229 "moveq %0,%0,lsl #2;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
230 "subeq %1,%1,#2;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
231 "tst %0,#0x00008000;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
232 "moveq %0,%0,lsl #1;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
233 "subeq %1,%1,#1;"
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
234 : "+r"(qi),"+r"(qexp)
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
235 :
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
236 : "cc");
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
237 *qip=qi;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
238 *qexpp=qexp;
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
239 }
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
240
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
241 #endif
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
242 #endif
8631a3803289 internal Tremor decoder for Ogg/Vorbis
henry
parents:
diff changeset
243