Bug 315245 (MONO60697) - Optimize cgt / ldc.i4.0 / ceq type sequences
Summary: Optimize cgt / ldc.i4.0 / ceq type sequences
Status: RESOLVED MOVED
Alias: MONO60697
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-24 18:49 UTC by Ben Maurer
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:44:00 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"