Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754869AbbG0UBd (ORCPT ); Mon, 27 Jul 2015 16:01:33 -0400 Received: from mail-ob0-f182.google.com ([209.85.214.182]:34063 "EHLO mail-ob0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754225AbbG0UB3 (ORCPT ); Mon, 27 Jul 2015 16:01:29 -0400 MIME-Version: 1.0 In-Reply-To: <55B680D8.5070702@zytor.com> References: <1438019319-19731-1-git-send-email-uros_bizjak1@t-2.net> <55B680D8.5070702@zytor.com> Date: Mon, 27 Jul 2015 22:01:29 +0200 Message-ID: Subject: Re: ASM flags in general From: Uros Bizjak To: "H. Peter Anvin" Cc: Uros Bizjak , linux-kernel@vger.kernel.org, "x86@kernel.org" , Ingo Molnar Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1888 Lines: 46 On Mon, Jul 27, 2015 at 9:04 PM, H. Peter Anvin wrote: > I wonder if using "set" would be a performance regression over "sbb" for > the existing bitops, in which case it would slot quite nicely into this > scheme. As far as I have looked into the compiled code, following sequence was produced when the value was directly used as bool 00000000000136d0 <__static_cpu_has_safe>: 136d0: 55 push %rbp 136d1: 0f b7 ff movzwl %di,%edi 136d4: 48 89 e5 mov %rsp,%rbp 136d7: 48 0f a3 3d 00 00 00 bt %rdi,0x0(%rip) # 136df <__static_cpu_has_safe+0xf> 136de: 00 136db: R_X86_64_PC32 boot_cpu_data+0x10 136df: 19 ff sbb %edi,%edi 136e1: 85 ff test %edi,%edi 136e3: 0f 95 c0 setne %al 136e6: 5d pop %rbp 136e7: c3 retq vs. new sequence: 0000000000013760 <__static_cpu_has_safe>: 13760: 55 push %rbp 13761: 0f b7 ff movzwl %di,%edi 13764: 48 89 e5 mov %rsp,%rbp 13767: 48 0f a3 3d 00 00 00 bt %rdi,0x0(%rip) # 1376f <__static_cpu_has_safe+0xf> 1376e: 00 1376b: R_X86_64_PC32 boot_cpu_data+0x10 1376f: 0f 92 c0 setb %al 13772: 5d pop %rbp 13773: c3 retq Actually, I have to search for the code above, in vast majority of cases, BT is just followed by a conditional jump. Uros. -- 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/