ARM optimised memset

Hello,
I notice that on ARM the SDL_memset4 ends up being the default C
implementation. This is not particularly efficient, as ARM has
specialised instructions for doing these kinds of operations.

I’ve bodged together a patch using some code from the android project
which does this a bit more efficiently - I get approximately a 5 times
speed improvement on SDL_FillRect operations using this code.

If anyone else is interested, please find it attached.

Regards,
Andre–
Bluewater Systems Ltd - ARM Technology Solution Centre

Andre Renaud 5 Amuri Park, 404 Barbadoes St
@Andre_Renaud PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdl-framebuffer.patch
Type: text/x-patch
Size: 4078 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20101004/28759d4b/attachment.bin

do you think this would help improve the RISCOS version of SDL? i have been
bugging some of my ARM coding buddies for ages to optimise parts for me.

I would assume so, the code should be generic across all platforms.
I should mention that this patch was against SDL 1.2.14.

Regards,
AndreOn 04/10/10 20:54, Neil White wrote:

do you think this would help improve the RISCOS version of SDL? i have
been bugging some of my ARM coding buddies for ages to optimise parts
for me.


Bluewater Systems Ltd - ARM Technology Solution Centre

Andre Renaud 5 Amuri Park, 404 Barbadoes St
@Andre_Renaud PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934

You can do a test to compare the (new memcpy vs old memcpy)?
I think this will work for a WINCE.
I’ll try to check.

2010/10/6, Andre Renaud :> On 04/10/10 20:54, Neil White wrote:

do you think this would help improve the RISCOS version of SDL? i have
been bugging some of my ARM coding buddies for ages to optimise parts
for me.

I would assume so, the code should be generic across all platforms.
I should mention that this patch was against SDL 1.2.14.

Regards,
Andre

Bluewater Systems Ltd - ARM Technology Solution Centre

Andre Renaud 5 Amuri Park, 404 Barbadoes St
andre at bluewatersys.com PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Wow.On 04/10/2010 00:19, Andre Renaud wrote:

I get approximately a 5 times speed improvement on SDL_FillRect
operations using this code.

Having said it would all be fine, it is possible that the assembly has
GNU’isms in it, so not sure how well it will build on RicsOS, or WinCE.

Regards,
AndreOn 06/10/10 21:53, Andrey A. wrote:

You can do a test to compare the (new memcpy vs old memcpy)?
I think this will work for a WINCE.
I’ll try to check.

2010/10/6, Andre Renaud<@Andre_Renaud>:

On 04/10/10 20:54, Neil White wrote:

do you think this would help improve the RISCOS version of SDL? i have
been bugging some of my ARM coding buddies for ages to optimise parts
for me.

I would assume so, the code should be generic across all platforms.
I should mention that this patch was against SDL 1.2.14.

Regards,
Andre

it’s not a matter of the platform but rather a matter of licences
you can use LGPL (sdl licence) in GPL code but i’m not sure about the contrary

Anyways, i checked that this file uses the Apache Licence which is
quaite liberal
http://www.apache.org/licenses/LICENSE-2.0

any chance to have this patch for sdl 1.3?
VittorioOn Thu, Oct 7, 2010 at 10:36 PM, Andre Renaud wrote:

Having said it would all be fine, it is possible that the assembly has
GNU’isms in it, so not sure how well it will build on RicsOS, or WinCE.

Regards,
Andre

On 06/10/10 21:53, Andrey A. wrote:

You can do a test to compare the (new memcpy vs old memcpy)?
I think this will work for a WINCE.
I’ll try to check.

2010/10/6, Andre Renaud:

On 04/10/10 20:54, Neil White wrote:

do you think this would help improve the RISCOS version of SDL? i have
been bugging some of my ARM coding buddies for ages to optimise parts
for me.

I would assume so, ?the code should be generic across all platforms.
I should mention that this patch was against SDL 1.2.14.

Regards,
Andre


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

If anyone else wants to try, I’ve attached the source assembler so
that it is compatible with iphone ancient gas.
I haven’t seen much of improvement but most likely that’s because our
game doesn’t yet use SDL_FillRect, but i’d like to see other views.
imho it’s no harm in including it as optional.

bye
VittorioOn Fri, Oct 8, 2010 at 3:33 PM, Vittorio Giovara <@Vittorio_Giovara> wrote:

it’s not a matter of the platform but rather a matter of licences
you can use LGPL (sdl licence) in GPL code but i’m not sure about the contrary

Anyways, i checked that this file uses the Apache Licence which is
quaite liberal
http://www.apache.org/licenses/LICENSE-2.0

any chance to have this patch for sdl 1.3?
Vittorio

On Thu, Oct 7, 2010 at 10:36 PM, Andre Renaud wrote:

Having said it would all be fine, it is possible that the assembly has
GNU’isms in it, so not sure how well it will build on RicsOS, or WinCE.

Regards,
Andre

On 06/10/10 21:53, Andrey A. wrote:

You can do a test to compare the (new memcpy vs old memcpy)?
I think this will work for a WINCE.
I’ll try to check.

2010/10/6, Andre Renaud:

On 04/10/10 20:54, Neil White wrote:

do you think this would help improve the RISCOS version of SDL? i have
been bugging some of my ARM coding buddies for ages to optimise parts
for me.

I would assume so, ?the code should be generic across all platforms.
I should mention that this patch was against SDL 1.2.14.

Regards,
Andre


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

-------------- next part --------------
A non-text attachment was scrubbed…
Name: memset.arm.S
Type: application/octet-stream
Size: 2752 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20101016/38c8fd96/attachment.obj

http://github.com/yuvi/gas-preprocessor might be useful?On 10/16/2010 07:20 AM, Vittorio G. wrote:

If anyone else wants to try, I’ve attached the source assembler so
that it is compatible with iphone ancient gas.
I haven’t seen much of improvement but most likely that’s because our
game doesn’t yet use SDL_FillRect, but i’d like to see other views.
imho it’s no harm in including it as optional.

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero