* Re: Multiply Overflow - when to use UMULH
@ 1996-11-24 12:51 Uncle George
0 siblings, 0 replies; 5+ messages in thread
From: Uncle George @ 1996-11-24 12:51 UTC (permalink / raw)
Uncle George wrote:
I try to mult two (possibly) 48 bit integers. Sometimes these nums will
overflow the 64 bit reg. I'd like to know if there is an easy way
to get at the overflow bit.
>From reading the asm manual, you have to wait for the pipeline to
clear, cause an exception, then get the status/overflow bit.
1) whis is faster ?
umul, then umulh ( forget the exception fault )
2) a) umul ( no exception to process )
b) umul -> exception -> do umulh ( only when truely needed )
I have no timeings for instruction sets. I have no timeings for
exception
faults.
I'd really like to test an overflow bit that did not involve an
exception, but that does not seem to be the case with alpha's ( maybe
all risc's )
gat
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Multiply Overflow - when to use UMULH
[not found] <329844BB.670E@voicenet.com>
@ 1996-11-24 17:07 ` Richard Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 1996-11-24 17:07 UTC (permalink / raw)
> From reading the asm manual, you have to wait for the pipeline to
> clear, cause an exception, then get the status/overflow bit.
Eh? There is no overflow bit. There is is no PSW to put one in.
Thus doing umul and umulh sequentially is your only option.
Instruction latency timings are to be found in the respective CPU
Hardware Reference Manuals. But for specific case of umulh, the
ev45 has a general 23 cycle latency (and two special bypases), while
the ev5 has a latency of 14 cycles + 2 if an operand came from Ebox.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Multiply Overflow - when to use UMULH
@ 1996-11-25 1:24 Uncle George
0 siblings, 0 replies; 5+ messages in thread
From: Uncle George @ 1996-11-25 1:24 UTC (permalink / raw)
Richard Henderson wrote:
>
> > From reading the asm manual, you have to wait for the pipeline to
> > clear, cause an exception, then get the status/overflow bit.
>
> Eh? There is no overflow bit. There is is no PSW to put one in.
> Thus doing umul and umulh sequentially is your only option.
>
FROM pg 4-30 Common architecture (i)
4.4.8 Quadword Multiply
MULQ
Exceptions:
Integer Overflow.
Qualifiers:
Integer Overflow Enable /V
so says my alpha architecture manual
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Multiply Overflow - when to use UMULH
[not found] <3298F541.3304@voicenet.com>
@ 1996-11-26 20:05 ` Richard Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 1996-11-26 20:05 UTC (permalink / raw)
> > Eh? There is no overflow bit. There is is no PSW to put one in.
> > Thus doing umul and umulh sequentially is your only option.
>
> FROM pg 4-30 Common architecture (i)
> 4.4.8 Quadword Multiply
[...]
> Qualifiers:
> Integer Overflow Enable /V
That's not nearly the same thing as a PSW overflow bit.
To use that you'd have to catch SIGFPE, decode the instruction to
figure out where the operands are, calculate the overflow bits,
figure out what to do with them such that the mainline will find
it, and find some place to resume execution.
All in all, a grand mess all to save 14 cycles. Thus to even be
considered an option you would want to show that the multiply is
in the center of the processing loop and that operands that would
overflow are exceedingly rare.
If you do decide to go for it, I'd suggest you look at the exception
handling code from the 2.1.x series kernels -- the same sort of
thing could be applied here if the need were demonstrated.
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Multiply Overflow - when to use UMULH
@ 1996-11-26 20:55 David Mosberger
0 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 1996-11-26 20:55 UTC (permalink / raw)
> > > Eh? There is no overflow bit. There is is no PSW to put one in.
> > > Thus doing umul and umulh sequentially is your only option.
> >
> > FROM pg 4-30 Common architecture (i)
> > 4.4.8 Quadword Multiply
> [...]
> > Qualifiers:
> > > Integer Overflow Enable /V
> That's not nearly the same thing as a PSW overflow bit.
> To use that you'd have to catch SIGFPE, decode the instruction to
> figure out where the operands are, calculate the overflow bits,
> figure out what to do with them such that the mainline will find
> it, and find some place to resume execution.
> All in all, a grand mess all to save 14 cycles. Thus to even be
> considered an option you would want to show that the multiply is
> in the center of the processing loop and that operands that would
> overflow are exceedingly rare.
It's even worse: the integer overflow traps are imprecise (like the fp
traps), so, in general, you cannot reliably determine the source of
the exception _unless_ the code has been compiled especially. The
current gcc has support to do so, but I don't think trap support for
integer ops has been done (the gcc backend never generates trapping
integer ops; I suppose the Ada backend might change that, in which
case it might make sense to support this fully).
--david
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1996-11-26 20:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <329844BB.670E@voicenet.com>
1996-11-24 17:07 ` Multiply Overflow - when to use UMULH Richard Henderson
1996-11-26 20:55 David Mosberger
[not found] <3298F541.3304@voicenet.com>
1996-11-26 20:05 ` Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
1996-11-25 1:24 Uncle George
1996-11-24 12:51 Uncle George
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox