* mini.c: the provided Min/Max optimizations are valid for unisgned
ints.
svn path=/trunk/mono/; revision=81282
+
+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
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
+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)
{
static MonoInst*
mini_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args)
{
return store;
} else if (cmethod->klass == mono_defaults.math_class) {
if (strcmp (cmethod->name, "Min") == 0) {
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) {
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];
MONO_INST_NEW (cfg, ins, OP_MAX);
ins->inst_i0 = args [0];
ins->inst_i1 = args [1];