From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15534 invoked by alias); 17 Nov 2004 12:58:47 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 15376 invoked from network); 17 Nov 2004 12:58:32 -0000 Received: from unknown (HELO marvin.codito.net) (203.197.88.2) by sourceware.org with SMTP; 17 Nov 2004 12:58:32 -0000 Received: from [192.168.100.47] (calvin.codito.co.in [203.199.140.162]) (authenticated bits=0) by marvin.codito.net (8.13.1/8.13.1/Debian-15) with ESMTP id iAHDG57l020471; Wed, 17 Nov 2004 18:46:11 +0530 Message-ID: <419B9822.6080307@codito.com> Date: Wed, 17 Nov 2004 12:58:00 -0000 From: Ravi User-Agent: Mozilla Thunderbird 0.8 (X11/20040926) MIME-Version: 1.0 To: binutils@sources.redhat.com CC: Ramana Radhakrishnan Subject: [PATCH] Fix trivial error in opcodes/arc-opc.c Content-Type: multipart/mixed; boundary="------------070504080206030907060604" X-SW-Source: 2004-11/txt/msg00250.txt.bz2 This is a multi-part message in MIME format. --------------070504080206030907060604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1264 Hello, I tried to assemble tbe following program for the ARC: .text ld r0,[0] 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<.x><.di> a,[shimm,shimm] (shimms MUST match) LD<.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. --------------070504080206030907060604 Content-Type: text/plain; name="ChangeLog" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ChangeLog" Content-length: 218 2004-11-17 Ravi Ramaseshan opcode/ChangeLog * opcode/arc-opc.c (insert_base): modifying ls_operand[LS_OFFSET] to reflect the change to the short immediate syntax. --------------070504080206030907060604 Content-Type: text/x-patch; name="arc-ld-operand-shimm.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="arc-ld-operand-shimm.patch" Content-length: 1603 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] --------------070504080206030907060604--