Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 2015 10:15:35 -0700
From:      Stanislav Sedov <stas@freebsd.org>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
Subject:   Re: [rfc] fix umul_ppmm() in our libgcc
Message-ID:  <7895DD8F-6165-4EF9-AAE7-098C601470D8@freebsd.org>
In-Reply-To: <CAJ-Vmonsmu5dGtWKhJchzZfSsVUjtwEVSEij4u6kwk64E0ZOXw@mail.gmail.com>
References:  <CAJ-Vmonsmu5dGtWKhJchzZfSsVUjtwEVSEij4u6kwk64E0ZOXw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Jun 13, 2015, at 3:41 PM, Adrian Chadd <adrian@freebsd.org> 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






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7895DD8F-6165-4EF9-AAE7-098C601470D8>