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

--- Comment #27 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 12 Apr 2017, jakub at gcc dot gnu.org wrote:

> 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.

Looks sensible.

Reply via email to