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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I would say the problem is in "divv4hf3" being guarded with just
TARGET_AVX512FP16 && TARGET_AVX512VL && ix86_partial_vec_fp_math
but "mulv4hf3" with
TARGET_AVX512FP16 && TARGET_AVX512VL && ix86_partial_vec_fp_math &&
TARGET_MMX_WITH_SSE

Better testcase that doesn't multiply by Inf (which is UB for -Ofast):
typedef __attribute__((__vector_size__ (8))) _Float16 F;
int a, b;
F f, *p;

void
foo ()
{
  do
    {
      f /= b ? *p : (F) {40, 1, 2, 4};
l:
    }
  while (a);
  goto l;
}
Seems it is during dom3 where
   <bb 8> [local count: 6496138]:
   # iftmp.0_23 = PHI <{ 4.0e+1, 1.0e+0, 2.0e+0, 4.0e+0 }(7)>
-  _24 = prephitmp_13 / iftmp.0_23;
+  _24 = prephitmp_13 * { 2.4993896484375e-2, 1.0e+0, 5.0e-1, 2.5e-1 };
is optimized, guess the match.pd pattern doesn't imagine that division would be
supported and multiplication wouldn't.
So, either we change match.pd to check optab if late, or change the backend not
to claim support for division when multiplication isn't supported.

Reply via email to