summaryrefslogtreecommitdiff
path: root/apps/codecs/demac/libdemac/udiv32_arm.S
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/demac/libdemac/udiv32_arm.S')
-rw-r--r--apps/codecs/demac/libdemac/udiv32_arm.S42
1 files changed, 29 insertions, 13 deletions
diff --git a/apps/codecs/demac/libdemac/udiv32_arm.S b/apps/codecs/demac/libdemac/udiv32_arm.S
index 4492492d30..939fce17d4 100644
--- a/apps/codecs/demac/libdemac/udiv32_arm.S
+++ b/apps/codecs/demac/libdemac/udiv32_arm.S
@@ -29,6 +29,13 @@
29 ****************************************************************************/ 29 ****************************************************************************/
30 30
31#include "config.h" 31#include "config.h"
32/* On targets with codec iram, a header file will be generated after an initial
33 link of the APE codec, stating the amount of IRAM remaining for use by the
34 reciprocal lookup table. */
35#if !defined(APE_PRE) && defined(USE_IRAM) && ARM_ARCH < 5
36#include "apps/codecs/ape_free_iram.h"
37#endif
38
32/* Codecs should not normally do this, but we need to check a macro, and 39/* Codecs should not normally do this, but we need to check a macro, and
33 * codecs.h would confuse the assembler. */ 40 * codecs.h would confuse the assembler. */
34 41
@@ -88,20 +95,29 @@
88 eor \quotient, \result, \remainder, lsl \bits 95 eor \quotient, \result, \remainder, lsl \bits
89.endm 96.endm
90 97
91#ifdef CPU_PP 98#ifndef FREE_IRAM
92#if CONFIG_CPU == PP5020 99.set recip_max, 2
93.set recip_max, 8384
94#elif CONFIG_CPU == PP5002
95.set recip_max, 4608
96#else 100#else
97.set recip_max, 16384 101/* Each table entry is one word. Since a compare is done against the maximum
98#endif 102 entry as an immediate, the maximum entry must be a valid ARM immediate,
99#elif CONFIG_CPU == AS3525 103 which means a byte shifted by an even number of places. */
100.set recip_max, 42752 104.set recip_max, 2 + FREE_IRAM / 4
101#elif CONFIG_CPU == S5L8701 105.set recip_max_tmp, recip_max >> 8
102.set recip_max, 12800 106.set recip_mask_shift, 0
103#elif CONFIG_CPU == S5L8700 107.set tmp_shift, 16
104.set recip_max, 9088 108.rept 5
109 .if recip_max_tmp >> tmp_shift
110 .set recip_max_tmp, recip_max_tmp >> tmp_shift
111 .set recip_mask_shift, recip_mask_shift + tmp_shift
112 .endif
113 .set tmp_shift, tmp_shift >> 1
114.endr
115.if recip_max_tmp
116 .set recip_mask_shift, recip_mask_shift + 1
117.endif
118.set recip_mask_shift, (recip_mask_shift + 1) & 62
119.set recip_max, recip_max & (255 << recip_mask_shift)
120//.set recip_max, 2
105#endif 121#endif
106 122
107udiv32_arm: 123udiv32_arm: