diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2010-01-02 15:15:21 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2010-01-02 15:15:21 +0000 |
commit | 934514558b685ebd82681a07b4e25c61207af0a7 (patch) | |
tree | febd72d301dabffbe6edfcb4ca0720cb7e5b3cfe | |
parent | 6e9af8bd4435fca55b91d6d794099121318972dc (diff) | |
download | rockbox-934514558b685ebd82681a07b4e25c61207af0a7.tar.gz rockbox-934514558b685ebd82681a07b4e25c61207af0a7.zip |
Remove special cases from udiv32_armv4.S, except for zero divisor and large numerator. Improvement of 1.23MHz on e200 with ape normal.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24142 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/lib/udiv32_armv4.S | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/apps/codecs/lib/udiv32_armv4.S b/apps/codecs/lib/udiv32_armv4.S index 6921c7fbd1..d7054e1ba4 100644 --- a/apps/codecs/lib/udiv32_armv4.S +++ b/apps/codecs/lib/udiv32_armv4.S | |||
@@ -104,20 +104,6 @@ | |||
104 | @subls \dividend, \dividend, \divisor @ correct remainder not needed | 104 | @subls \dividend, \dividend, \divisor @ correct remainder not needed |
105 | .endm | 105 | .endm |
106 | 106 | ||
107 | .macro ARM_DIV2_ORDER divisor, order | ||
108 | |||
109 | @ There's exactly one bit set in the divisor, so ffs() can be used | ||
110 | @ This is the ffs algorithm devised by D.Seal and posted to | ||
111 | @ comp.sys.arm on 16 Feb 1994. | ||
112 | adr \order, L_ffs_table | ||
113 | orr \divisor, \divisor, \divisor, lsl #4 @ = X * 0x11 | ||
114 | orr \divisor, \divisor, \divisor, lsl #6 @ = X * 0x451 | ||
115 | rsb \divisor, \divisor, \divisor, lsl #16 @ = X * 0x0450fbaf | ||
116 | |||
117 | ldrb \order, [\order, \divisor, lsr #26] | ||
118 | .endm | ||
119 | |||
120 | |||
121 | #ifdef USE_IRAM | 107 | #ifdef USE_IRAM |
122 | .section .icode,"ax",%progbits | 108 | .section .icode,"ax",%progbits |
123 | #else | 109 | #else |
@@ -128,45 +114,21 @@ | |||
128 | .type udiv32_arm,%function | 114 | .type udiv32_arm,%function |
129 | 115 | ||
130 | udiv32_arm: | 116 | udiv32_arm: |
131 | subs r2, r1, #1 | 117 | cmp r1, #0 |
132 | bxeq lr | 118 | beq 20f |
133 | bcc 20f | ||
134 | cmp r0, r1 | ||
135 | bls 10f | ||
136 | tst r1, r2 | ||
137 | beq 30f | ||
138 | tst r0, r0 | 119 | tst r0, r0 |
139 | /* High bit must be unset, otherwise use ARM_DIV_32_BODY. High bit of | 120 | /* High bit must be unset, otherwise use ARM_DIV_32_BODY. High bit of |
140 | divisor is also unset dividend has been tested to be >= divisor. | 121 | divisor is also unset dividend has been tested to be >= divisor. |
141 | */ | 122 | */ |
142 | bmi 5f | 123 | bmi 10f |
143 | ARM_DIV_31_BODY r0, r1, r2, r3, ip, r0 | 124 | ARM_DIV_31_BODY r0, r1, r2, r3, ip, r0 |
144 | bx lr | 125 | bx lr |
145 | 126 | ||
146 | 5: | 127 | 10: |
147 | ARM_DIV_32_BODY r0, r1, r2, r3 | 128 | ARM_DIV_32_BODY r0, r1, r2, r3 |
148 | mov r0, r2 | 129 | mov r0, r2 |
149 | bx lr | 130 | bx lr |
150 | 131 | ||
151 | 10: | ||
152 | moveq r0, #1 | ||
153 | 20: | 132 | 20: |
154 | movne r0, #0 | 133 | movne r0, #0 |
155 | bx lr | 134 | bx lr \ No newline at end of file |
156 | |||
157 | 30: | ||
158 | ARM_DIV2_ORDER r1, r2 | ||
159 | mov r0, r0, lsr r2 | ||
160 | bx lr | ||
161 | |||
162 | L_ffs_table: | ||
163 | @ 0 1 2 3 4 5 6 7 | ||
164 | @---------------------------------------------- | ||
165 | .byte 32, 0, 1, 12, 2, 6, 0, 13 @ 0- 7 | ||
166 | .byte 3, 0, 7, 0, 0, 0, 0, 14 @ 8-15 | ||
167 | .byte 10, 4, 0, 0, 8, 0, 0, 25 @ 16-23 | ||
168 | .byte 0, 0, 0, 0, 0, 21, 27, 15 @ 24-31 | ||
169 | .byte 31, 11, 5, 0, 0, 0, 0, 0 @ 32-39 | ||
170 | .byte 9, 0, 0, 24, 0, 0, 20, 26 @ 40-47 | ||
171 | .byte 30, 0, 0, 0, 0, 23, 0, 19 @ 48-55 | ||
172 | .byte 29, 0, 22, 18, 28, 17, 16, 0 @ 56-63 | ||