OLD | NEW |
1 @ | 1 @ |
2 @ Written by Wilco Dijkstra, 1996. The following email exchange establishes the | 2 @ Written by Wilco Dijkstra, 1996. The following email exchange establishes the |
3 @ license. | 3 @ license. |
4 @ | 4 @ |
5 @ From: Wilco Dijkstra <Wilco.Dijkstra@ntlworld.com> | 5 @ From: Wilco Dijkstra <Wilco.Dijkstra@ntlworld.com> |
6 @ Date: Fri, Jun 24, 2011 at 3:20 AM | 6 @ Date: Fri, Jun 24, 2011 at 3:20 AM |
7 @ Subject: Re: sqrt routine | 7 @ Subject: Re: sqrt routine |
8 @ To: Kevin Ma <kma@google.com> | 8 @ To: Kevin Ma <kma@google.com> |
9 @ Hi Kevin, | 9 @ Hi Kevin, |
10 @ Thanks for asking. Those routines are public domain (originally posted to | 10 @ Thanks for asking. Those routines are public domain (originally posted to |
(...skipping 14 matching lines...) Expand all Loading... |
25 @ Thanks. | 25 @ Thanks. |
26 @ Kevin | 26 @ Kevin |
27 | 27 |
28 @ Minor modifications in code style for WebRTC, 2012. | 28 @ Minor modifications in code style for WebRTC, 2012. |
29 @ Output is bit-exact with the reference C code in spl_sqrt_floor.c. | 29 @ Output is bit-exact with the reference C code in spl_sqrt_floor.c. |
30 | 30 |
31 @ Input : r0 32 bit unsigned integer | 31 @ Input : r0 32 bit unsigned integer |
32 @ Output: r0 = INT (SQRT (r0)), precision is 16 bits | 32 @ Output: r0 = INT (SQRT (r0)), precision is 16 bits |
33 @ Registers touched: r1, r2 | 33 @ Registers touched: r1, r2 |
34 | 34 |
35 #include "webrtc/system_wrappers/interface/asm_defines.h" | 35 #include "webrtc/system_wrappers/include/asm_defines.h" |
36 | 36 |
37 GLOBAL_FUNCTION WebRtcSpl_SqrtFloor | 37 GLOBAL_FUNCTION WebRtcSpl_SqrtFloor |
38 .align 2 | 38 .align 2 |
39 DEFINE_FUNCTION WebRtcSpl_SqrtFloor | 39 DEFINE_FUNCTION WebRtcSpl_SqrtFloor |
40 mov r1, #3 << 30 | 40 mov r1, #3 << 30 |
41 mov r2, #1 << 30 | 41 mov r2, #1 << 30 |
42 | 42 |
43 @ unroll for i = 0 .. 15 | 43 @ unroll for i = 0 .. 15 |
44 | 44 |
45 cmp r0, r2, ror #2 * 0 | 45 cmp r0, r2, ror #2 * 0 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 cmp r0, r2, ror #2 * 14 | 101 cmp r0, r2, ror #2 * 14 |
102 subhs r0, r0, r2, ror #2 * 14 | 102 subhs r0, r0, r2, ror #2 * 14 |
103 adc r2, r1, r2, lsl #1 | 103 adc r2, r1, r2, lsl #1 |
104 | 104 |
105 cmp r0, r2, ror #2 * 15 | 105 cmp r0, r2, ror #2 * 15 |
106 subhs r0, r0, r2, ror #2 * 15 | 106 subhs r0, r0, r2, ror #2 * 15 |
107 adc r2, r1, r2, lsl #1 | 107 adc r2, r1, r2, lsl #1 |
108 | 108 |
109 bic r0, r2, #3 << 30 @ for rounding add: cmp r0, r2 adc r2, #1 | 109 bic r0, r2, #3 << 30 @ for rounding add: cmp r0, r2 adc r2, #1 |
110 bx lr | 110 bx lr |
OLD | NEW |