Tue Jul 3 19:42:16 CEST 2007 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Tue, 3 Jul 2007 17:31:23 +0000 (17:31 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Tue, 3 Jul 2007 17:31:23 +0000 (17:31 -0000)
* mini.c: the provided Min/Max optimizations are valid for unisgned
ints.

svn path=/trunk/mono/; revision=81282

mono/mini/ChangeLog
mono/mini/mini.c

index 27147b8dd1b5f5bef4bd4693d36c00d06b0e6fb0..5b1cc9b5719290e401398e9d9bade5ee2cdee2b5 100644 (file)
@@ -1,3 +1,9 @@
+
+Tue Jul 3 19:42:16 CEST 2007 Paolo Molaro <lupus@ximian.com>
+
+       * mini.c: the provided Min/Max optimizations are valid for unisgned
+       ints.
+
 2007-07-03  Rodrigo Kumpera  <rkumpera@novell.com>
 
        * mini.c (can_access_method, can_access_field): methods moved to metadata/class.c and renamed to mono_method_can_access_method and mono_method_can_acesss_field
index 3d24618adfe1a447885eeb84e2d995d49ba42122..d583fb46a7d48f65f8713280199b58e0e24c3659 100644 (file)
@@ -3210,6 +3210,22 @@ is_signed_regsize_type (MonoType *type)
        }
 }
 
+static int
+is_unsigned_regsize_type (MonoType *type)
+{
+       switch (type->type) {
+       case MONO_TYPE_U1:
+       case MONO_TYPE_U2:
+       case MONO_TYPE_U4:
+#if SIZEOF_VOID_P == 8
+       /*case MONO_TYPE_U8: this requires different opcodes in inssel.brg */
+#endif
+               return TRUE;
+       default:
+               return FALSE;
+       }
+}
+
 static MonoInst*
 mini_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
 {
@@ -3304,14 +3320,14 @@ mini_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSigna
                return store;
        } else if (cmethod->klass == mono_defaults.math_class) {
                if (strcmp (cmethod->name, "Min") == 0) {
-                       if (is_signed_regsize_type (fsig->params [0])) {
+                       if (is_unsigned_regsize_type (fsig->params [0])) {
                                MONO_INST_NEW (cfg, ins, OP_MIN);
                                ins->inst_i0 = args [0];
                                ins->inst_i1 = args [1];
                                return ins;
                        }
                } else if (strcmp (cmethod->name, "Max") == 0) {
-                       if (is_signed_regsize_type (fsig->params [0])) {
+                       if (is_unsigned_regsize_type (fsig->params [0])) {
                                MONO_INST_NEW (cfg, ins, OP_MAX);
                                ins->inst_i0 = args [0];
                                ins->inst_i1 = args [1];