From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Neri Subject: Re: [PATCH v4 01/17] x86/mpx: Do not use SIB index if index points to R/ESP Date: Fri, 24 Feb 2017 11:07:27 -0800 Message-ID: <1487963247.115017.10.camel@ranerica-desktop> References: <20170223063706.71554-1-ricardo.neri-calderon@linux.intel.com> <20170223063706.71554-2-ricardo.neri-calderon@linux.intel.com> <20170223072432.GX6515@twins.programming.kicks-ass.net> <1487888232.115017.4.camel@ranerica-desktop> <1487903602.14159.50.camel@perches.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-msdos-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Nathan Howard Cc: Joe Perches , Thomas Gleixner , Ingo Molnar , linux-msdos@vger.kernel.org, Lorenzo Stoakes , "Ravi V. Shankar" , Andrew Morton , "Michael S. Tsirkin" , Adam Buchbinder , Alexandre Julliard , Qiaowei Ren , Vlastimil Babka , Chris Metcalf , wine-devel@winehq.org, Jiri Slaby , x86@kernel.org, Liang Z Li , Stas Sergeev , Paolo Bonzini , Dave Hansen , Paul Gortmaker On Fri, 2017-02-24 at 09:47 -0500, Nathan Howard wrote: > Also, this code would read better with the inner test > reversed or done first > > if (indx_offset < 0) { > if (indx_offset != -EDOM) > goto out_err; > indx = 0; > } else { > indx = regs_get_register(etc...) > } > > or > if (indx_offset == -EDOM) > indx = 0; > else if (indx_offset < 0) > goto err; > > > Or goto out_err; > > > else > indx = regs_get_register(etc...) > > The compiler should generate the same code in any > case, but either could improve reader understanding. > > > Also, it may be a tweak more efficient to handle the most likely > runtime case in the conditional stack first (whichever that may be). The most likely case will be a positive value but I need to check for negatives first :( I could wrap the first conditional in an "unlikely". Thanks and BR, Ricardo