Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;# Funktionen
- .globl _asm_matrQuad
- .globl _asm_matrTransp
- .code 32
- ;# _asm_matrQuad(float *input, float *result);
- _asm_matrQuad:
- push {r4-r7, sp, lr} ;#Save to the stack
- mov r4, r1 ;#Save pointer of r1 to r4
- sub sp, #256 ;#Make space for the result matrix
- mov r1, sp
- bl _asm_matrTransp
- ;#set reg to default values
- ;#r5 = cache for pointer to a row
- mov r6, #0 ;#row counter in table 1
- mov r7, #0 ;#row counter in table 2
- iterate:
- ;#load the left table row
- mov r5, r6, LSL #5
- vldm r5, {q2, q3} ;#Load the current row in table 1 into q2 and q3
- mov r5, r7, LSL #5
- vldm r5, {q4, q5} ;#Load the current transposed column in table 2 into q4 and q5
- vmul.f32 q0, q2, q4 ;#multiply q2 and q4
- vmla.f32 q0, q3, q5 ;#add q2*q4 to q3*q5
- vadd.f32 d0, d1
- vadd.f32 s0, s1
- pop {r4-r7, sp, pc} ;#Load the old variables from the stack
- BX lr
- ;#void _asm_matrTransp(float *input, float *result);
- _asm_matrTransp:
- push {r4-r8, lr}; ;#Save to the stack
- mov r4, r0 ;# Pointer to first matrix element of the current column in r4
- mov r5, #0 ;# r5 current row
- mov r8, #0 ;# r8 current column
- mov r6, #0 ;# r6 is the current offset of the target result
- iterate:
- ldr r7, [r4, r5, LSL #5] ;# r7 contains the current load element
- str r7, [r1, r6, LSL #2] ;# Save the value of r7 into the result matrix
- add r6, #1 ;#go to next result cell
- add r5, #1 ;#go to the next row in the input matrix
- cmp r5, #8 ;# row == 8 then next column
- bne iterate
- ;# If we are here we go to the next row
- mov r5, #0 ;# row = 0
- add r4, #4 ;# column pointer to the next float
- add r8, #1 ;# column++
- cmp r8, #8
- bne iterate ;# if we have done all 8 columns its over
- pop {r4-r8, pc}; ;#Load the old variables from the stack
Advertisement
Add Comment
Please, Sign In to add comment