[Bug middle-end/71614] ppc __gcc_qmul is mis-optimized not to be commutative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71614 --- Comment #5 from Andrew Pinski --- The other thing to note is: https://gcc.gnu.org/ml/gcc-patches/2014-01/msg00157.html
[Bug middle-end/71614] ppc __gcc_qmul is mis-optimized not to be commutative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71614 --- Comment #4 from Andrew Pinski --- The fix would then put a barrier to force GCC not to do contracting. Something like: v = a*d; w = b*c; asm("":"+f"(v)); asm("":"+f"(w)); tau += v + w; /* Add in other second-order terms. */
[Bug middle-end/71614] ppc __gcc_qmul is mis-optimized not to be commutative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71614 --- Comment #3 from Tim Shen --- (In reply to Andrew Pinski from comment #2) > Two things, try -fno-strict-aliasing first. > Since your main violates C aliasing rules. > Second thing to try is -ffp-contract=off as I am suspecting: > v = a*d; > w = b*c; > tau += v + w; /* Add in other second-order terms. */ > u = t + tau; > > is using an fmadd here. Passing -fno-strict-aliasing doesn't change the -O2 result; -ffp-contract=off does give the consistent result as -O1. What result is __gcc_qmul supposed to give? As a user I'd expect the commutativity here.
[Bug middle-end/71614] ppc __gcc_qmul is mis-optimized not to be commutative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71614 --- Comment #2 from Andrew Pinski --- Two things, try -fno-strict-aliasing first. Since your main violates C aliasing rules. Second thing to try is -ffp-contract=off as I am suspecting: v = a*d; w = b*c; tau += v + w; /* Add in other second-order terms. */ u = t + tau; is using an fmadd here.
[Bug middle-end/71614] ppc __gcc_qmul is mis-optimized not to be commutative
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71614 --- Comment #1 from Tim Shen --- > Suppose the attached file is a.c s/a\.c/b.c