简体   繁体   English

在ARM寄存器中加载立即浮点

[英]Load immediate Floating Point in ARM Register

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. 我需要使用汇编程序将立即值0.5f(在HEX中= 0.8)加载到NEON寄存器(或ARM寄存器,我可以对其进行VMOV)中。

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 我已阅读ARM文档: http : //infocenter.arm.com/help/index.jsp?topic=/ com.arm.doc.dui0204h/ Bcfjicfj.html链接至: 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. 可以表示为+/- n * 2-r的任何数字,其中n和r是整数,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: 因为0.8超出范围,所以我希望我需要加载HEX 1.8并减去1.0,但以下说明对于编译器而言不正确:

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: 但是,使用0.5十进制值可以解决问题,即使它应该超出范围:

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? 还有另一个问题:上一条VMOV.F32指令是否希望在寄存器d10 [0]和d10 [1]的两个32位部分中加载值?

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. 0.5恰好是+16*(2^-5) (n = 16,r = 5,请注意它不是手册中的2-r,而是2升至-r),所以移动是一个不错的值。

In other words, 0x0.8 should work too (although I can't test that very assembler, hex float syntax varies) 换句话说,0x0.8也应该工作(尽管我无法测试非常汇编程序,但十六进制浮点语法会有所不同)

The manual also says; 该手册还说:

imm is a constant of the type specified by datatype. imm是由数据类型指定的类型的常量。 This is replicated to fill the destination register. 复制它以填充目标寄存器。

which, as I read it, would fill the whole (both parts) of the register. 如我所读,它将填充寄存器的整个(两个部分)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM