Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
arm assembly - generating of 32 bit constants
Jump...
Cancel
Locked
Locked
Replies
5 replies
Subscribers
119 subscribers
Views
3746 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
arm assembly - generating of 32 bit constants
Chmielewski Andreas
over 12 years ago
Note: This was originally posted on 13th October 2009 at
http://forums.arm.com
Hi,
i am searching for an algorithm to load any kind of 32 bit constants. As you know the arm compiler puts in the most cases the constants with some add/mul etc instructions together instead of loading the constant via the program counter out of the "constant pool". The way the compiler generates the constants is not really known to me. Unfortunately I could not find anything about it right now. Does somebody know where i can find something explaining whats the best way is to generate constants. Thx
Parents
Peter Harris
over 12 years ago
Note: This was originally posted on 13th October 2009 at
http://forums.arm.com
For a generic 32-bit constants you are probably looking at out-of-line loads from a pc-relative literal pool - you cannot directly embed all 32-bit constant values in to an ARM instruction. You can embed *some* constants directly in to many instruction encodings - but these can only encode a limited set of values (8-bits rotated an event number of paces for most data processing instructions in the ARM instruction set).
Thumb-2 introduces wide-data loads, allowing a pair of instructions to load the high and the low 16-bits of a register.
For details of all of the instruction set encodings you probably want to get hold of the ARM Architecture Reference Manual - you can sign up for access using the link below:
[url="
https://silver.arm.com/browse/AR570
"]
https://silver.arm.com/browse/AR570[/url]
Cancel
Vote up
0
Vote down
Cancel
Reply
Peter Harris
over 12 years ago
Note: This was originally posted on 13th October 2009 at
http://forums.arm.com
For a generic 32-bit constants you are probably looking at out-of-line loads from a pc-relative literal pool - you cannot directly embed all 32-bit constant values in to an ARM instruction. You can embed *some* constants directly in to many instruction encodings - but these can only encode a limited set of values (8-bits rotated an event number of paces for most data processing instructions in the ARM instruction set).
Thumb-2 introduces wide-data loads, allowing a pair of instructions to load the high and the low 16-bits of a register.
For details of all of the instruction set encodings you probably want to get hold of the ARM Architecture Reference Manual - you can sign up for access using the link below:
[url="
https://silver.arm.com/browse/AR570
"]
https://silver.arm.com/browse/AR570[/url]
Cancel
Vote up
0
Vote down
Cancel
Children
No data