https://bugs.kde.org/show_bug.cgi?id=462398

            Bug ID: 462398
           Summary: x86 FMA - wrong rounding mode
    Classification: Developer tools
           Product: valgrind
           Version: 3.19.0
          Platform: unspecified
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: jl_kdeb...@conductive.de
  Target Milestone: ---

Created attachment 154139
  --> https://bugs.kde.org/attachment.cgi?id=154139&action=edit
fmatest.cpp reproducer

SUMMARY
It seems the valgrind VM will always round down for the FMA instructions.
So assuming the program didn't change the rounding mode, valgrind computes the
wrong result:
0.0 + (- (0.0 * 1.0)) = -0.0
which should be 0.0 in all cases except _MM_ROUND_DOWN, which is not the
default.


STEPS TO REPRODUCE
1.  Compile attached cpp with "g++ -O2 -mfma fmatest.cpp"
2.  Run natively, observe no negative numbers
3.  Run through valgrind with "valgrind --tool=none ./a.out" and observe the
wrong results

OBSERVED RESULT
negative zero

EXPECTED RESULT
positive zero
Even if not implementing switching rounding modes, the most common rounding
mode should be chosen

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to