471,071 Members | 4,813 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

faster memcpy on StrongARM machine?

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
Jul 22 '05 #1
2 1626
Gernot Frisch wrote:
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
Jul 22 '05 #2
Pete C. wrote:
Gernot Frisch wrote:
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


[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

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.