From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1363) id 94D6F3858D33; Tue, 14 Mar 2023 17:41:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94D6F3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678815707; bh=afKbcaHDFMSPnngzgo0WgK3DCebofenE4d7pnb0YJ+8=; h=From:To:Subject:Date:From; b=Nxp94ZxC20ywhY0eVdAhzfe0Q7Bnhwurv8INUfw4pom0eRyIf+DqDTRd+9I06MbYc xwAbIG7fMiLkEWR/5wYU6g+rnMV9KysNdz8cUAGw9jnF/IbB54zQVYrQOfxEqzkvG+ k70CoYrYSYzQ0iEDEp/5DuOnDmyBW1T5ljNVO5I8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Uros Bizjak To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-6665] i386: Use movss to implement V2SImode VEC_PERM. X-Act-Checkin: gcc X-Git-Author: Uros Bizjak X-Git-Refname: refs/heads/master X-Git-Oldrev: 7f22d1c83e74c41116300bebac2e4c492c90b03d X-Git-Newrev: 4bcc3b5cc87505d13cda82846db2e223a9b41f79 Message-Id: <20230314174147.94D6F3858D33@sourceware.org> Date: Tue, 14 Mar 2023 17:41:47 +0000 (GMT) List-Id: https://gcc.gnu.org/g:4bcc3b5cc87505d13cda82846db2e223a9b41f79 commit r13-6665-g4bcc3b5cc87505d13cda82846db2e223a9b41f79 Author: Uros Bizjak Date: Tue Mar 14 18:41:06 2023 +0100 i386: Use movss to implement V2SImode VEC_PERM. Perform V2SI vector permutation in the same way as existing V2SF for TARGET_MMX_WITH_SSE targets. The testcase: typedef unsigned int v2si __attribute__((vector_size(8))); v2si foo(v2si x, v2si y) { return (v2si){y[0], x[1]}; } is currently compiled to (-O2): foo: movdqa %xmm0, %xmm2 movdqa %xmm1, %xmm0 pshufd $0xe5, %xmm2, %xmm2 punpckldq %xmm2, %xmm0 ret and with the patched compiler: foo: movss %xmm1, %xmm0 ret The functionality is already tested in gcc.target/i386/vperm-v2si.c gcc/ChangeLog: * config/i386/i386-expand.cc (expand_vec_perm_movs): Handle V2SImode for TARGET_MMX_WITH_SSE. * config/i386/mmx.md (*mmx_movss_): Rename from *mmx_movss using V2FI mode iterator to handle both V2SI and V2SF modes. Diff: --- gcc/config/i386/i386-expand.cc | 8 +++----- gcc/config/i386/mmx.md | 10 +++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 1094ece8b6d..6cc8bd5c80c 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -18949,11 +18949,9 @@ expand_vec_perm_movs (struct expand_vec_perm_d *d) if (d->one_operand_p) return false; - if (!(TARGET_SSE && vmode == V4SFmode) - && !(TARGET_SSE && vmode == V4SImode) - && !(TARGET_MMX_WITH_SSE && vmode == V2SFmode) - && !(TARGET_SSE2 && vmode == V2DFmode) - && !(TARGET_SSE2 && vmode == V2DImode)) + if (!(TARGET_SSE && (vmode == V4SFmode || vmode == V4SImode)) + && !(TARGET_MMX_WITH_SSE && (vmode == V2SFmode || vmode == V2SImode)) + && !(TARGET_SSE2 && (vmode == V2DFmode || vmode == V2DImode))) return false; /* Only the first element is changed. */ diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 0deccc2d2f4..f9c66115f81 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -1518,11 +1518,11 @@ (set_attr "prefix" "*,maybe_vex,orig") (set_attr "mode" "DI,V4SF,V4SF")]) -(define_insn "*mmx_movss" - [(set (match_operand:V2SF 0 "register_operand" "=x,v") - (vec_merge:V2SF - (match_operand:V2SF 2 "register_operand" " x,v") - (match_operand:V2SF 1 "register_operand" " 0,v") +(define_insn "*mmx_movss_" + [(set (match_operand:V2FI 0 "register_operand" "=x,v") + (vec_merge:V2FI + (match_operand:V2FI 2 "register_operand" " x,v") + (match_operand:V2FI 1 "register_operand" " 0,v") (const_int 1)))] "TARGET_MMX_WITH_SSE" "@