From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28841 invoked by alias); 14 Jan 2005 00:18:09 -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 28200 invoked from network); 14 Jan 2005 00:17:38 -0000 Received: from unknown (HELO gizmo09ps.bigpond.com) (144.140.71.19) by sourceware.org with SMTP; 14 Jan 2005 00:17:38 -0000 Received: (qmail 25842 invoked from network); 14 Jan 2005 00:17:36 -0000 Received: from unknown (HELO psmam12.bigpond.com) (144.135.25.103) by gizmo09ps.bigpond.com with SMTP; 14 Jan 2005 00:17:36 -0000 Received: from cpe-144-136-221-26.sa.bigpond.net.au ([144.136.221.26]) by psmam12.bigpond.com(MAM REL_3_4_2a 234/36287002) with SMTP id 36287002; Fri, 14 Jan 2005 10:17:36 +1000 Received: by bubble.modra.org (Postfix, from userid 500) id 05A03FA29C; Fri, 14 Jan 2005 10:47:36 +1030 Date: Fri, 14 Jan 2005 00:18:00 -0000 From: Alan Modra To: "H. J. Lu" Cc: "Allan B. Cruse" , binutils@sources.redhat.com, gcc@gcc.gnu.org, libc-alpha@sources.redhat.com, linux-kernel@vger.kernel.org Subject: Re: Change i386 assembler/disassembler for SIB with INDEX==4 Message-ID: <20050114001735.GB3408@bubble.modra.org> Mail-Followup-To: "H. J. Lu" , "Allan B. Cruse" , binutils@sources.redhat.com, gcc@gcc.gnu.org, libc-alpha@sources.redhat.com, linux-kernel@vger.kernel.org References: <20050113203328.1174721A3F@nexus.cs.usfca.edu> <20050113224601.GA3184@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050113224601.GA3184@lucon.org> User-Agent: Mutt/1.4i X-SW-Source: 2005-01/txt/msg00137.txt.bz2 On Thu, Jan 13, 2005 at 02:46:01PM -0800, H. J. Lu wrote: > On Thu, Jan 13, 2005 at 12:33:28PM -0800, Allan B. Cruse wrote: > > > > On Thu, 13 Jan 2005, "H. J. Lu" wrote: > > > > > > > > > > > > Subject: Change i386 assembler/disassembler for SIB with INDEX==4 > > > > > > I am proposing to change i386 assembler/disassembler for SIB with > > > INDEX==4 > > > > > > http://sources.redhat.com/bugzilla/show_bug.cgi?id=658 > > > > > > It will change the assembler output for (%ebx,[1248]). I am not too > > > worried about the disassembler output since assembler can't generate > > > SIB with INDEX==4 directly today. Any comments? > > > > > > > > > H.J. > > > > > > > > > This change would give programmers the freedom to write instruction- > > syntax that the processor cannot actually execute, is that right? > > No. Assemberl will turn "mov (%ebx,2),%eax" into "8b 04 63", which > is valid i386 machine code. I don't see any particular need to support generation of this instruction coding. Feeding the output of the disassembler back to the assembler won't generate the same encodings for many instructions, eg. there are two ways to encode mov %eax,%ebx (and some people even use the two reg->reg move encodings to hide messages in code). Another example is that the assembler chooses the smallest immediate or displacement encoding. > > > > Perhaps the downside to this would lie in the hours of debugging and > > private research each programmer would then be faced with, trying to > > figure out why " movl (%esi,2),%eax " wasn't doing what he/she had > > intended, and which the assembler had dutifully accepted. --ABC Huh? The assembler will warn about this construct, and we certainly should continue to warn, so that people who meant to write "mov (,%esi,2),%eax" get a clue. > > What do you expect "movl (%esi,2),%eax" will do? > > > H.J. -- Alan Modra IBM OzLabs - Linux Technology Centre