http://d.puremagic.com/issues/show_bug.cgi?id=5688

           Summary: Poor optimization of (long & 1)
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to