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: unassig...@gcc.gnu.org ReportedBy: mathiaspu...@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.