public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52889] New: incorrect sign of _mm_nmsub_XX intrinsics in fma4intrin.h
@ 2012-04-06 16:31 MathiasPuetz at gmx dot de
  2023-12-17  2:08 ` [Bug target/52889] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: MathiasPuetz at gmx dot de @ 2012-04-06 16:31 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52889
           Summary: incorrect sign of _mm_nmsub_XX intrinsics in
                    fma4intrin.h
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: MathiasPuetz@gmx.de


Created attachment 27106
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27106
corrected fma4intrin.h include file

All _mm_nmsub_xx and _mm256_nmsub_xx intrinsic definitions for FMA4
instructions in the fma4intrin.h header file are incorrect.

nmsub(a,b,c) should compute the equivalent of -( a*b - c) = c - a*b.

However the fma4intrin.h file maps

   nmsub(a,b,c) ->  madd(-(a),b,-(c)) -> -a*b - c

i.e. the sign in front of the c operand is erroneous.

The impact of this bug is, that code which actively uses the _mm_nmsub_xx
intrinsics gives incorrect results.

The attached fma4intrin.h file has all signs properly corrected
and can be used as drop-in replacement for fma4intrin.h in GCC 4.6.2.
The bug is also present in 4.6.1.

I have not checked correctness of prior GCC version 4.5.x nor newer GCC 4.7.
However the fma4intrin.h mapping has changed from 4.5 -> 4.6,
which might likely have introduced the error.

Best regards,
Mathias Puetz / Cray Inc.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-17 11:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06 16:31 [Bug c/52889] New: incorrect sign of _mm_nmsub_XX intrinsics in fma4intrin.h MathiasPuetz at gmx dot de
2023-12-17  2:08 ` [Bug target/52889] " pinskia at gcc dot gnu.org
2023-12-17  2:16 ` pinskia at gcc dot gnu.org
2023-12-17 11:00 ` MathiasPuetz at gmx dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).