From: Heggli Beat (
Date: Sat Mar 25 1995 - 09:59:52 CST


Great response to my question. 20 Answers I got!
My original question was:

> I have a student here, saying his Sun is to slow and
> that he would like to start writing assembler code.
> Now it's on me to find a reference manual and a
> tutorial. I can't find anything in the man pages
> and the answerbook. Could you point me to
> SPARC assembler literature or a publisher who
> has this kind of literature.

The last time I did some C programming was back in school
some years ago like: cc -o test test.c
So I am not in the position to give any comments to the
received answers.
But I got to the conclusion that it's not worth going
into writing assembler code only for speed reasons an so
did "my" student.

Responses following:

1) tell him to forget it, writing SPARC assembly code is not the same as
   writing IBMPC assembly code. I would suggest getting a good optimizing
   C compiler.
   Boyd Fletcher

2) Well this is probably not what you (or your user) want to hear, but do
   you have good reason to believe that assembly code will be worth the
   effort? Modern compilers are pretty smart and RISC chips can be very
   hard to write hand assembly for. You need to be fairly experienced to
   beat the compiler. I'd only consider it for one or two small routines
   where, for some reason, the compiled code seemed to be substatially
   short of the performance you expect. Otherwise it's just a huge waste
   of time.
   James Ashton

3) Try SPARC v8 Archictecture book, and/or the SPARC assembler manual that
   comes with the Solaris documentation set.
   Greg Price

4) This doesn't answer your question directly, but:

   If you really have a student who can write SPARC
   assembly code that's significantly faster than the
   a.out's produced by well written c source, please
   send me his/her resume!
   Anthony W. Orr

5) it's in the Solaris 1.1.1 answerbook:
   Developer's Set
   ---> Driver and Assembler
   --------> Sun4 Assembly language
   Danny Johnson

6) The assembler is called: as

   And there is a reference manuel that comes with the developer's
   problem is that I have offloaded the entire distribution, INCLUDING the
   developer's set and answerbook cannot find it?????

   Any way there is a man page on as
   Gene Loriot

7) The only thing I have seen in SPARC Assembly Language Reference
   available through Sun and the SPARC International.


   Also, according to "Books in Print"

   Richard Paul
   SPARC Architecture Assembly Language Programming and C
   ISBN 0138768897
   Publisher: P-H Gen Ref & Trav 01/1994
   Dave Fetrow

8) Gruetzi!

>> Comment: This is no password or so but just the way german
>> speaking Swiss say hello.

   Your student is crazy ... A modern optimising C compiler can do a much
   better job of writing efficient assembler code for the Sparc architecture
   than he/she ever could ...

   But if he/she insists ...

   Sun-4 Assembly Language Reference

   is the name of the guide, should be available thru your Sun rep.
   Reto Lichtensteiger

9) The SPARC reference manual (available at computer stores, or even from
   Sun for all I know) has all of this.

   I would remind your student that trying to generate properly scheduled
   RISC instructions by hand is a) non-trivial and b) changes from machine
   to machine as the load/store/delay penalties change.

   Has he used the compiler optimization flags to any effect??
   Kevin Sheehan

10) There is a Assembly Language Reference Manual for SPARC (both printed and
    AnswerBook format) supplied by Sun. It is not very big. I believe it comes
    with the Software Developers Kit (an extra cost option, not bundled with Solaris
    Robert P. Weaver

11) No Pointers that I could pass to you, but I've been talking with s/o
    who did Assembler on SPARCs. I actually weren't able to understand
    everything he said :-C, but the Base Line is that SPARC Assembler is
    pretty complex; You need to watch for Timing and Dependency Relations
    between "close" Commands that a "what Registers does this affect?"-
    Type Programmer wouldn't dream up in his Nightmares. If the Problem
    is Speed, I'ld say that programming C with a decent Compiler is the
    Way to go. (Don't forget that "-O4" or whatever the Max Opt Level is. ;-)
    Jochen Bern

12) If you're looking for a good book on SPARC Assembler--I wouldn't recommend
    the SPARC Architecture reference manual. It's exactly that--a reference

    Here's my recommendation:
    SPARC Architecture, Assembly Language Programming, & C
    Richard Paul
    Prentice Hall
    ISBN 0-13-876889-7
    It's written for people who know C pretty well, but don't know a thing
    about SPARC architecture. It has a pretty good reference section, and has
    exercises at the end of each chapter (if you're into that sort of thing).
    Michael Neuman

13) Emmm...
    too slow for what?

    Examine the language you are using first
    (is it appropriate)
    Then use performance analysis tools (call profiling etc)

    Also look at memory usage - is it paging constantly or running
    low on memory?

    There is an EXCELLENT Oreilly book on high performance
    computing, how to optimise loops, loop order etc. etc.

    I would put money on the fact that your user does not need assembler.
    He or she needs to examine their present code and
    machine resources.

    Re. SPARC assemblers, as I recall the Sparc architecture
    is described in the early, large ring bound Sparc manuals.
    Which manuals do you have?

    By the way, where is htl-bw?

>> Comment: htl-bw means Hoehere Technische Lehranstalt Brugg-Windisch
    John Hearns

14) Mmmmm. My SunOS 4.1.1 Programmers Language guide contains a section of 25 pages with
    Sun-4 Assembly language reference.

    Also My Soilaris 2.2/SunOS 5.2 Docuset has a small book called SunOS 5.X SPARC
    Assembly Language Reference Manual

    One of our programmers here used it for a bit array comparision and shift
    assembly routine.
    Marcel A. Bernards

15) I only know the following book:

    The SPARC Architecture Manual, Version 8
    SPARC International
    Prentice Hall, 1992
    ISBN 0-13-825001-4

    I have never used it, but a friend of mine used it to implement a locking
    mechanis for shared variables. He had no problems to do it.
    Torsten Metzner

16) Switching to assembly isn't going to give him a significant, or even a
    noticeable performance boost if he's comparing with a really good
    optimizing compiler like GCC 2.5 and up. And if he's not using a good
    optimizing compiler, he should upgrade to one ASAP.
    Richard Pieri

17) It is on the /opt/SUNWspro/SPROabsp1, you must have purchased Sparcworks etc.
    development tool. After I tried the assembler, it does not seem much faster
    than the sparc c compiler with -xO3 or -xO4 switchs on.
    Ningping Fan

18) The SPARC Architecture Manual , Verison 8
    By: David L. Weaver / Tom Germond

    SPARC International, Inc.
    535 Middlefield Road, Suite 210
    Menlo Park, California 94025
    415 321-8692

    ISBN: 0-13-099227-5
    Yves Morin

19) The answer to your question is that in the Solaris 2.x Software Developer
    Answerbook there is a manual called the Assembly Language Reference manual for
    John Waterhouse

20) if the student thinks the machine is slow, switching to assembler
    is not likely to improve performance (except in a very few cases).
    if you are switching from using semaphores to using user-level
    locking with atomic instructions, yes, you'll do better with
    assembler. if you think you can out-do the compiler, it's rare.

    you'd do better to find out where the performance problem is
    and address it or at least identify it to the student.

    if the student really wants to go write assembler code, get
    "The SPARC V8 Architecture Manual", whcih is a start. also
    get "Writing SPARC assembly code" from the Solaris 2.x manual
    set (2.3 and later)
    Hal Stern
>> Comment: Hey are you the Hal Stern who wrote "Managing NFS and NIS" ??
>> If so: god book, helped me a lot.

all done

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:20 CDT