set DIVISOR for each use of h/w divider
This commit is contained in:
parent
61b7cbdc54
commit
44feae4caf
@ -413,6 +413,7 @@ y64:
|
||||
lsls r3,#16
|
||||
orrs r3,r4
|
||||
str r3,[r7,#SIO_DIV_UDIVIDEND_OFFSET] @ y1=(r0<<16)+(((ui32)y)>>16);
|
||||
str r2,[r7,#SIO_DIV_UDIVISOR_OFFSET] @ must set divisor again, as we do not save/restore regs at all in IRQs if not dirty
|
||||
wait_div 1
|
||||
uxth r4,r0
|
||||
ldr r3,[r7,#SIO_DIV_REMAINDER_OFFSET] @ r1=y1-q1*x; 0<=r1<x
|
||||
@ -420,6 +421,7 @@ y64:
|
||||
lsls r3,#16
|
||||
orrs r3,r4
|
||||
str r3,[r7,#SIO_DIV_UDIVIDEND_OFFSET] @ y1=(r0<<16)+(((ui32)y)>>16);
|
||||
str r2,[r7,#SIO_DIV_UDIVISOR_OFFSET] @ must set divisor again, as we do not save/restore regs at all in IRQs if not dirty
|
||||
wait_div 3
|
||||
movs r3,#0
|
||||
lsls r4,r5,#16 @ quotient=(q0<<32)+(q1<<16)+q2
|
||||
|
@ -158,6 +158,23 @@ void test_nesting() {
|
||||
if (0xffffffffu != a * 11 + b) {
|
||||
FAILED();
|
||||
}
|
||||
static uint64_t z64;
|
||||
z64 -= 47;
|
||||
uint64_t a64 = z64 / -13635;
|
||||
uint64_t b64 = z64 % -13635;
|
||||
if (z64 != a64 * -13635 + b64) {
|
||||
FAILED();
|
||||
}
|
||||
// specifically check 64/32 divide
|
||||
static uint64_t c64 = 0x13ffffffffull;
|
||||
static uint32_t cd = 1;
|
||||
a64 = c64 / cd;
|
||||
b64 = c64 % cd;
|
||||
if (c64 != a64 * cd + b64) {
|
||||
FAILED();
|
||||
}
|
||||
cd++;
|
||||
|
||||
}
|
||||
// these use the divider
|
||||
for(uint i=0;i<=100;i+=20) {
|
||||
|
Loading…
Reference in New Issue
Block a user