# $4 pointer to the address of acorr[] (array of floats) # $5 pointer to the address of coeff[] (array of floats) # $6 order of the filter # $2 return value ( 1=taken, 0=not taken ) .set noreorder .set nobopt .ent levdurv .globl levdurv levdurv: .frame $sp, 0, $31 li $13, 2 vmtcr $vpw, $13 li $7, 4 li $9, 1 subu $4, $4, $7 #shift the array index subu $5, $5, $7 #shift the array index lwc1 $f8, 4($4) #load the first float in acorr li.s $f2, 0.0 nop c.le.s $f8, $f2 bc1t return0 nop mul $8, $6, $7 addu $8, $8, $4 lwc1 $f9, 4($8) c.eq.s $f9, $f2 bc1t return0 lwc1 $f9, 8($4) #load the second float in acorr div.s $f10, $f9, $f8 neg.s $f10, $f10 li.s $f4, 1.0 #store 1.0 into coeff[1] nop swc1 $f4, 4($5) swc1 $f10, 8($5) #coeff[2] = rc[1] mul.s $f5, $f9, $f10 #$f10=rc[1], $f9=acorr[2] add.s $f5, $f8, $f5 #$f5=alpha c.le.s $f5, $f2 bc1t return0 li $10, 2 #$10=minc outerlp: addu $8, $10, 2 #$8=minc2 mul $11, $10, $7 addu $11, $11, $4 #get ready for acorr[minc+1] lwc1 $f6, 4($11) #$f6=s subu $11, $10, $9 #vlen=minc-1 vmtcr $vlr0, $11 vmtcr $vlr1, $11 vfset $vf0 li $12, 2 #$12=ip subu $13, $8, $12 #index into the array mul $13, $13, $7 addu $13, $13, $4 #address of the vector element li $14, -1 vlds.w $vr5, $13, $14 #vector load with negative stride mul $13, $12, $7 addu $14, $13, $5 #address of coeff[ip] vld.w $vr6, $14 #should we optimize here? #instead of loading all the time #do an insert vmul.s.vv $vr6, $vr6, $vr5 li $14, 0 addlp: vext.s.sv $f7, $14, $vr6 #$f7 = $vr6[$14] add.s $f6, $f6, $f7 #Accumulation #$f6=s addu $14, $14, $9 #increment pointer blt $14, $11, addlp #s should have the right the value in this iteration #of the outer loop div.s $f11, $f6, $f5 neg.s $f11, $f11 #$f11=-(s/alpha) div $12, $10, 2 add $12, $12, $9 #$12=mh #$12=minc/2+1 subu $11, $12, $9 #vlen=mh-1 vmtcr $vlr0, $11 vmtcr $vlr1, $11 vfset $vf0 mul $15, $10, $7 addu $15, $5, $15 #look at the printout #the new element of coeff[] #is always the number #minc of the outer loop li $24, -1 vlds.w $vr5, $15, $24 #$vr5=coeff[] #It should store the values #of index (order?) -> 2 #in reverse order li $13, 8 #8=2*4 addu $14, $13, $5 #The "proper" vector coeff[] #always starts with index 2 vld.w $vr6, $14 vmul.s.sv $vr7, $f11, $vr5 vadd.s.vv $vr7, $vr7, $vr6 #$vr7 becomes the actual #proper vector vmul.s.sv $vr8, $f11, $vr6 vadd.s.vv $vr5, $vr5, $vr8 #$24 is still -1 mul $25, $10, $7 addu $25, $25, $5 vsts.w $vr5, $25, $24 addu $25, $13, $5 vst.w $vr7, $25 out_lower: swc1 $f11, 4($15) #coeff[minc+1]=rc[minc] mul.s $f11, $f11, $f6 add.s $f5, $f5, $f11 c.le.s $f5, $f2 bc1t return0 addu $10, $10, $9 #minc++ bleu $10, $6, outerlp nop return1: li $2, 1 jr $31 nop return0: li $2, 0 jr $31 nop .end levdurv