[PATCH] Fix treatment of ARM unallocated hint instructions

Mihail Popa Mihail.Popa at arm.com
Tue Apr 16 06:17:40 PDT 2013


Hello.

In the current implementation, the ARM "hint space" is modelled as a "hint" instruction taking an 8 bit immediate operand. This is not entirely conforming with the ARM specification.

Firstly "hint" is not and never was a proper ARM mnemonic on v7 or previous. Any code using "hint #imm" will not assemble using the ARM proprietary assembler.

Secondly, within the hint space, the reference manual defines only 5 permitted values for the immediate field:
1. nop (imm == 0)
2. yield (imm == 1)
3. wfe (imm == 2)
4. wfi (imm == 3)
5. sev (imm == 4)

Thirdly, for the remaining values (i.e. 5 through 255) the manual states that: "These unallocated hint encodings are reserved and software must not use them."

The attached patch restricts the permitted values for the "hint" instruction to 0 through 4.
This has the following effects:

1. "hint #imm" with #imm in [0..4] will assemble to one of {nop, yield, wfe, wfi, sev}
2. "hint #imm" with #imm > 4 will be rejected for ARM instruction set
3. a bitpattern from the hint space with #imm in [0..4] will be decoded to one of {nop, yield, wfe, wfi, sev}
4. a bitpattern from the hint space with #imm > 5 will not be decoded (invalid instruction encoding)

Patch also trims some trailing white space.

Regards,
Mihai

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LLVM-713.hints.patch
Type: text/x-patch
Size: 10905 bytes
Desc: LLVM-713.hints.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130416/b43f2e12/attachment.bin>


More information about the llvm-commits mailing list