I need to load the immediate value 0.5f ( = 0.8 in HEX) in a NEON register (or an ARM register, than i can VMOV it) using assembly.
I've read ARM doc: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204h/Bcfjicfj.html Which links to: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204h/CIHGGEEB.html
Where they say you can load floating point:
Any number that can be expressed as +/-n * 2-r, where n and r are integers, 16 <= n <= 31, 0 <= r <= 7.
Because 0.8 is out of range, I'm expecting i need to load HEX 1.8 and subtract 1.0 but the following instructions are not OK for the compiler:
VMOV.F32 d10, #0x1.0 \n\t
VMOV.F32 d10, #0x1.8 \n\t
However using the 0.5 decimal value does the trick, even if it should be out of range:
VMOV.F32 d10, #0.5 \n\t
Using HEX values how can i do the same operation?
Also another question: the previous VMOV.F32 instruction is expected to load the value in both 32 bit parts of the register d10[0] and d10[1] or not?
0.5
is exactly +16*(2^-5)
(n=16, r=5, note that it's not 2-r in the manual, it's 2 raised to -r) , so it's an ok value to move.
In other words, 0x0.8 should work too (although I can't test that very assembler, hex float syntax varies)
The manual also says;
imm is a constant of the type specified by datatype. This is replicated to fill the destination register.
which, as I read it, would fill the whole (both parts) of the register.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.