From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49308 invoked by alias); 12 Apr 2019 20:21:51 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 49289 invoked by uid 89); 12 Apr 2019 20:21:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1899, HX-Received:62cc, HX-Spam-Relays-External:209.85.210.194, H*RU:209.85.210.194 X-HELO: mail-pf1-f194.google.com Received: from mail-pf1-f194.google.com (HELO mail-pf1-f194.google.com) (209.85.210.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Apr 2019 20:21:49 +0000 Received: by mail-pf1-f194.google.com with SMTP id y13so5647068pfm.11; Fri, 12 Apr 2019 13:21:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=A6oZybXFhNE9Gjc2RQHfb6jb3w7ubKr98mOuWSfd5yM=; b=TURZz0Vhi8TNgh6O3n5lwoxOg/khMo4YkDLgNXxp4zqnrW730MJjh0UB3GfrMQ71p1 Ku6T3fns6s2N86KX4EbKz8ok1exenPPVsZsRaddYeY4TojAXyif61JoiOrX8JleucwVf V+iE93gNgoRWZgB97aGuEYHRXPOVCI0Bb29GxnqwnGkp57G3rY6JnvUjnC3UI4OtpW/B PQFDY/gzOvbirVVD/lChYgLNz5hZyRUYMxVEgJfHTwOTcDdSUOM838PY+FEeQNCap+Sg 8QMfh3SzXJIJ1WS8ksioZI0kctV3xemoEoN5in8rcrk0DWjg6OLixLyTsTR0fVypcahU 1qsA== Return-Path: Received: from localhost (g191.61-115-60.ppp.wakwak.ne.jp. [61.115.60.191]) by smtp.gmail.com with ESMTPSA id c22sm47088565pfn.136.2019.04.12.13.21.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Apr 2019 13:21:47 -0700 (PDT) Date: Fri, 12 Apr 2019 20:21:00 -0000 From: Stafford Horne To: Andrew Burgess Cc: GDB patches , GNU Binutils , Andrey Bacherov , Openrisc Subject: Re: [PATCH v2 6/6] sim/common: Fix issue with wrong byte order on BE targets Message-ID: <20190412202145.GA32284@lianli.shorne-pla.net> References: <20190409213925.32699-1-shorne@gmail.com> <20190409213925.32699-7-shorne@gmail.com> <20190411222749.GB2737@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190411222749.GB2737@embecosm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00153.txt.bz2 Hi Andrew, On Thu, Apr 11, 2019 at 11:27:49PM +0100, Andrew Burgess wrote: > * Stafford Horne [2019-04-10 06:39:25 +0900]: > > > Currently only the OpenRISC sim uses this JOINSIDF() function to compose a > > double float from 2 registers. The old code doesn't seem to work as the > > work order gets swapped when running on a x86_64 host. This change > > fixes that, but I am not sure if its the best thing to do. > > > > On mips they do similar reg pair floating point operations composing > > doubles from 2 32-bit registers in sim/mips/cp1.c value_fpr(). > > > > sim/common/ChangeLog: > > > > * cgen-ops.h (JOINSIDF): Fix big endian check. > > --- > > sim/common/cgen-ops.h | 8 ++------ > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > diff --git a/sim/common/cgen-ops.h b/sim/common/cgen-ops.h > > index 841552066f..d718394723 100644 > > --- a/sim/common/cgen-ops.h > > +++ b/sim/common/cgen-ops.h > > @@ -431,12 +431,8 @@ JOINSIDI (SI x0, SI x1) > > SEMOPS_INLINE DF > > JOINSIDF (SI x0, SI x1) > > { > > - union { SI in[2]; DF out; } x; > > - if (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) > > I think this is the problem with the existing code, we're using memory > on the HOST to perform packing / unpacking, and so its the byte > ordering of the HOST that we care about here, not the target. > > If I change the above line to instead be: > > if (HOST_BYTE_ORDER == BFD_ENDIAN_BIG) > > then everything works fine. > > On inspection I believe all of the uses of CURRENT_TARGET_BYTE_ORDER > in this file should be similarly replaced. > > I've attached a patch for this change. If you agree I'll go ahead and > push it. I tested this with the or1k testsuite and it does seem to work fine, thank you. Please go ahead. I thought I had tried this fix as well, I guess not. -Stafford