codewing

roulette

Jan 29th, 2015
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 1.86 KB | None | 0 0
  1. ;# Funktionen
  2. .globl _asm_matrQuad
  3. .globl _asm_matrTransp
  4.  
  5. .code 32
  6.  
  7. ;# _asm_matrQuad(float *input, float *result);
  8. _asm_matrQuad:
  9.     push {r4-r7, sp, lr}                ;#Save to the stack
  10.  
  11.     mov r4, r1                              ;#Save pointer of r1 to r4
  12.     sub sp, #256                            ;#Make space for the result matrix
  13.     mov r1, sp
  14.     bl _asm_matrTransp
  15.  
  16.     ;#set reg to default values
  17.     ;#r5 = cache for pointer to a row
  18.     mov r6, #0                              ;#row counter in table 1
  19.     mov r7, #0                              ;#row counter in table 2
  20.  
  21.   iterate:
  22.     ;#load the left table row
  23.     mov r5, r6, LSL #5
  24.     vldm r5, {q2, q3}                       ;#Load the current row in table 1 into q2 and q3
  25.     mov r5, r7, LSL #5
  26.     vldm r5, {q4, q5}                       ;#Load the current transposed column in table 2 into q4 and q5
  27.  
  28.     vmul.f32 q0, q2, q4                     ;#multiply q2 and q4
  29.     vmla.f32 q0, q3, q5                     ;#add q2*q4 to q3*q5
  30.  
  31.     vadd.f32 d0, d1
  32.     vadd.f32 s0, s1
  33.  
  34.  
  35.     pop {r4-r7, sp, pc}             ;#Load the old variables from the stack
  36.     BX lr
  37.  
  38.  
  39. ;#void _asm_matrTransp(float *input, float *result);
  40. _asm_matrTransp:
  41.     push {r4-r8, lr};               ;#Save to the stack
  42.  
  43.     mov r4, r0                      ;# Pointer to first matrix element of the current column in r4
  44.     mov r5, #0                      ;# r5 current row
  45.     mov r8, #0                      ;# r8 current column
  46.     mov r6, #0                      ;# r6 is the current offset of the target result
  47.   iterate:
  48.     ldr r7, [r4, r5, LSL #5]        ;# r7 contains the current load element
  49.     str r7, [r1, r6, LSL #2]        ;# Save the value of r7 into the result matrix
  50.  
  51.     add r6, #1                      ;#go to next result cell
  52.     add r5, #1                      ;#go to the next row in the input matrix
  53.     cmp r5, #8                      ;# row == 8 then next column
  54.     bne iterate
  55.     ;# If we are here we go to the next row
  56.     mov r5, #0                      ;# row = 0
  57.     add r4, #4                      ;# column pointer to the next float
  58.     add r8, #1                      ;# column++
  59.     cmp r8, #8
  60.     bne iterate                     ;# if we have done all 8 columns its over
  61.  
  62.     pop {r4-r8, pc};                ;#Load the old variables from the stack
Advertisement
Add Comment
Please, Sign In to add comment