From owner-svn-src-all@FreeBSD.ORG Mon Apr 13 17:51:06 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B36F9BD; Mon, 13 Apr 2015 17:51:06 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEBEDD4D; Mon, 13 Apr 2015 17:51:05 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id t3DHosQ3099428 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 13 Apr 2015 20:50:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t3DHosQ3099428 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id t3DHosHv099427; Mon, 13 Apr 2015 20:50:54 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 13 Apr 2015 20:50:54 +0300 From: Konstantin Belousov To: Alan Cox Subject: Re: svn commit: r280279 - head/sys/sys Message-ID: <20150413175054.GY2390@kib.kiev.ua> References: <201503201027.t2KAR6Ze053047@svn.freebsd.org> <550DA656.5060004@FreeBSD.org> <20150322080015.O955@besplex.bde.org> <17035816.lxyzYKiOWV@ralph.baldwin.cx> <552BFEB2.8040407@rice.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <552BFEB2.8040407@rice.edu> User-Agent: Mutt/1.5.23 (2014-03-12) 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.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans , John Baldwin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Mon, 13 Apr 2015 17:51:06 -0000 On Mon, Apr 13, 2015 at 12:36:50PM -0500, Alan Cox wrote: > However, in the popcnt case, we are spilling the bit map to memory in > order to popcnt it. That's rather silly: > > 3570: 48 8b 48 18 mov 0x18(%rax),%rcx > 3574: f6 04 25 00 00 00 00 testb $0x80,0x0 > 357b: 80 > 357c: 74 42 je 35c0 > > 357e: 48 89 4d b8 mov %rcx,-0x48(%rbp) > 3582: 31 c9 xor %ecx,%ecx > 3584: f3 48 0f b8 4d b8 popcnt -0x48(%rbp),%rcx > 358a: 48 8b 50 20 mov 0x20(%rax),%rdx > 358e: 48 89 55 b0 mov %rdx,-0x50(%rbp) > 3592: 31 d2 xor %edx,%edx > 3594: f3 48 0f b8 55 b0 popcnt -0x50(%rbp),%rdx > 359a: 01 ca add %ecx,%edx > 359c: 48 8b 48 28 mov 0x28(%rax),%rcx > 35a0: 48 89 4d a8 mov %rcx,-0x58(%rbp) > 35a4: 31 c9 xor %ecx,%ecx > 35a6: f3 48 0f b8 4d a8 popcnt -0x58(%rbp),%rcx > 35ac: 01 d1 add %edx,%ecx > 35ae: e9 12 01 00 00 jmpq 36c5 > > > Caveat: I'm still using clang 3.5. Maybe the newer clang doesn't spill? 3.6.0 generates similar code.