faster memcpy on StrongARM machine?

G

Gernot Frisch

Hi,

I saw that the PocketHAL library has a faster memcpy for large blocks
on an StrongARM processor. Can anyone give me the source for such a
memcpy?

--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
 
P

Pete C.

Gernot said:
Hi,

I saw that the PocketHAL library has a faster memcpy for large blocks
on an StrongARM processor. Can anyone give me the source for such a
memcpy?

It's probably in Assembler, but such platform-specific things are off-topic
here. You might try asking Thierry over on the forums for PHAL on
pocketmatrix.com.

- Pete
 
T

Thomas Matthews

Pete said:
It's probably in Assembler, but such platform-specific things are off-topic
here. You might try asking Thierry over on the forums for PHAL on
pocketmatrix.com.

- Pete

[Off-Topic]
A faster memcpy involves using conditional execution and
also the block load and store instructions.

Here is a sample:
memcpy_byte
STMFD sp!,{r0-r3} ; Save registers (ARM / 32-bit mode)
ANDS R2, R2, R2 ; Set up condition codes (Z / NZ)
memcpy_loop
LDRNEB R3, [R1], #1 ; if R2 != 0, Load value from source
(and increment).
STRNEB R3, [R0], #1 ; if R2 != 0, Store fill value into
[r0] & incr R0.
SUBNES R2, R2, #1 ; if R2 != 0, decrement R2
LDRNEB R3, [R1], #1 ; if R2 != 0, Load value from source
(and increment).
STRNEB R3, [R0], #1 ; if R2 != 0, Store fill value into
[r0] & incr R0.
SUBNES R2, R2, #1 ; if R2 != 0, decrement R2
LDRNEB R3, [R1], #1 ; if R2 != 0, Load value from source
(and increment).
STRNEB R3, [R0], #1 ; if R2 != 0, Store fill value into
[r0] & incr R0.
SUBNES R2, R2, #1 ; if R2 != 0, decrement R2
LDRNEB R3, [R1], #1 ; if R2 != 0, Load value from source
(and increment).
STRNEB R3, [R0], #1 ; if R2 != 0, Store fill value into
[r0] & incr R0.
SUBNES R2, R2, #1 ; if R2 != 0, decrement R2
BNE memcpy_loop ; loop around if more bytes to process.
LDMFD sp!,{r0-r3} ; Restore registers (ARM / 32-bit mode)
BX R14 ; Return to caller.


--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top