On 27 July 2016 at 00:27, Dikshit, Abhishek Abhishek.Dikshit@cavium.com wrote:
Hi All
The immr and imms values are decoded to get an immediate value. Is there a way to encode from immediate value to immr and imms field for ARMv8 ?
Instruction
Routine.
The DecodeBitMasks routine is not very clear. Any help is appreciated.
Hi
In lj_emit_arm64.h, there is a stub for the function emit_isk13() which, when implemented, will return the 13 bits representing N:immr:imms if the constant can be encoded using this scheme, or -1 otherwise. Are you working on implementing this function?
To understand how DecodeBitMasks works, I suggest creating some encodings, and disassembling them to see which values are displayed. You can do that as follows:
$ echo " .inst 0x72000000" > test.s $ aarch64-linux-gnu-gcc -c test.s $ aarch64-linux-gnu-objdump -D test.o test.o: file format elf64-littleaarch64
Disassembly of section .text:
0000000000000000 <.text>: 0: 72000000 ands w0, w0, #0x1
Here, you can see that when N, immr and imms are all zero, the resulting constant has the value of 1. With some experimentation, the explanation in the ARM v8 architecture manual should become clear.
Hope this helps, Charles