[Issue 5688] New: Poor optimization of (long & 1)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 3 00:49:59 PST 2011
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: nobody at puremagic.com
ReportedBy: clugdbug at yahoo.com.au
--- Comment #0 from Don <clugdbug at 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: -------
More information about the Digitalmars-d-bugs
mailing list