[Bug tree-optimization/79390] [7 Regression] 10% performance drop in SciMark2 LU after r242550

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 12 12:46:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79390

--- Comment #26 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 41189
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41189&action=edit
gcc7-pr79390-ecm.patch

Untested fix for the -O3 -ffast-math -march=haswell case.
The difference between -fno-fast-math and -ffast-math is in:
  if (swap_commutative_operands_p (op2, op3)
      && ((reversed = reversed_comparison_code_parts (code, op0, op1, NULL))
          != UNKNOWN))
    {
      std::swap (op2, op3);
      code = reversed;
    }

swap_commutative_operands_p is true in both cases, but without
-ffast-math reversed_comparison_code_parts fails (returns UNKNOWN), so we don't
try that order and succeed, while with -ffast-math it doesn't fail, returns LE,
but we reject it in the predicates of the cmov insn and thus don't emit
anything.  This patch just retries with the other order of operands in that
case.


More information about the Gcc-bugs mailing list