[net.lang.c] use of asm

steffen@ihuxy.UUCP (Joe Steffen) (06/04/86)

> Although asm() can be very useful on occasion, it's a sad thing, and it
> just about wrecks the use of good optimizing compilers.  Unless I recall
> incorrectly, there wasn't much of this in PDP-11 days, but it really
> got popular on machines with slow subroutine calls.  From experience,
> I much prefer a good optimizing compiler on a machine with fast calls:
> the wish for "asm" drops away pretty quickly.  This leads to another
> set of questions: real data would be appreciated:
> Who uses asm?

My group supports the compilers and optimizers for a project of 2000
programmers.  We changed the optimizer to optimizer all functions in a file
except those with asm() to minimize this problem.

> On what machines?

3B20, M68000, 8086, 80186

> How much performance was it worth?
> Why did you use it?
> 	Structural reasons? (i.e., getting to privleged ops)

Yes.

> 	Performance of small functions (i.e., spl?())
> 	Other performance (like getting long moves inline).

Occasionally used to get an inline memcpy.

> Did you use it inside the kernel, in libraries, or
> 	in application code?

Kernel and application code.

> Have you ever been bitten by compiler changes wrecking the code?

Asm() code often has to make assumptions about which registers the compiler
is using.  One way to reserve a register is to declare a dummy register
variable.  We are increasing the number of register declarations that will
be recognized in one of our compilers, so all use of asm() will have to be
examined for assumptions about available registers.

> Do you have equivalent asm() code for 2 or more machines?

No.

-- 


	Joe Steffen, AT&T Bell Labs, Naperville, IL, (312) 979-5381