svn commit: r328159 - head/sys/modules

Konstantin Belousov kostikbel at gmail.com
Sat Jan 20 11:06:47 UTC 2018


On Sat, Jan 20, 2018 at 07:57:55PM +1100, Bruce Evans wrote:
> The not-unused x86 arch is one that does this.  IIRC, some history of this
> is:
> 
> - on the 8086, the shift count was taken mod 32.  16 bits was enough for
>    anyone, and shifting left or right by 16 through 31 (but not by 32)
>    shifted out all of the bits (in the unsigned case) to give 0.
> 
> - for the 80386, someone forgot why the 8086 took the count mod 32 instead
>    of just 16, and kept using 32.  16 bits was not enough for anyone, and
>    shifting left or right by 32 had no effect (even in the signed case?).
> 

SDM rev 065 states:
IA-32 Architecture Compatibility
The 8086 does not mask the shift count. However, all other IA-32
processors (starting with the Intel 286 processor) do mask the shift
count to 5 bits, resulting in a maximum count of 31. This masking is
done in all operating modes (including the virtual-8086 mode) to reduce
the maximum execution time of the instructions.

Then later, the same section states that <=32bit mode uses mask 0x1f, and
64bit mode uses mask 0x3f.

Of course this does not make the compiler a bit more useful or provide a
reasoning for its useless behaviour.


More information about the svn-src-all mailing list