Re: [RFC PATCH] MIPS: optimise 32-bit do_div() with constant divisor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Daney <ddaney.cavm@xxxxxxxxx> writes:

> On 11/07/2014 07:00 AM, Måns Rullgård wrote:
> [...]
>>
>>> As for access to hi/lo, I tried to explicitly put a variable in the lo
>>> register.  Which sort of works for very simple cases but as expected it's
>>> easy to get GCC to spill its RTL guts because it runs out of spill
>>> registers.  It maybe can be made to work but I'd feel nervous about its
>>> stability unless a GCC guru approved this method.
>>
>> The "x" constraint can be used to move a double-word to/from the hi/lo
>> registers.  On DSP targets, the "ka" constraint provides access to the
>> three additional hi/lo pairs while on a non-DSP targets it degenerates
>> to "x".  The "ka" constraint is available since gcc 4.3.0.  I see no
>> reason not to allow this extra flexibility.
>
> What would the performance penalty be to hand code the assembly so
> that only mips32 instructions are used (i.e. no MADD), and transfers
> from hi/lo were all explicitly coded so that there were no hi/lo
> register constraints, but only clobbers of "hi", "lo"?

It's hard to say in absolute numbers.  However, the pre-mips32
equivalent of MADDU looks something like this:

        multu   $4, $5
        mflo    $6
        mfhi    $7
        addu    $8, $8, $6
        addu    $9, $9, $7
        sltu    $6, $8, $6
        addu    $9, $9, $6

-- 
Måns Rullgård
mans@xxxxxxxxx





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux