From mboxrd@z Thu Jan 1 00:00:00 1970 From: Willy Tarreau Subject: Re: [PATCH stable 4.9 1/8] x86: bpf_jit: small optimization in emit_bpf_tail_call() Date: Mon, 29 Jan 2018 15:06:16 +0100 Message-ID: <20180129140616.GA23326@1wt.eu> References: <0f909080f2ef055783fc7b394e8111e0df3c4971.1517190206.git.daniel@iogearbox.net> <20180129063919.GA20230@1wt.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Daniel Borkmann , Alexei Starovoitov , netdev , "David S . Miller" To: Eric Dumazet Return-path: Received: from wtarreau.pck.nerim.net ([62.212.114.60]:40200 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751298AbeA2OGe (ORCPT ); Mon, 29 Jan 2018 09:06:34 -0500 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: Hi Eric, On Mon, Jan 29, 2018 at 06:04:30AM -0800, Eric Dumazet wrote: > > If these 4 bytes matter, why not use > > cmpq with an immediate value instead, which saves 2 extra bytes ? : > > > > - the mov above is 11 bytes total : > > > > 0: 48 8b 84 d6 78 56 34 mov 0x12345678(%rsi,%rdx,8),%rax > > 7: 12 > > 8: 48 85 c0 test %rax,%rax > > > > - the equivalent cmp is only 9 bytes : > > > > 0: 48 83 bc d6 78 56 34 cmpq $0x0,0x12345678(%rsi,%rdx,8) > > 7: 12 00 > > > > And as a bonus, it doesn't even clobber rax. > > > > Just my two cents, > > > Hi Willy > > Please look more closely at following instructions. > > We need the value later, not only testing it being zero :) Ah OK that makes total sense then ;-) Thanks, willy