Subject: Re: Bitfields and kernel
To: None <tech-kern@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-kern
Date: 10/01/1999 09:33:45
On Thu, 30 Sep 1999, Matt Thomas wrote:
> > if (msr.pow && !msr.ile)
> >Let the compiler smash the logicals & bits together efficiently.
>
> But it can't. The C language specifies that msr.pow if evaluates to
> false then !msr.ile must not be evaluated.
Yes, but the "as-if rule" allows the compiler to break just about any
other rule provided that a conforming program can't tell the
difference. If msr is not volatile then a conforming program can't
tell how many times it was accessed, so the compiler is allowed to
optimise both accesses into a single access.
--apb (Alan Barrett)