[Mono-bugs] [Bug 60697][Wis] New - Optimize cgt / ldc.i4.0 / ceq type sequences
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 24 Jun 2004 11:49:53 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by bmaurer@users.sf.net.
http://bugzilla.ximian.com/show_bug.cgi?id=60697
--- shadow/60697 2004-06-24 11:49:53.000000000 -0400
+++ shadow/60697.tmp.28016 2004-06-24 11:49:53.000000000 -0400
@@ -0,0 +1,50 @@
+Bug#: 60697
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: bmaurer@users.sf.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Optimize cgt / ldc.i4.0 / ceq type sequences
+
+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.