Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LmDNS-0005S8-Bh for qemu-devel@nongnu.org; Tue, 24 Mar 2009 16:37:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LmDNR-0005Rw-03 for qemu-devel@nongnu.org; Tue, 24 Mar 2009 16:37:37 -0400 Received: from [199.232.76.173] (port=56735 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmDNQ-0005Rt-Ps for qemu-devel@nongnu.org; Tue, 24 Mar 2009 16:37:36 -0400 Received: from fg-out-1718.google.com ([72.14.220.158]:8340) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LmDNQ-0000j0-E5 for qemu-devel@nongnu.org; Tue, 24 Mar 2009 16:37:36 -0400 Received: by fg-out-1718.google.com with SMTP id e21so836618fga.8 for ; Tue, 24 Mar 2009 13:37:33 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <-4209888356038288037@unknownmsgid> References: <-4209888356038288037@unknownmsgid> Date: Tue, 24 Mar 2009 21:37:33 +0100 Message-ID: <761ea48b0903241337t5f745163v1b47ca77d7e938d5@mail.gmail.com> Subject: Re: [Qemu-devel] [PATCH target-arm] Don' use T[x] in helper From: Laurent Desnogues Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 2009/3/24 Torbj=F6rn Andersson : > > I hit a strange issue with add_cc, can't really explain how it appeared b= ut > it did. The patch below solved my problem. > > Can someone make a qualified guess why? I'm compling with gcc 4. > > However, T0 and T1 in a helper should not be used, because it creates a > unnecessary dependency between translate.c and op_helper.c. Am I correct? > > Further, if we cannot trust T0 and T1 in a helper, what about the global > env-variable? Your patch is correct and the previous code works by accident since add_cc is called this way: gen_helper_add_cc(cpu_T[0], cpu_T[0], cpu_T[1]) What I find strange is that you had issue with the code in svn. I didn't have before I fixed it, but it was perhaps using some old compiler at that time. Laurent Acked-by: Laurent Desnogues > /Best regards Torbj=F6rn Andersson > > Index: op_helper.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- op_helper.c (revision 6883) > +++ op_helper.c (working copy) > @@ -307,7 +307,7 @@ > uint32_t HELPER (add_cc)(uint32_t a, uint32_t b) > { > uint32_t result; > - result =3D T0 + T1; > + result =3D a + b; > env->NF =3D env->ZF =3D result; > env->CF =3D result < a; > env->VF =3D (a ^ b ^ -1) & (a ^ result);