From owner-svn-src-all@freebsd.org Sat Jan 20 11:06:47 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7C49ECA00E; Sat, 20 Jan 2018 11:06:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 522D17408C; Sat, 20 Jan 2018 11:06:47 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w0KB6bCD017958 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 20 Jan 2018 13:06:41 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0KB6bCD017958 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0KB6bqo017957; Sat, 20 Jan 2018 13:06:37 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 20 Jan 2018 13:06:37 +0200 From: Konstantin Belousov To: Bruce Evans Cc: Don Lewis , cem@freebsd.org, "Rodney W. Grimes" , src-committers , 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> References: <201801191737.w0JHbM90073097@pdx.rh.CN85.dnsmgr.net> <20180120183216.U1478@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180120183216.U1478@besplex.bde.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jan 2018 11:06:47 -0000 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.