> It's better than the generic branch sequence below, or yours.  It still
> sucks, obviously.

OK, I thought you were talking about the double-width result.  The non-branch 
sequence I posted is the generic non-branch sequence (that Ada was using).

> Let's see.  Completely untested.  Inputs in regs 3 and 4, output in reg 3.
> 32-bit code all the way.
> 
> add:
>       eqv 9,3,4
>       add 3,3,4
>       xor 4,3,4
>       and. 4,9,4
>       blt <overflow>
> 
> sub:
>       xor 9,3,4
>       sub 3,3,4
>       eqv 4,3,4
>       and. 4,9,4
>       blt <overflow>

These ones (if correct) are quite better than the generic code!

> neg:
>       neg 3,3
>       xoris. 9,3,0x8000
>       beq <overflow>
> 
> mul:
>       mulhw 9,3,4
>       mullw 3,3,4
>       srawi 4,9,31
>       cmpw 4,9
>       bne <overflow>

These ones are essentially equivalent to the generic code.

-- 
Eric Botcazou

Reply via email to