Summary: Poor optimization of (long & 1)
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from Don <> 2011-03-03 00:47:06 PST ---
The optimiser does a very poor job in a case like this:
bool foo(long v)
    return  v&1;

It generates this:
                mov     EAX,4[ESP]
                mov     EDX,8[ESP]
                and     EAX,1
                xor     EDX,EDX
                or      EDX,EAX
                jne     L17
                xor     EAX,EAX
                jmp short       L1C
L17:            mov     EAX,1
L1C:            ret     8

That's terrible code! It should just do:

mov EAX, 4[ESP]
and EAX, 1
ret 8

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to