From 8c8df06e46493f6cb55333db72fa1802279b48b4 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 12 Aug 2021 21:18:46 +0200 Subject: [PATCH] [i386] Introduce scalar version of avx512f_vmscalef. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2021-08-12 Uroš Bizjak gcc/ PR target/98309 * config/i386/i386.md (avx512f_scalef2): New insn pattern. (ldexp3): Use avx512f_scalef2. (UNSPEC_SCALEF): Move from ... * config/i386/sse.md (UNSPEC_SCALEF): ... here. --- gcc/config/i386/i386.md | 27 +++++++++++++++++++-------- gcc/config/i386/sse.md | 1 - 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 56b09c566ed..4a8e8fea290 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -125,6 +125,9 @@ UNSPEC_RSQRT UNSPEC_PSADBW + ;; For AVX512F support + UNSPEC_SCALEF + ;; Generic math support UNSPEC_COPYSIGN UNSPEC_XORSIGN @@ -17894,6 +17897,17 @@ DONE; }) +(define_insn "avx512f_scalef2" + [(set (match_operand:MODEF 0 "register_operand" "=v") + (unspec:MODEF + [(match_operand:MODEF 1 "register_operand" "v") + (match_operand:MODEF 2 "nonimmediate_operand" "vm")] + UNSPEC_SCALEF))] + "TARGET_AVX512F" + "vscalef\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "prefix" "evex") + (set_attr "mode" "")]) + (define_expand "ldexpxf3" [(match_operand:XF 0 "register_operand") (match_operand:XF 1 "register_operand") @@ -17924,15 +17938,12 @@ if (TARGET_AVX512F && TARGET_SSE_MATH) { rtx op2 = gen_reg_rtx (mode); - emit_insn (gen_floatsi2 (op2, operands[2])); - operands[0] = lowpart_subreg (mode, operands[0], mode); - if (MEM_P (operands[1])) + + if (!nonimmediate_operand (operands[1], mode)) operands[1] = force_reg (mode, operands[1]); - operands[1] = lowpart_subreg (mode, operands[1], mode); - op2 = lowpart_subreg (mode, op2, mode); - emit_insn (gen_avx512f_vmscalef (operands[0], - operands[1], - op2)); + + emit_insn (gen_floatsi2 (op2, operands[2])); + emit_insn (gen_avx512f_scalef2 (operands[0], operands[1], op2)); } else { diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 3a7bbaec7af..60e69a470e7 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -92,7 +92,6 @@ UNSPEC_RCP14 UNSPEC_RSQRT14 UNSPEC_FIXUPIMM - UNSPEC_SCALEF UNSPEC_VTERNLOG UNSPEC_GETEXP UNSPEC_GETMANT