This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/57057] New: Bad optimization on x86 for minps and maxps


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57057

             Bug #: 57057
           Summary: Bad optimization on x86 for minps and maxps
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mathias@gaunard.com


When optimization -O1 or greater is enabled, minps and maxps will incorrectly
deal with nan values.
icc gives the correct result.

See the attached C testcase, with -O0 it displays the correct result:
res1 = (1.000000 1.000000 1.000000 1.000000)
res2 = (-nan -nan -nan -nan)
res3 = (1.000000 1.000000 1.000000 1.000000)
res4 = (-nan -nan -nan -nan)

With -O1 it displays
res1 = (1.000000 1.000000 1.000000 1.000000)
res2 = (1.000000 1.000000 1.000000 1.000000)
res3 = (-nan -nan -nan -nan)
res4 = (-nan -nan -nan -nan)

The same also happens with the double-precision and AVX variants.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]