Re: Control Dependencies vs C Compilers

Paul E. McKenney
2020-10-06T15:50:54Z

On Tue, Oct 06, 2020 at 03:37:24PM +0000, David Laight wrote:
> > My suggestion as an alternative is to use assembler instead.
> > That way you can guarantee that you get the instructions you
> > want in the order that you want them. It should be fairly
> > straightforward to create a macro or inline function that
> > contains the necessary code and this can be done once and
> > then used wherever the functionality is required.
>
> C exists because K&R got fed up of writing pdp-11 assembler.
> Compared to some modern ones it is nice and easy to write
> (I'm old enough to have used pdp-11.)
>
> You can't put control dependencies inside C asm statements.

What David said!

And not only are modern machine languages quite complex and strange
compared to that of the PDP-11, but writing core Linux-kernel code
in assembler requires writing it 25 times, once for each of the
supported architectures. And even that is an underestimate because
some architectures have multiple variants, for but one example, arm's
multiple instruction sets.

Comparing 25+ assembly languages to but two compilers most definitely
motivates looking hard at doing something with the compilers.

Thanx, Paul