[PATCH] Fix trivial error in opcodes/arc-opc.c

Ravi ravi@codito.com
Wed Nov 17 12:58:00 GMT 2004


Hello,

I tried to assemble tbe following program for the ARC:

<snip>

.text

    ld r0,[0]

</snip>

However, the assembler gives an error message: 'ld operand error'.

The mentioned testcase tries to a load register from memory location 0. 
It could be any number less than 511.

These are the following definitions of the ld instruction under consideration 
as specified by the A4 manual:

LD<zz><.x><.di>     a,[shimm,shimm] (shimms MUST match)
LD<zz><.x><.di>     a,[limm]

The task can be achieved with the above syntaxes as:

ld r2,[0]   where 0 is treated as a long immediate
ld r2,[0,0] where 0s are treated as a short immediates

The function insert_base chooses the short immediate version, in order to save 
four bytes. whenever possible. However when converting from the shorter to the 
longer version, the increase in the number of operands had not been accounted for. 

Consequently, within the function ld_insert_syntax, the check looking for the
short immediate syntax fails.

The solution to this problem would be to modify ls_operand to reflect the change
to the short immediate syntax. This can be done in the function insert_base.

The attached patch should fix this problem and a testcase has been added for the 
same too.

Regards,
Ravi.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ChangeLog
URL: <https://sourceware.org/pipermail/binutils/attachments/20041117/58004c45/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arc-ld-operand-shimm.patch
Type: text/x-patch
Size: 1603 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20041117/58004c45/attachment.bin>


More information about the Binutils mailing list