Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-10

ARM4 and THUMB instruction sets

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

Hello,

I was reading about the difference between arm4 and thumb: http://wiki.forum.nokia.com/index.php/ARM4,_ARMI_&_THUMB

Because I noted that all examples for Symbian OS use thumb and fpc supports only arm4.

Acording to the nokia wiki using thumb would be produce smaller and faster code on the majority of mobiles, so it may be useful to see of we can easely support thumb. Since we always use an external assembler for arm, I wounder: Wouldn't be supporting arm4/thumb just a question of switching a switch when calling the assembler?

Or is the assembler different for both instruction sets, or do we use one of the arm4 specific instruction?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Daniël Mantione
to Felipe Monteiro de Carvalho

Op Wed, 17 Oct 2007, schreef Felipe Monteiro de Carvalho:

Show quoted text 10 lines
Hello, I was reading about the difference between arm4 and thumb: http://wiki.forum.nokia.com/index.php/ARM4,_ARMI_&_THUMB Because I noted that all examples for Symbian OS use thumb and fpc supports only arm4. Acording to the nokia wiki using thumb would be produce smaller and faster code on the majority of mobiles,

It is not that black and white. Some ARM processors use 16-bit busses and and therefore need 2 cycles to fetch normal 32-bit assembler instructions. On the other hand in thumb mode your instructions and adressing modes are much more limited, requiring you to write more instructions to do the job.

so it may be useful to see of we can easely support thumb. Since we always use an external assembler for arm, I wounder: Wouldn't be supporting arm4/thumb just a question of switching a switch when calling the assembler?

No, thumb assembler code is different from generating normal assembler code. You need serious code generator modifications.

Daniël

Reply by email

Yury Sidorov
to Daniël Mantione

From: "Daniël Mantione"

Show quoted text 11 lines
Op Wed, 17 Oct 2007, schreef Felipe Monteiro de Carvalho: > so it may be useful to see of > we can easely support thumb. Since we always use an external > assembler > for arm, I wounder: Wouldn't be supporting arm4/thumb just a > question > of switching a switch when calling the assembler? No, thumb assembler code is different from generating normal assembler code. You need serious code generator modifications.

Even worse. Thumb is completely different instruction set with different number of registers. Completely new code generator is needed for thumb.

Yury.

Reply by email

Bernd Mueller
to Felipe Monteiro de Carvalho: I was reading about the difference between arm4 and thumb:…
Felipe Monteiro de Carvalho wrote
Acording to the nokia wiki using thumb would be produce smaller and faster code on the majority of mobiles, so it may be useful to see of

just for more information:

"The Thumb code requires 70 % of space of the ARM code. The Thumb code uses 40 % more instructions than the ARM code. With 32-bit memory, the ARM code is 40 % faster than the Thumb code. With 16-bit memory, the Thumb code is 45 % faster than the ARM code. Thumb code uses 30 % less external memory power than ARM code."

Source: Steve Furber, ARM system-on-chip architecture.

So in my case, I won't touch Thumb code ;-)

Regards, Bernd.

Reply by email

Michael Schnell
to Bernd Mueller: just for more information: "The Thumb code requires 70 % of space of the ARM code. The…
Show quoted text 6 lines
"The Thumb code requires 70 % of space of the ARM code. The Thumb code uses 40 % more instructions than the ARM code. With 32-bit memory, the ARM code is 40 % faster than the Thumb code. With 16-bit memory, the Thumb code is 45 % faster than the ARM code. Thumb code uses 30 % less external memory power than ARM code."

Very valuable information !

OTOH, there now are processors that only do Thumb but not 32 Bit ARM code (Cortex M). There is no Linux or WinCE for those yet, do supposedly nobody wants TP for them, but in the future that might be viable.

-Michael

Reply by email

Felipe Monteiro de Carvalho
to Michael Schnell

It's funny that althougth all sources claim that arm4 code should be bigger, I just recompiled the HelloWorld example for symbian for thumb and then for arm4 and the arm4 version is actually a little smaller.

The arm4 executable also crashes when the program is executed =( Let's hope support for arm4 on the UIQ SDK isn't completely broken....

thanks,

Felipe Monteiro de Carvalho

Reply by email