Bugzilla – Bug 315245
Optimize cgt / ldc.i4.0 / ceq type sequences
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by bmaurer@users.sf.net 2004-06-24 11:49:53 MST ---- The IL language does not contain all the possible comparisons that could be generated. For example, there is no compare-lt-or-eq. You have to generate cgt / ldc.i4.0 / ceq. But the operations to do this do exist in assembly (at least for the x86), but we do not use them. Consider the following code: class T { static void Main () { B (); } static bool B () { int i = 0; int j = 1; return i <= j; } } We generate: f: bf 00 00 00 00 mov edi,0x0 14: be 01 00 00 00 mov esi,0x1 19: 8b c6 mov eax,esi 1b: 3b f8 cmp edi,eax 1d: 0f 9f c0 setg al 20: 0f b6 c0 movzx eax,al 23: 85 c0 test eax,eax 25: 0f 94 c0 sete al 28: 0f b6 c0 movzx eax,al Clearly, we could optimize this down to one cmp operation. ---- Additional Comments From bmaurer@users.sf.net 2004-07-24 01:54:20 MST ---- ooops, i filed this twice. Marking the older bug as a dup because the newer one has a patch. *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO61797 *** Unknown operating system unknown. Setting to default OS "Other". This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"