Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Alpha: sign extend long
@ 1995-07-23  4:00 Steve Peltz
  1995-07-24  4:00 ` Carl J. Appellof
  1995-07-25  4:00 ` Peter Sherwood
  0 siblings, 2 replies; 3+ messages in thread
From: Steve Peltz @ 1995-07-23  4:00 UTC (permalink / raw)


It looks to me as if it would be faster to sign-extend a longword by
doing a "addl $x, $31, $y" instead of the sequence used in at least
the "intended sequence for loading and sign-extending a longword from
unaligned address", which is to do "sll $x, #32, $y", then "sra $y, #32, $y".

Is there something about the addl that makes it slower than two shifts, or
some other reason not to do that? Or am I totally confused about addl? Of
course, you could use subl instead of addl, it should be same speed, I'd
guess.

Does an addl/subl take longer than an addq/subq?

Obviously, the answers to both questions are implementation dependent...I'm
interested in both intended code sequences and current implementations.
-- 
Steve Peltz
tricorn@uiuc.edu



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Alpha: sign extend long
  1995-07-23  4:00 Alpha: sign extend long Steve Peltz
@ 1995-07-24  4:00 ` Carl J. Appellof
  1995-07-25  4:00 ` Peter Sherwood
  1 sibling, 0 replies; 3+ messages in thread
From: Carl J. Appellof @ 1995-07-24  4:00 UTC (permalink / raw)



peltz@cerl.uiuc.edu (Steve Peltz) wrote:
>It looks to me as if it would be faster to sign-extend a longword by
>doing a "addl $x, $31, $y" instead of the sequence used in at least
>the "intended sequence for loading and sign-extending a longword from
>unaligned address", which is to do "sll $x, #32, $y", then "sra $y, #32, $y".

The cc compiler on Digital UNIX uses "addl $x, $31, $y" when
you do

    int myint;
    unsigned int myuint;

    myint = (int)myuint;


I've never seen it use sll/sra.

-- 
Carl Appellof
not speaking for
Digital Equipment Corporation





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Alpha: sign extend long
  1995-07-23  4:00 Alpha: sign extend long Steve Peltz
  1995-07-24  4:00 ` Carl J. Appellof
@ 1995-07-25  4:00 ` Peter Sherwood
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Sherwood @ 1995-07-25  4:00 UTC (permalink / raw)


Steve Peltz (peltz@cerl.uiuc.edu) wrote:
: It looks to me as if it would be faster to sign-extend a longword by
: doing a "addl $x, $31, $y" instead of the sequence used in at least
: the "intended sequence for loading and sign-extending a longword from
: unaligned address", which is to do "sll $x, #32, $y", then "sra $y, #32, $y".

ADDL R31,Rx,Ry is given in Appendix A of the Alpha Architecture Reference
Manual as the code for the pseudo-op SEXTL (longword sign-extension of Rx
storing results in Ry).

-----------------------------------------------------------------------------
Peter Sherwood
(617) 332-8880 (voice)
(617) 969-2101 (fax)
gbcacm@ccs.neu.edu
-----------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-07-25  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-07-23  4:00 Alpha: sign extend long Steve Peltz
1995-07-24  4:00 ` Carl J. Appellof
1995-07-25  4:00 ` Peter Sherwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox