From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755288AbbCFWYU (ORCPT ); Fri, 6 Mar 2015 17:24:20 -0500 Received: from mga03.intel.com ([134.134.136.65]:3185 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753570AbbCFWYS (ORCPT ); Fri, 6 Mar 2015 17:24:18 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,355,1422950400"; d="scan'208";a="463667541" From: Andi Kleen To: Denys Vlasenko Cc: "H. Peter Anvin" , Linus Torvalds , Steven Rostedt , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andy Lutomirski , Oleg Nesterov , Frederic Weisbecker , Will Drewry , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86: clean up unnecessarily wide TEST insns References: <1425675332-31576-1-git-send-email-dvlasenk@redhat.com> Date: Fri, 06 Mar 2015 14:24:17 -0800 In-Reply-To: <1425675332-31576-1-git-send-email-dvlasenk@redhat.com> (Denys Vlasenko's message of "Fri, 6 Mar 2015 21:55:32 +0100") Message-ID: <87h9txahny.fsf@tassilo.jf.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Denys Vlasenko writes: > By the nature of TEST operation, it is often possible > to test a narrower part of the operand: > "testl $3, mem" -> "testb $3, mem", > "testq $3, %rcx" -> "testb $3, %cl" > This results in shorter insns, because TEST insn has no > sign-entending byte-immediate forms unlike other ALU ops. It also results in expensive LCP stalls. Please don't do it. If you feel the need to change instructions around like this read the optimization manuals first. -Andi -- ak@linux.intel.com -- Speaking for myself only