Hi! ix86_expand_sse_fp_minmax bypasses the expanders and so might end up with both if_true and if_false being a MEM, which violates the condition of the insn it wants to match.
The following patch makes sure at most one of the operands is a MEM. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2019-04-24 Jakub Jelinek <ja...@redhat.com> PR target/90187 * config/i386/i386.c (ix86_expand_sse_fp_minmax): Force if_true into a register if both if_true and if_false are MEMs. * g++.target/i386/pr90187.C: New test. --- gcc/config/i386/i386.c.jj 2019-04-16 10:40:15.077091789 +0200 +++ gcc/config/i386/i386.c 2019-04-23 11:42:32.088334896 +0200 @@ -23712,6 +23712,8 @@ ix86_expand_sse_fp_minmax (rtx dest, enu else { code = is_min ? SMIN : SMAX; + if (MEM_P (if_true) && MEM_P (if_false)) + if_true = force_reg (mode, if_true); tmp = gen_rtx_fmt_ee (code, mode, if_true, if_false); } --- gcc/testsuite/g++.target/i386/pr90187.C.jj 2019-04-23 11:42:51.175025002 +0200 +++ gcc/testsuite/g++.target/i386/pr90187.C 2019-04-23 11:41:56.405914260 +0200 @@ -0,0 +1,15 @@ +// PR target/90187 +// { dg-do compile } +// { dg-options "-Ofast -ffloat-store" } + +double a[64]; +double *foo (void); + +void +bar (int x, const double *y) +{ + int i; + for (i = 0; i < x; i++) + if (y[i] < a[i]) + a[i] = y[i]; +} Jakub