http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54564
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-09-13 11:12:40 UTC --- Seems that starting with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190492 some fma tests fail: FAIL: gcc.target/i386/fma-fmaddXX.c execution test FAIL: gcc.target/i386/fma-fmsubXX.c execution test FAIL: gcc.target/i386/fma-fnmaddXX.c execution test FAIL: gcc.target/i386/fma-fnmsubXX.c execution test The bug seems to be in the fmai_vmfmadd_<mode> expander and following patterns. (match_dup 0) in the expander for the input operand that provides the vector elts other than lowest is definitely wrong, the first operand to the expander is the destination register, very likely uninitialized pseudo that is only going to be initialized by that vfma*s{s,d} insn. That means that the high elements of the result of _mm_f{,n}m{add,sub}_s{s,d} are pretty much garbage. The question is what the high elements of the result are supposed to be, the intrinsics aren't very well documented. Are the high elements supposed to contain the high elements of the first argument of the intrinsics? I'd assume so. But then it must be (match_dup 1) in the expander, and we need to rule out the last alternative from the patterns. Also the question is about _mm_fnm{add_sub}_s{s,d} - those currently negate the first operand, thus it would be pretty random what gets in the high elements. Shouldn't we negate the second argument instead?