lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 27 Jul 2015 22:01:29 +0200
From:	Uros Bizjak <ubizjak@...il.com>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Uros Bizjak <uros_bizjak1@....net>, linux-kernel@...r.kernel.org,
	"x86@...nel.org" <x86@...nel.org>, Ingo Molnar <mingo@...nel.org>
Subject: Re: ASM flags in general

On Mon, Jul 27, 2015 at 9:04 PM, H. Peter Anvin <hpa@...or.com> 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ