From owner-freebsd-mips@FreeBSD.ORG Mon Jun 15 17:15:55 2015 Return-Path: Delivered-To: freebsd-mips@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B0F1F99B; Mon, 15 Jun 2015 17:15:55 +0000 (UTC) (envelope-from stas@freebsd.org) Received: from mx0.deglitch.com (unknown [IPv6:2001:16d8:ff00:19d::2]) by mx1.freebsd.org (Postfix) with ESMTP id 71F058F7; Mon, 15 Jun 2015 17:15:55 +0000 (UTC) (envelope-from stas@freebsd.org) Received: from [192.168.11.8] (unknown [98.248.95.7]) by mx0.deglitch.com (Postfix) with ESMTPSA id 5E7278FC27; Mon, 15 Jun 2015 21:15:45 +0400 (MSK) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: [rfc] fix umul_ppmm() in our libgcc From: Stanislav Sedov In-Reply-To: Date: Mon, 15 Jun 2015 10:15:35 -0700 Cc: "freebsd-mips@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: <7895DD8F-6165-4EF9-AAE7-098C601470D8@freebsd.org> References: To: Adrian Chadd X-Mailer: Apple Mail (2.2098) X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2015 17:15:55 -0000 > On Jun 13, 2015, at 3:41 PM, Adrian Chadd wrote: > > Hi, > > our libgcc in -base is very .. old. It chokes when compiling for > mips32. This patch seems to do the right thing. > > Does anyone have any positive/negative feedback? > > Thanks, > > > -adrian > > > Index: contrib/gcc/longlong.h > =================================================================== > --- contrib/gcc/longlong.h (revision 284090) > +++ contrib/gcc/longlong.h (working copy) > @@ -584,11 +584,11 @@ > > #if defined (__mips__) && W_TYPE_SIZE == 32 > #define umul_ppmm(w1, w0, u, v) \ > - __asm__ ("multu %2,%3" \ > - : "=l" ((USItype) (w0)), \ > - "=h" ((USItype) (w1)) \ > - : "d" ((USItype) (u)), \ > - "d" ((USItype) (v))) > + do { \ > + UDItype __ll = (UDItype)(u) * (v); \ > + w1 = __ll >> 32; \ > + w0 = __ll; \ > + } while (0) > #define UMUL_TIME 10 > #define UDIV_TIME 100 > #endif /* __mips__ */ This looks right to me in terms of functionality, but what is wrong with the original code (multu)? That one seems correct as well. What error do you see when compiling it? -- ST4096-RIPE