Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759884Ab1D0TQF (ORCPT ); Wed, 27 Apr 2011 15:16:05 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.123]:60407 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759753Ab1D0TQD (ORCPT ); Wed, 27 Apr 2011 15:16:03 -0400 X-Authority-Analysis: v=1.1 cv=pN6kzQkhXdmdOr6Akjoh3kGBD/S3UyPMKQp53EJY+ro= c=1 sm=0 a=i38SgkEfDKkA:10 a=5SG0PmZfjMsA:10 a=Q9fys5e9bTEA:10 a=OPBmh+XkhLl+Enan7BmTLg==:17 a=0wago2nr_u6hNLsGzCwA:9 a=PUjeQqilurYA:10 a=OPBmh+XkhLl+Enan7BmTLg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 67.242.120.143 Subject: Re: [PATCH] linux/string.h: Introduce streq macro. From: Steven Rostedt To: Pekka Enberg Cc: "H. Peter Anvin" , Thiago Farina , linux-kernel@vger.kernel.org, Alexey Dobriyan , Rusty Russell , Ingo Molnar , "David S. Miller" , Al Viro , "Ted Ts'o" , Christoph Hellwig In-Reply-To: References: <1303926576.18763.75.camel@gandalf.stny.rr.com> <4DB86163.2070201@zytor.com> Content-Type: text/plain; charset="ISO-8859-15" Date: Wed, 27 Apr 2011 15:16:01 -0400 Message-ID: <1303931761.18763.101.camel@gandalf.stny.rr.com> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2512 Lines: 68 On Wed, 2011-04-27 at 21:51 +0300, Pekka Enberg wrote: > It's the same kind of API extension kstrdup(), for example, is. > Whether or not we should it do it is a separate matter and I think the > only reasonable argument for and against is whether it (a) reduces the > number of bugs, I did a quick search through the git logs, and found no bug fixes due to the semantics. At least by the time it got to mainline, they are fixed (which is a good thing). > (b) improves code readability significantly, This is a matter of preference. I think I would prefer it, but obviously others do not. > or (c) > generates better code. If we implement streq() separately from strcmp() it gets slightly better: 00000000000001be : 1be: 55 push %rbp 1bf: 48 89 e5 mov %rsp,%rbp 1c2: 8a 07 mov (%rdi),%al 1c4: 8a 16 mov (%rsi),%dl 1c6: 48 ff c7 inc %rdi 1c9: 48 ff c6 inc %rsi 1cc: 38 d0 cmp %dl,%al 1ce: 74 07 je 1d7 1d0: 19 c0 sbb %eax,%eax 1d2: 83 c8 01 or $0x1,%eax 1d5: eb 06 jmp 1dd 1d7: 84 c0 test %al,%al 1d9: 75 e7 jne 1c2 1db: 31 c0 xor %eax,%eax 1dd: c9 leaveq 1de: c3 retq 00000000000001df : 1df: 55 push %rbp 1e0: 48 89 e5 mov %rsp,%rbp 1e3: 8a 07 mov (%rdi),%al 1e5: 8a 16 mov (%rsi),%dl 1e7: 48 ff c7 inc %rdi 1ea: 48 ff c6 inc %rsi 1ed: 38 d0 cmp %dl,%al 1ef: 75 0b jne 1fc 1f1: 84 c0 test %al,%al 1f3: 75 ee jne 1e3 1f5: b8 01 00 00 00 mov $0x1,%eax 1fa: eb 02 jmp 1fe 1fc: 31 c0 xor %eax,%eax 1fe: c9 leaveq 1ff: c3 retq -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/