[Mono-bugs] [Bug 373269] Math.Min and Math.Max

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Mar 29 16:10:00 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=373269

User rkumpera at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=373269#c6


Rodrigo Kumpera <rkumpera at novell.com> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |rkumpera at novell.com




--- Comment #6 from Rodrigo Kumpera <rkumpera at novell.com>  2008-03-29 14:09:58 MST ---
Mono can use SSE in 32bits mode, it's auto-detected at runtime. Math.Min only
works for u1, u2 and u4. We could use SSE for float and double, this would mean
a significant gain.


Testing this example revealed a bug in gmcs. It would choose the int version
over the uint version of Math.Min even if the type used is uint32.

The following code is wrongly compiled to use the int32 version of Math.Min:

using System;

class Program {
        const int LOOP_SIZE = 20; //Int16.MaxValue;
        static int Tst (uint a, uint b) 
        {
                return Math.Min (a,b);
        }

        static void Main ()
        {
                Console.WriteLine (Tst(1,2));
        }
}

We could optimize by using cmov for the other types, thou I'm not sure it would
be better than the current code.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list