Reality Signal Processor/CPU Core: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
Line 756: Line 756:
lqv $v31, %lo(CONST),r0 # Load the constants
lqv $v31, %lo(CONST),r0 # Load the constants


</syntaxhighlight>One example of using <code>lqv</code> and <code>lrv</code> in pair is to perform a fast memcpy from a possible misaligned address to an aligned destination buffer:
</syntaxhighlight>One example of using <code>lqv</code> and <code>lrv</code> in pair is to perform a fast memcpy from a possible misaligned address to an aligned destination buffer:<syntaxhighlight lang="asm">
# s0 is the pointer to source data in DMEM (possibly misaligned)
# s4 will point to the destination buffer in DMEM (aligned)
# t1 is the number of bytes to copy
li s4, %lo(BUFFER)
loop:
lqv $v00, 0x00,s0
lrv $v00, 0x10,s0
sqv $v00, 0,s4
sub t1, 16
add s0, 16
bgtz t1, loop
add s4, 16

</syntaxhighlight>