Date: Sat, 20 Jan 2018 13:06:37 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Bruce Evans <brde@optusnet.com.au> Cc: Don Lewis <truckman@freebsd.org>, cem@freebsd.org, "Rodney W. Grimes" <rgrimes@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r328159 - head/sys/modules Message-ID: <20180120110637.GV55707@kib.kiev.ua> In-Reply-To: <20180120183216.U1478@besplex.bde.org> References: <CAG6CVpV6Suft3v-=08f5UH6BTH2NEJgU_4kYd-UphLZ6yoJB4Q@mail.gmail.com> <201801191737.w0JHbM90073097@pdx.rh.CN85.dnsmgr.net> <CAG6CVpUj3SfiuHAaPMB1zGXpXPw=U-CsHgk%2BivEPyrzhvrrPKw@mail.gmail.com> <tkrat.a8bb488b61eec3e0@FreeBSD.org> <20180120183216.U1478@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180120110637.GV55707>