* [PATCH] Fix trivial error in opcodes/arc-opc.c
@ 2004-11-17 12:58 Ravi
2004-11-22 17:46 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Ravi @ 2004-11-17 12:58 UTC (permalink / raw)
To: binutils; +Cc: Ramana Radhakrishnan
[-- Attachment #1: Type: text/plain, Size: 1264 bytes --]
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.
[-- Attachment #2: ChangeLog --]
[-- Type: text/plain, Size: 218 bytes --]
2004-11-17 Ravi Ramaseshan <ravi.ramaseshan@codito.com>
opcode/ChangeLog
* opcode/arc-opc.c (insert_base): modifying
ls_operand[LS_OFFSET] to reflect the change to the short
immediate syntax.
[-- Attachment #3: arc-ld-operand-shimm.patch --]
[-- Type: text/x-patch, Size: 1603 bytes --]
Index: opcodes/arc-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/arc-opc.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 arc-opc.c
*** opcodes/arc-opc.c 18 Nov 2002 16:50:03 -0000 1.11
--- opcodes/arc-opc.c 17 Nov 2004 09:37:00 -0000
*************** insert_base (insn, operand, mods, reg, v
*** 938,943 ****
--- 938,944 ----
shimm_p = 1;
shimm = value;
ls_operand[LS_BASE] = OP_SHIMM;
+ ls_operand[LS_OFFSET] = OP_SHIMM;
}
else
{
Index: gas/testsuite/gas/arc/ld.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arc/ld.d,v
retrieving revision 1.2
diff -c -3 -p -r1.2 ld.d
*** gas/testsuite/gas/arc/ld.d 11 Jan 2001 21:20:18 -0000 1.2
--- gas/testsuite/gas/arc/ld.d 17 Nov 2004 09:37:00 -0000
*************** Disassembly of section .text:
*** 11,13 ****
--- 11,14 ----
8: 08 88 21 00 00218808 ld.a r1,\[r3,r4\]
c: 05 06 21 00 00210605 ldw.x r1,\[r2,r3\]
10: 0d 88 41 00 0041880d ldw.x.a r2,\[r3,r4\]
+ 14: 00 80 1f 08 081f8000 ld r0,\[0\]
Index: gas/testsuite/gas/arc/ld.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arc/ld.s,v
retrieving revision 1.2
diff -c -3 -p -r1.2 ld.s
*** gas/testsuite/gas/arc/ld.s 11 Jan 2001 21:20:18 -0000 1.2
--- gas/testsuite/gas/arc/ld.s 17 Nov 2004 09:37:00 -0000
***************
*** 5,7 ****
--- 5,8 ----
ld.a r1,[r3,r4]
ldw.x r1,[r2,r3]
ldw.x.a r2,[r3,r4]
+ ld r0,[0]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix trivial error in opcodes/arc-opc.c
2004-11-17 12:58 [PATCH] Fix trivial error in opcodes/arc-opc.c Ravi
@ 2004-11-22 17:46 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2004-11-22 17:46 UTC (permalink / raw)
To: Ravi; +Cc: binutils, Ramana Radhakrishnan
Hi Ravi,
> 2004-11-22 Ravi Ramaseshan <ravi.ramaseshan@codito.com>
>
> * opcode/arc-opc.c (insert_base): Modify ls_operand[LS_OFFSET]
> to reflect the change to the short immediate syntax.
Approved and applied.
Cheers
Nick
PS. You forgot a ChangeLog entry for the patch to the gas testsuite
files, but I created on for you:
gas/testsuite/ChangeLog
2004-11-22 Ravi Ramaseshan <ravi.ramaseshan@codito.com>
* gas/arc/ld.s: Add check of load of a long immediate.
* gas/arc/ld.d: Add expected disassembly.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-22 17:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-17 12:58 [PATCH] Fix trivial error in opcodes/arc-opc.c Ravi
2004-11-22 17:46 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).