Re: MIPS patch for gcc 4.4

Felix von Leitner <[email protected]> Wed, 9 Feb 2011 05:05:43 +0100
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Thus spake snf ([email protected]):
> As gcc >= 4.4 doesn't support anymore "=h" while inlining asm(mips), I
> have changed the code for a pure-c one.

> refs:
> http://www.gnu.org/software/gcc/gcc-4.4/changes.html
> http://gcc.gnu.org/viewcvs/trunk/gcc/longlong.h?view=markup

> snf
> - --
> - --- dietlibc-0.32/longlong.h    2004-08-12 09:51:36.000000000 -0300
> +++ ../dietlibc-0.32/longlong.h    2011-02-08 17:37:52.772484001 -0300
> @@ -577,12 +577,22 @@
>  #endif /* __m88000__ */
>  
>  #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)))
> +*/
> +#define umul_ppmm(w1, w0, u, v) \
> +  do {                                    \
> +  UDItype _r;                                 \
> +  _r = (UDItype) (USItype) (u) * (USItype) (v);            \
> +  (w1) = (USItype) (_r >> 32);                        \
> +  (w0) = (USItype) _r;                            \
> +  } while (0)
> +
>  #define UMUL_TIME 10
>  #define UDIV_TIME 100
>  #endif /* __mips__ */

Uh, does that actually work?  I was expecting that that code would
generate a call to exactly this function.  Because the idea of that
function is to be there so gcc can emit code that calls it if you write
code like that in C.

Felix