[Issue 5688] Poor optimization of (long & 1)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 22 15:02:02 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=5688

Dmitry Olshansky <dmitry.olsh at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dmitry.olsh at gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #3 from Dmitry Olshansky <dmitry.olsh at gmail.com> ---
Now on 2.080 32-bit it's much better:

   0:   8b 44 24 04             mov    0x4(%esp),%eax
   4:   8b 54 24 08             mov    0x8(%esp),%edx
   8:   25 01 00 00 00          and    $0x1,%eax
   d:   31 d2                   xor    %edx,%edx
   f:   c2 08 00                ret    $0x8

And 64-bit (barring the rbp/rsp that can be elided but a different matter):


   0:   55                      push   %rbp
   1:   48 8b ec                mov    %rsp,%rbp
   4:   48 81 e7 01 00 00 00    and    $0x1,%rdi
   b:   48 89 f8                mov    %rdi,%rax
   e:   5d                      pop    %rbp
   f:   c3                      retq

--


More information about the Digitalmars-d-bugs mailing list