[Mono-bugs] [Bug 24405] New - MCS emits bad shr instructions

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
8 May 2002 14:47:38 -0000


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 crichton@gimp.org.

http://bugzilla.ximian.com/show_bug.cgi?id=24405

--- shadow/24405	Wed May  8 10:47:38 2002
+++ shadow/24405.tmp.32503	Wed May  8 10:47:38 2002
@@ -0,0 +1,82 @@
+Bug#: 24405
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: crichton@gimp.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: MCS emits bad shr instructions
+
+Test case:
+
+using System;
+
+namespace test
+{
+        class test
+        {
+                internal static int test_method(int qexp, int ix)
+                {
+                        qexp += (int)(((uint)ix >> 23)-126);
+                        return qexp;
+                }
+        }
+}
+
+CSC's il output:
+ .method assembly static  hidebysig 
+           default int32 test_method(int32 qexp, int32 ix)  cil managed 
+    {
+        // Method begins at RVA 0x2050
+        // Code size 17 (0x11)
+        .maxstack 3
+        .locals init (
+                int32   V_0)
+        IL_0000: ldarg.0 
+        IL_0001: ldarg.1 
+        IL_0002: ldc.i4.s 0x17
+        IL_0004: shr.un 
+        IL_0005: ldc.i4.s 0x7e
+        IL_0007: sub 
+        IL_0008: add 
+        IL_0009: starg.s 0
+        IL_000b: ldarg.0 
+        IL_000c: stloc.0 
+        IL_000d: br.s IL_000f
+
+        IL_000f: ldloc.0 
+        IL_0010: ret 
+    }
+
+MCS output:
+ .method assembly static 
+           default int32 test_method(int32 qexp, int32 ix)  cil managed 
+    {
+        // Method begins at RVA 0x2090
+        // Code size 16 (0x10)
+        .maxstack 8
+        IL_0000: ldarg.s 0
+        IL_0002: ldarg.s 1
+        IL_0004: ldc.i4.s 0x17
+        IL_0006: shr 
+        IL_0007: ldc.i4.s 0x7e
+        IL_0009: sub 
+        IL_000a: add 
+        IL_000b: starg.s 0
+        IL_000d: ldarg.s 0
+        IL_000f: ret 
+    }
+
+Note the shr.un from CSC, and the shr from MCS.  This, I believe, has been
+causing a hard-to-trackdown bug in csvorbis.  CSC compiled builds work, but
+MCS builds don't.  Something appears to be wring with how mcs handles right
+shifts and casing.