* Re: Alpha Assembly Programming
1997-11-06 5:00 ` Antonio Carlini
@ 1997-11-06 5:00 ` John Wilson
1997-11-07 5:00 ` Alan Dartnell
1997-11-11 5:00 ` Antonio Carlini
1997-11-07 5:00 ` Peter L. Montgomery
1 sibling, 2 replies; 16+ messages in thread
From: John Wilson @ 1997-11-06 5:00 UTC (permalink / raw)
In article <63s25m$7v7$1@nntpd.lkg.dec.com>,
Antonio Carlini <carlini@nowhere.you.can.reach.com> wrote:
>|>I am planning to hand code some C programs in assembler on the Alpha
>|>chip. Can anyone point me to any useful resources that I can refer to?
>
>Why? Unless you are doing something that *cannot* be done in C (like
>PALcode) then a compiler is highly likely to do a much better job than
>you will.
WHY can't anyone ever just answer a question like this, without feeling
that it's their job to talk the person out of doing what they want?! Who's
to say this person can't get the hang of doing Alpha instruction scheduling
by hand? And in any case did they even say they expected to do a better
job than the compiler? Maybe they just want to do it for fun. Sheesh...
In any case, for the Alpha the Architecture Handbook is a good place to
start -- depending on the phase of the moon, you might even get it for free
if you figure out whom to ask. You're unlikely to find any real textbooks on
assembly language programming for the newer CPUs because these days everyone
has convinced themselves there's no point. But the data sheets for the
various individual CPU models can provide more detailed information about
semantics, scheduling etc. for those particular CPUs. Note that compilers
generally produce code that's optimized for one particular model at a time.
John Wilson
D Bit
^ permalink raw reply [flat|nested] 16+ messages in thread
* Alpha Assembly Programming
@ 1997-11-06 5:00 teletan
1997-11-06 5:00 ` Antonio Carlini
1997-11-18 5:00 ` Alpha Assembly Programming Hoff Hoffman
0 siblings, 2 replies; 16+ messages in thread
From: teletan @ 1997-11-06 5:00 UTC (permalink / raw)
Hi all,
I am planning to hand code some C programs in assembler on the Alpha
chip. Can anyone point me to any useful resources that I can refer to?
Thanks!
Pls mail your respond directly to me as I do not frequent this
newsgroup.
Tele
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-06 5:00 Alpha Assembly Programming teletan
@ 1997-11-06 5:00 ` Antonio Carlini
1997-11-06 5:00 ` John Wilson
1997-11-07 5:00 ` Peter L. Montgomery
1997-11-18 5:00 ` Alpha Assembly Programming Hoff Hoffman
1 sibling, 2 replies; 16+ messages in thread
From: Antonio Carlini @ 1997-11-06 5:00 UTC (permalink / raw)
In article <34622F8E.7529@dso.org.sg>, teletan@dso.org.sg writes:
|>Hi all,
|>
|>I am planning to hand code some C programs in assembler on the Alpha
|>chip. Can anyone point me to any useful resources that I can refer to?
Why? Unless you are doing something that *cannot* be done in C (like
PALcode) then a compiler is highly likely to do a much better job than
you will.
|>
|>Pls mail your respond directly to me as I do not frequent this
|>newsgroup.
|>
|>Tele
|>
--
Antonio Carlini Mail: carlini@marvin.enet.dec.com
DECnet-Plus for OpenVMS Engineering
Digital Equipment Corporation Worton Grange, Reading, England
(Reply-To: address mangled in header)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-06 5:00 ` John Wilson
@ 1997-11-07 5:00 ` Alan Dartnell
1997-11-11 5:00 ` Antonio Carlini
1 sibling, 0 replies; 16+ messages in thread
From: Alan Dartnell @ 1997-11-07 5:00 UTC (permalink / raw)
In article <34621aeb.0@news.wizvax.net>, wilson@dbit.com says...
>In any case, for the Alpha the Architecture Handbook is a good place to
>start -- depending on the phase of the moon, you might even get it for free
>if you figure out whom to ask.
>
>John Wilson
>D Bit
Definately for free from
http://ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.h
tml#alpha
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-06 5:00 ` Antonio Carlini
1997-11-06 5:00 ` John Wilson
@ 1997-11-07 5:00 ` Peter L. Montgomery
1997-11-13 5:00 ` Burkhard Neidecker-Lutz
1 sibling, 1 reply; 16+ messages in thread
From: Peter L. Montgomery @ 1997-11-07 5:00 UTC (permalink / raw)
In article <63s25m$7v7$1@nntpd.lkg.dec.com>
carlini@nowhere.you.can.reach.com writes:
>In article <34622F8E.7529@dso.org.sg>, teletan@dso.org.sg writes:
>|>I am planning to hand code some C programs in assembler on the Alpha
>|>chip. Can anyone point me to any useful resources that I can refer to?
>
>Why? Unless you are doing something that *cannot* be done in C (like
>PALcode) then a compiler is highly likely to do a much better job than
>you will.
Using the cc and f90 compilers now present on Digital UNIX
systems, how does one access UMULH (upper half of unsigned integer
multiply)? How about the IEEE floating point instructions with
rounding mode explicitly specified? Do the compilers use the
FETCH instruction when we are reading/writing a big array?
On the 21264, how will we access the population count
and leading/trailing zero count instructions from Fortran and C?
Inline code is desired for all of these.
--
Peter L. Montgomery pmontgom@cwi.nl San Rafael, California
A mathematician whose age has doubled since he last drove an automobile.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
@ 1997-11-08 5:00 Robert Harley
0 siblings, 0 replies; 16+ messages in thread
From: Robert Harley @ 1997-11-08 5:00 UTC (permalink / raw)
pmontgom@cwi.nl (Peter L. Montgomery) writes:
> Using the cc and f90 compilers now present on Digital UNIX
>systems, how does one access UMULH (upper half of unsigned integer
>multiply)? [...]
In C:
#include <c/asm.h>
p = asm("umulh %a0, %a1, %v0", x, y);
or perhaps:
#include <machine/builtins.h>
p = __UMULH(x, y);
Then again you might prefer int_mul_upper().
>On the 21264, how will we access the population count
>and leading/trailing zero count instructions from Fortran and C?
l1 = _popcnt(a);
l2 = _leadz(a);
l3 = _trailz(a);
>Inline code is desired for all of these.
And is produced, even for 21164, by recent versions of the C compiler.
-- Rob.
PS: Beware those who will jump down your throat for using stuff that
isn't in their favorite "standard".
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
@ 1997-11-09 5:00 Robert Harley
0 siblings, 0 replies; 16+ messages in thread
From: Robert Harley @ 1997-11-09 5:00 UTC (permalink / raw)
harley@pauillac.inria.fr (yours truly) wrote:
> #include <c/asm.h>
It should be <c_asm.h>. Sorry about that.
-- Rob.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-06 5:00 ` John Wilson
1997-11-07 5:00 ` Alan Dartnell
@ 1997-11-11 5:00 ` Antonio Carlini
1 sibling, 0 replies; 16+ messages in thread
From: Antonio Carlini @ 1997-11-11 5:00 UTC (permalink / raw)
In article <34621aeb.0@news.wizvax.net>, wilson@dbit.com (John Wilson) writes:
|>In article <63s25m$7v7$1@nntpd.lkg.dec.com>,
|>Antonio Carlini <carlini@nowhere.you.can.reach.com> wrote:
|>>|>I am planning to hand code some C programs in assembler on the Alpha
|>>|>chip. Can anyone point me to any useful resources that I can refer to?
|>>
|>>Why? Unless you are doing something that *cannot* be done in C (like
|>>PALcode) then a compiler is highly likely to do a much better job than
|>>you will.
|>
|>WHY can't anyone ever just answer a question like this, without feeling
|>that it's their job to talk the person out of doing what they want?! Who's
|>to say this person can't get the hang of doing Alpha instruction scheduling
|>by hand? And in any case did they even say they expected to do a better
|>job than the compiler? Maybe they just want to do it for fun. Sheesh...
Doing assembler on a modern RISC CPU is not quit the same as when I was hacking
on a Z80 or 68000. He obviously has the routines available in C, so I can only
presume that he wants the stuff to run faster. Why else take an existing HLL
routine and rewrite in assembler?
With enough effort he can get the hang of EV4 instruction scheduling, and
then learn about how EV5 scheduling. EV6 is going to hit the streets soon -
out of order execution should keep him busy for a while!
So I'm not trying to talk him out of it: I'm just pointing out that if his
intention is to make it go faster by coding "nearer the hardware" then perhaps
he should reconsider. If he just wants to know more about the chip then that's
fine (laudable even). And yes, assembler can be fun in small doses :-)
|>
|>In any case, for the Alpha the Architecture Handbook is a good place to
|>start -- depending on the phase of the moon, you might even get it for free
|>if you figure out whom to ask. You're unlikely to find any real textbooks on
|>assembly language programming for the newer CPUs because these days everyone
|>has convinced themselves there's no point. But the data sheets for the
|>various individual CPU models can provide more detailed information about
|>semantics, scheduling etc. for those particular CPUs. Note that compilers
|>generally produce code that's optimized for one particular model at a time.
|>
The Alpha Architecture Handbook is available at:
http://ftp.europe.digital.com/pub/digital/DECinfo/semiconductor/
literature/alphahb2.pdf
(that's one URL)
and the Digital Unix Assembly Language Programmer's Guide will help too.
Other than that I don't know of any resources.
--
Antonio Carlini Mail: carlini@marvin.enet.dec.com
DECnet-Plus for OpenVMS Engineering
Digital Equipment Corporation Worton Grange, Reading, England
(Reply-To: address mangled in header)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-07 5:00 ` Peter L. Montgomery
@ 1997-11-13 5:00 ` Burkhard Neidecker-Lutz
1997-11-15 5:00 ` David Coote
0 siblings, 1 reply; 16+ messages in thread
From: Burkhard Neidecker-Lutz @ 1997-11-13 5:00 UTC (permalink / raw)
In article <EJAAHp.10B@cwi.nl> pmontgom@cwi.nl (Peter L. Montgomery) writes:
> Using the cc and f90 compilers now present on Digital UNIX
>systems, how does one access UMULH (upper half of unsigned integer
>multiply)?
Have a look at /usr/sys/include/arch/alpha/builtins.h. For
UMULH it would be:
unsigned long __UMULH(unsigned long __oper1,
unsigned long __oper2);
How about the IEEE floating point instructions with
>rounding mode explicitly specified?
Don't know.
>Do the compilers use the
>FETCH instruction when we are reading/writing a big array?
No. Since FETCH needs to support from the system (the 21064 and
21164 just send them off-chip) they aren't terribly useful in
any currently shipping system. The compilers *do* use the prefetch
instructions that have been added to the Alpha architecture with the
introduction of the 21164 and up (i.e. loads to R31 and F31).
>On the 21264, how will we access the population count
>and leading/trailing zero count instructions from Fortran and C?
Similar to UMULH, but not in current cc and f90 compilers since there
are no current operating system releases for 21264 machines. Expect
to see something akin to the other builtins there.
Burkhard Neidecker-Lutz
CEC Karlsruhe , European Applied Research Center, Digital Equipment Corporation
email: neideck@kar.dec.com
"9 of the 10 most loaded Web sites run on Digital Unix and 72 of the top 100..."
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-13 5:00 ` Burkhard Neidecker-Lutz
@ 1997-11-15 5:00 ` David Coote
1997-11-15 5:00 ` "Assembly Language Programer's Guide" Was:(Alpha Assembly Programming) spam
0 siblings, 1 reply; 16+ messages in thread
From: David Coote @ 1997-11-15 5:00 UTC (permalink / raw)
>>Do the compilers use the
>>FETCH instruction when we are reading/writing a big array?
>
>No. Since FETCH needs to support from the system (the 21064 and
>21164 just send them off-chip) they aren't terribly useful in
>any currently shipping system. The compilers *do* use the prefetch
>instructions that have been added to the Alpha architecture with the
>introduction of the 21164 and up (i.e. loads to R31 and F31).
Now I'm confused. I thought FETCH is the pre-fetch instruction. That's
what the Architecture Handbook says. Is the instruction useful or not on
currently shiping boxes? Lets say 4100's running multiple EV56 CPU's at
466MHz, hypothetically :)
^ permalink raw reply [flat|nested] 16+ messages in thread
* "Assembly Language Programer's Guide" Was:(Alpha Assembly Programming)
1997-11-15 5:00 ` David Coote
@ 1997-11-15 5:00 ` spam
0 siblings, 0 replies; 16+ messages in thread
From: spam @ 1997-11-15 5:00 UTC (permalink / raw)
Hello,
I was going through my bookmarks in navigator when I remembered I had
this link.... It's called "Assembly Language Programmer's Guide".
It's an manual with *I think* all (haven't checked) Alpha asm
instructions.
Discription from that site: "This manual describes the assembly
language supported by the Digital UNIX Alpha compiler system, it's
syntax rules, and how to write some assembly programs" I've never
seen this site mentioned here so.... here it is:
http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/Digital_UNIX/V4.0/AA-PS31D-TET1_html/TITLE.html
I hope the link comes up correctly on your reader, it kinda long.
Anyways, Have fun! :)
Mike.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-06 5:00 Alpha Assembly Programming teletan
1997-11-06 5:00 ` Antonio Carlini
@ 1997-11-18 5:00 ` Hoff Hoffman
1997-11-18 5:00 ` John Wilson
1 sibling, 1 reply; 16+ messages in thread
From: Hoff Hoffman @ 1997-11-18 5:00 UTC (permalink / raw)
In article <34622F8E.7529@dso.org.sg>, teletan@dso.org.sg writes:
:I am planning to hand code some C programs in assembler on the Alpha
:chip.
Why? Performance? If so, please profile the code before deciding
to move it to Alpha Macro64. This will help you decide if tuning
the assembler code by hand is worthwhile -- or the "hot" code is
somewhere else.
If you working in an "imbedded" code application, then I would expect
you would be able to get C code to compile and run directly on the
Alpha microprocessor -- there are varying levels of software support
one can get when running on a platform, ranging from completely
standalone code, to running in a standalone environment package, to
running on top of a fully-functional multi-user operating system.
--
I am here ignoring Macro32 -- also known as VAX Macro -- as that
language is implemented as a compiler -- not an assembler -- on
OpenVMS Alpha systems, and does not appear to fit as a language
target for a port from C.
:Can anyone point me to any useful resources that I can refer to?
Well, the Macro64 documentation would certainly likely be helpful.
And the Alpha Architecture Reference Manual would also be useful.
If interested, I suspect the folks over at Global Knowledge Network
(GKN) may have some educational courses and materials for Macro64
programmers available for purchase. For information, please check
the http://www.globalknowledge.com website.
:Pls mail your respond directly to me as I do not frequent this
:newsgroup.
Ask here, get an answer here.
-------------------------- pure personal opinion ---------------------------
Hoff (Stephen) Hoffman OpenVMS Engineering h*ffman@xdelta.enet.dec.c*m
headers and addresses munged to avoid automated spammers: junk-e-mail
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-18 5:00 ` Alpha Assembly Programming Hoff Hoffman
@ 1997-11-18 5:00 ` John Wilson
1997-11-18 5:00 ` Ben Carter
0 siblings, 1 reply; 16+ messages in thread
From: John Wilson @ 1997-11-18 5:00 UTC (permalink / raw)
In article <64st2u$h2g@usenet.pa.dec.com>,
Hoff Hoffman <hoffman@xdelta.zko.dec.nospam> wrote:
>In article <34622F8E.7529@dso.org.sg>, teletan@dso.org.sg writes:
>:I am planning to hand code some C programs in assembler on the Alpha
>:chip.
>
> Why? Performance? If so, please profile the code before deciding
> to move it to Alpha Macro64. This will help you decide if tuning
> the assembler code by hand is worthwhile -- or the "hot" code is
> somewhere else.
Geez, AGAIN with the unsolicited commentary on whether the person should
use the language they want to. Sure it's possible to write slow code in
assembly, but there are plenty of other languages that *guarantee* slow
code, yet it's possible to ask questions about programming in those languages
w/o people immediately telling you not to bother.
John Wilson
D Bit
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-18 5:00 ` Ben Carter
@ 1997-11-18 5:00 ` John Wilson
1997-11-19 5:00 ` Antonio Carlini
0 siblings, 1 reply; 16+ messages in thread
From: John Wilson @ 1997-11-18 5:00 UTC (permalink / raw)
In article <3471C5D8.3248F7C0@pitt.edu>,
Ben Carter <cecropia+@pitt.edu> wrote:
> I got some unsolicited advice the other day when I asked a question
> about replacing the crankshaft pulley on my car. The advice was,
> if you reach the torque specification, stop TQing because you can
> easily strip the threads on your crankshaft. I was glad the guy
> gave me the advice.
Yeah well that's different from them telling you not to bother putting the
crankshaft pulley on yourself because you couldn't possibly be qualified,
and/or there's no conceivable reason why you'd want to do it when there
are trained mechanics everywhere ready to do it for you. The person was
just telling you how to do it right. Most drivers in the world have
convinced themselves that they're much better off paying some two-faced
grease monkey $55/hour to pretend to fix their car rather than learning to
do it themselves, even though you and I both know that at least one of
{better job, more satisfying, done sooner} is true if we fix it ourselves,
after putting some effort into really getting the hang of it rather than
complaining about how unpleasant it is and why would anyone ever do this
for fun. Not so different from assembly language programming...
John Wilson
D Bit
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-18 5:00 ` John Wilson
@ 1997-11-18 5:00 ` Ben Carter
1997-11-18 5:00 ` John Wilson
0 siblings, 1 reply; 16+ messages in thread
From: Ben Carter @ 1997-11-18 5:00 UTC (permalink / raw)
:: Why? Performance? If so, please profile the code before deciding
:: to move it to Alpha Macro64. This will help you decide if tuning
:: the assembler code by hand is worthwhile -- or the "hot" code is
:: somewhere else.
:
: Geez, AGAIN with the unsolicited commentary on whether the person
should
: use the language they want to. Sure it's possible to write slow code
in
: assembly, but there are plenty of other languages that *guarantee*
slow
: code, yet it's possible to ask questions about programming in those
languages
: w/o people immediately telling you not to bother.
:
: John Wilson
: D Bit
Yes, but you'll notice that this unsolicited commentary comes
only with assembly and with very good reason: most people don't
realize that there is (usually) no advantage to programming a
piece of code in assembly. On the VAX architecture, it very
often was worthwhile for performance reasons to code in assembly,
but on the Alphas that's not usually true for most people and
there are many disadvantages.
Stephen is just giving good advice here.
I got some unsolicited advice the other day when I asked a question
about replacing the crankshaft pulley on my car. The advice was,
if you reach the torque specification, stop TQing because you can
easily strip the threads on your crankshaft. I was glad the guy
gave me the advice.
Ben Carter
cecropia+@pitt.edu
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Alpha Assembly Programming
1997-11-18 5:00 ` John Wilson
@ 1997-11-19 5:00 ` Antonio Carlini
0 siblings, 0 replies; 16+ messages in thread
From: Antonio Carlini @ 1997-11-19 5:00 UTC (permalink / raw)
In article <34721908.0@news.wizvax.net>, wilson@dbit.com (John Wilson) writes:
|>In article <3471C5D8.3248F7C0@pitt.edu>,
|>Ben Carter <cecropia+@pitt.edu> wrote:
|>> I got some unsolicited advice the other day when I asked a question
|>> about replacing the crankshaft pulley on my car. The advice was,
|>> if you reach the torque specification, stop TQing because you can
|>> easily strip the threads on your crankshaft. I was glad the guy
|>> gave me the advice.
|>
|>Yeah well that's different from them telling you not to bother putting the
|>crankshaft pulley on yourself because you couldn't possibly be qualified,
|>and/or there's no conceivable reason why you'd want to do it when there
|>are trained mechanics everywhere ready to do it for you. The person was
|>just telling you how to do it right. Most drivers in the world have
|>convinced themselves that they're much better off paying some two-faced
|>grease monkey $55/hour to pretend to fix their car rather than learning to
|>do it themselves, even though you and I both know that at least one of
|>{better job, more satisfying, done sooner} is true if we fix it ourselves,
|>after putting some effort into really getting the hang of it rather than
|>complaining about how unpleasant it is and why would anyone ever do this
|>for fun.
And I thought this thread had died :-)
Neither Steve nor I told the guy that he shouldn't do it because there were
people better qualified to do the job. We told him he *probably* shouldn't
do it because there are machines much better qualified to do the job ..
different situation altogether!
Most of the "how do I convert <x> from <language> to Alpha assembler" requests
I have seen tend to boil down to "how do I make this go faster". In all these
case I have seen the answer is either "use a better algorithm" or
"use a better compiler". This advice falls (IMHO) into the "you might want to
know before you start that you need special tools to finish the job" category.
Just a simple warning.
Now if later on he comes back and asks how to time intervals to nanosecond
resolution on an Alpha, I think you'll find he gets an answer. But since
the original question was along the lines I suggested earlier, then a simple
warning that he may be in for a steep learning curve before he ends up not much
further along than he was, seems appropriate.
|>for fun. Not so different from assembly language programming...
Different kettle of fish entirely.
Antonio
--
Antonio Carlini Mail: carlini@marvin.enet.dec.com
DECnet-Plus for OpenVMS Engineering
Digital Equipment Corporation Worton Grange, Reading, England
(Reply-To: address mangled in header)
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~1997-11-19 5:00 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-11-06 5:00 Alpha Assembly Programming teletan
1997-11-06 5:00 ` Antonio Carlini
1997-11-06 5:00 ` John Wilson
1997-11-07 5:00 ` Alan Dartnell
1997-11-11 5:00 ` Antonio Carlini
1997-11-07 5:00 ` Peter L. Montgomery
1997-11-13 5:00 ` Burkhard Neidecker-Lutz
1997-11-15 5:00 ` David Coote
1997-11-15 5:00 ` "Assembly Language Programer's Guide" Was:(Alpha Assembly Programming) spam
1997-11-18 5:00 ` Alpha Assembly Programming Hoff Hoffman
1997-11-18 5:00 ` John Wilson
1997-11-18 5:00 ` Ben Carter
1997-11-18 5:00 ` John Wilson
1997-11-19 5:00 ` Antonio Carlini
-- strict thread matches above, loose matches on Subject: below --
1997-11-08 5:00 Robert Harley
1997-11-09 5:00 Robert Harley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox