Article View: comp.lang.asm370
Article #705Re: Postholes
From: news
Date: Thu, 18 Apr 1991 19:12
Date: Thu, 18 Apr 1991 19:12
83 lines
4974 bytes
4974 bytes
campbell@redsox.bsw.com (Larry Campbell) writes:
>Why is it (he wonders out loud) that the only machines on which people still
>(in this day and age) seem to use assembly language are IBM 360s?
There is programming on IBM PC's.
>I can't remember who said this, but it's apropos: "Programming in assembly
>language is like digging postholes with a teaspoon. Sure, it takes longer,
>but you have complete control over every spoon of dirt."
It depends on WHAT KIND OF HOLE you are digging. A posthole is NOT an
appropriate kind of hole to use a teaspoon on, but an archeological dig
could be.
I'm not saying that ALL uses of assembler are appropriate, but some are.
>Is it just because IBM doesn't ship any decent compilers? I mean, what
>am I missing? Why do people put up with this stuff?
In many cases the compilers generate far less than optimal code for an
application where speed is essential (loops that run billions of times).
In other cases the provided high level language libraries are deficient.
I notice that very very little assembler language programming is done on
UNIX systems. In part this is due to the fact that UNIX makes it easy to
do system level functions in C and other languages. But there is also the
draw to make a program portable and that draw is enhanced by the fact that
it really is easy to do within UNIX platforms. When developing code for
VM/CMS or MS-DOS, for instance, you know the assembler code is going to work
on the intended platforms anyway. I believe it is a combination of poor
compilers, poor run time libraries, and weak operating systems.
For instance a couple years ago I was experimenting with the Mandlebrot set.
I wrote the iteration in FORTRAN and had it optimized. I looked at the
code it generated and saw it using an excess of load and store operations
that I was sure were not needed. So I tried to code it entirely in registers.
It was not that easy because as it turned out, the results from one iteration
resulted in a couple of the values transposed in a pair of registers. But I
just simply coded a pair of interations with the second one working with the
registers swapped in context. Here is the code I wrote for the Mandelbrot
set power raising loop. All intermediate values are in registers and the
memory references that are present are just contants. The code ran about
twice as fast as that generated by the FORTRAN VS compiler with optimization
(which suggests that registers are still faster than cache).
ITERATE DS 0H <<< here to iterate one point
***********************************************************************
LDR FPR4,FPR2 y
MDR FPR4,FPR0 x*y
ADR FPR4,FPR4 2*x*y
AD FPR4,Q Y = 2*x*y + Q
MDR FPR0,FPR0 x**2
MDR FPR2,FPR2 y**2
LDR FPR6,FPR0 (x**2)
ADR FPR6,FPR2 (x**2+y**2)
CD FPR6,ESC diverging?
BCR HIGH,R7 yes -->
SDR FPR0,FPR2 x**2 - y**2
AD FPR0,P X = x**2 - y**2 + P
ALR R6,R1 count
***********************************************************************
LDR FPR2,FPR4 Y
MDR FPR2,FPR0 X*Y
ADR FPR2,FPR2 2*X*Y
AD FPR2,Q y = 2*X*Y + Q
MDR FPR0,FPR0 X**2
MDR FPR4,FPR4 Y**2
LDR FPR6,FPR0 (x**2)
ADR FPR6,FPR4 (x**2+y**2)
CD FPR6,ESC diverging?
BCR HIGH,R7 yes -->
SDR FPR0,FPR4 X**2 - Y**2
AD FPR0,P x = X**2 - Y**2 + P
ALR R6,R1 count
***********************************************************************
BCT R3,ITERATE --> go again if needed
BR R7 all done now -->
--
/***************************************************************************\
/ Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu | Guns don't aim guns at \
\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks | people; CRIMINALS do!! /
\***************************************************************************/
Technical Details
Message-ID:
<9104190111.AA00321@ucbvax.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!linus!agate!ucbvax!ucf1vm.BITNET!newsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!linus!agate!ucbvax!ucf1vm.BITNET!news
From: news@ucf1vm.BITNET
Newsgroups: comp.lang.asm370
Subject: Re: Postholes
Message-ID: <9104190111.AA00321@ucbvax.Berkeley.EDU>
Date: 18 Apr 91 19:12:58 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: IBM 370 Assembly Programming Discussion List
<ASM370@OHSTVMA.BITNET>
Distribution: inet
Organization: The Internet
Lines: 83