From a6645a826f58b68f68dff30e6e6e78542099d0cc Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 9 Jul 2020 14:56:48 -0700 Subject: [PATCH] x86: Check TARGET_AVX512VL when enabling FMA Check TARGET_AVX512VL when enabling FMA to avoid gcc.target/i386/avx512er-vrsqrt28ps-3.c:25:1: error: unrecognizable insn: (insn 29 28 30 6 (set (reg:V8SF 108) (fma:V8SF (reg:V8SF 106) (reg:V8SF 105) (reg:V8SF 110))) when TARGET_AVX512VL isn't enabled. PR target/96144 * config/i386/i386-expand.c (ix86_emit_swsqrtsf): Check TARGET_AVX512VL when enabling FMA. --- gcc/config/i386/i386-expand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 49718b7a41c..e194214804b 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -15540,7 +15540,10 @@ void ix86_emit_swsqrtsf (rtx res, rtx a, machine_mode mode, bool recip) /* e0 = x0 * a */ emit_insn (gen_rtx_SET (e0, gen_rtx_MULT (mode, x0, a))); - if (TARGET_FMA || TARGET_AVX512F) + unsigned vector_size = GET_MODE_SIZE (mode); + if (TARGET_FMA + || (TARGET_AVX512F && vector_size == 64) + || (TARGET_AVX512VL && (vector_size == 32 || vector_size == 16))) emit_insn (gen_rtx_SET (e2, gen_rtx_FMA (mode, e0, x0, mthree))); else -- 2.30.2