merge
This commit is contained in:
commit
2ba46903fa
5 changed files with 62 additions and 3 deletions
|
@ -306,6 +306,7 @@ subprop(Reg *r0)
|
|||
case AAND:
|
||||
case AEOR:
|
||||
case AMUL:
|
||||
case AMULU:
|
||||
case ADIV:
|
||||
case ADIVU:
|
||||
|
||||
|
@ -977,6 +978,7 @@ copyu(Prog *p, Adr *v, Adr *s)
|
|||
case AAND:
|
||||
case AEOR:
|
||||
case AMUL:
|
||||
case AMULU:
|
||||
case ADIV:
|
||||
case ADIVU:
|
||||
case AADDF:
|
||||
|
@ -1112,6 +1114,7 @@ a2type(Prog *p)
|
|||
case AAND:
|
||||
case AEOR:
|
||||
case AMUL:
|
||||
case AMULU:
|
||||
case ADIV:
|
||||
case ADIVU:
|
||||
return D_REG;
|
||||
|
|
|
@ -2,12 +2,14 @@ objtype=arm
|
|||
</$objtype/mkfile
|
||||
|
||||
LIB=/$objtype/lib/libmp.a
|
||||
OFILES= \
|
||||
SFILES=mpvecdigmuladd.s mpvecdigmulsub.s
|
||||
|
||||
HFILES=/$objtype/include/u.h /sys/include/mp.h ../port/dat.h
|
||||
|
||||
UPDATE=\
|
||||
mkfile\
|
||||
OFILES=${SFILES:%.s=%.$O}
|
||||
|
||||
UPDATE=mkfile\
|
||||
$HFILES\
|
||||
$SFILES\
|
||||
|
||||
</sys/src/cmd/mksyslib
|
||||
|
|
19
sys/src/libmp/arm/mpvecdigmuladd.s
Normal file
19
sys/src/libmp/arm/mpvecdigmuladd.s
Normal file
|
@ -0,0 +1,19 @@
|
|||
TEXT mpvecdigmuladd(SB),$0
|
||||
MOVW n+4(FP),R4
|
||||
MOVW m+8(FP),R5
|
||||
MOVW p+12(FP),R6
|
||||
MOVW $0, R2
|
||||
_muladdloop:
|
||||
MOVW $0, R1
|
||||
MOVW.W.P 4(R0), R3
|
||||
MULALU R3, R5, (R1, R2)
|
||||
MOVW (R6), R7
|
||||
ADD.S R2, R7
|
||||
ADC $0, R1, R2
|
||||
MOVW.W.P R7, 4(R6)
|
||||
SUB.S $1, R4
|
||||
B.NE _muladdloop
|
||||
MOVW (R6), R7
|
||||
ADD R2, R7
|
||||
MOVW R7, (R6)
|
||||
RET
|
22
sys/src/libmp/arm/mpvecdigmulsub.s
Normal file
22
sys/src/libmp/arm/mpvecdigmulsub.s
Normal file
|
@ -0,0 +1,22 @@
|
|||
TEXT mpvecdigmulsub(SB),$0
|
||||
MOVW n+4(FP),R4
|
||||
MOVW m+8(FP),R5
|
||||
MOVW p+12(FP),R6
|
||||
MOVW $0, R2
|
||||
_mulsubloop:
|
||||
MOVW $0, R1
|
||||
MOVW.W.P 4(R0), R3
|
||||
MULALU R3, R5, (R1, R2)
|
||||
MOVW (R6), R7
|
||||
SUB.S R2, R7
|
||||
ADD.CC $1, R1
|
||||
MOVW R1, R2
|
||||
MOVW.W.P R7, 4(R6)
|
||||
SUB.S $1, R4
|
||||
B.NE _mulsubloop
|
||||
MOVW (R6), R7
|
||||
SUB.S R2, R7
|
||||
MOVW.CS $1, R0
|
||||
MOVW.CC $-1, R0
|
||||
MOVW R7, (R6)
|
||||
RET
|
|
@ -21,6 +21,19 @@ mpdigdiv(mpdigit *dividend, mpdigit divisor, mpdigit *quotient)
|
|||
return;
|
||||
}
|
||||
|
||||
// very common case
|
||||
if(~divisor == 0){
|
||||
lo += hi;
|
||||
if(lo < hi){
|
||||
hi++;
|
||||
lo++;
|
||||
}
|
||||
if(lo+1 == 0)
|
||||
hi++;
|
||||
*quotient = hi;
|
||||
return;
|
||||
}
|
||||
|
||||
// at this point we know that hi < divisor
|
||||
// just shift and subtract till we're done
|
||||
q = 0;
|
||||
|
|
Loading…
Reference in a new issue