From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 8B2FD3858D1E for ; Tue, 21 May 2024 06:35:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B2FD3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8B2FD3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::229 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716273323; cv=none; b=gYRHp874dBt+I9NEeqU0fxQSR76enZ3DKw//Pjj1Yvy6i5P9FxO6Vfa0TZvwVLl3N4fbD94J3krVKduuRyNrAiLwNhFsQdfgK7zVagsL85QFOPliXpQ6qvbep+9va7vIjVDkh2LQK+P6LVMZp0ezUpS22TffTLy6U7huskK5c3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716273323; c=relaxed/simple; bh=H7Pqot5+iVlDWmrvqWXvDQdiUFk8R8YAntbXu1SbidA=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=ZY1ikAOheoV0saRACXZpqWHZJitgfJPyGzARHxapvF6JtaUZ25xePyaZ1462TYIiOKns86xheYbaRAewtGhYiGglg6WYiLHvdtSe5SwRPD1kQlNzJ00GhMAowXR5f41GmXkFifu6AyfNqVZGe54W2eUEXH2zQBKc3w3kwdgnG+0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2e3e18c240fso44607271fa.0 for ; Mon, 20 May 2024 23:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716273320; x=1716878120; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5ge/CSqr5AbOe2xWmlWHQsJ+dLeFBb1rRMemiVmEkQw=; b=dlkVaJro9Ck8f/6HxVhhORn4CjhlyASlUTtPc9HDANBc481XQ3tpDcutmvA8dMLRv8 lIEwJFhiAUimacL4/N2NmmCA9Kz+vg+5IpxfpB4WahNm356Ls/Pxr+lCZaFM8nElzrIg xiHQGlE3J2vgO6FCMBt5ihmoqzkSgy+4p6a9kVVzTiUHQyPCEk9dXIFHp0hBzVw7d1zU dD0eFnKXeszIYim+1QTfoFCb4rOLj0CIbDHnLujTFDpTbfTp9isdnTj5KMtISgu748HO PBYy2ZZKoMfLxWD02kLLC5yj2u/wjmaX6FlTkfZuDgOp66NOVLCjM4Tt/eVXBDItocRF SkxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716273320; x=1716878120; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5ge/CSqr5AbOe2xWmlWHQsJ+dLeFBb1rRMemiVmEkQw=; b=NA9bJEizUqx5AktBMuBIv1MSXgRaIjs76JZymQRADRBmAqEY8pePJc1JrsGOY6eezp WAyqHs2NvGXBRqj3thgzj8YczUeMu2DYLj2lUtUgv+cgZi1cveAJ/AV2Hfc078lbV6L4 Z//wiq4eFNMhWt/m14QFDOr+Qxlk+8RJY0+JIVcypmTBYfmt9vy+X3MYMaifOhU7RSpy JWlXH866ftnwirpRR7zy9I+6zLGuSu4yfXV4iUup5FqdaWlfMH1lh/i2/e5DxfZGzldQ 85lLEte78rJk25quhspEX2wDX6muSWSIpunlC0jDvMyu9/3uU0JZn6U++4NSUNrpo4JN pwEQ== X-Gm-Message-State: AOJu0YyEmnq+TRVebFso2N7hXtHd5yvfe6OUVJe15h48RT7A/CCHTIzl Wg6OPSPD9ODBDNnmWlSwmc5wpfvcckyachY/7v15KkxHjhPJTH6oQ6o7PrbTvrowVs7bkiZo4/N VmCGS5m40HUJm2ngAJ6EcBFP/Oxo= X-Google-Smtp-Source: AGHT+IF9bpAhn0paGcooUYcvCYkAOo+i8G1Ue16m7L/M5v9P+jIWmKwgRquL8zpp+IJUDv+gHcWmxlqxRiEaJCALyNk= X-Received: by 2002:a2e:7d09:0:b0:2e2:1647:f671 with SMTP id 38308e7fff4ca-2e5205c817emr263636601fa.47.1716273319438; Mon, 20 May 2024 23:35:19 -0700 (PDT) MIME-Version: 1.0 References: <20240521061617.667442-1-haochen.jiang@intel.com> In-Reply-To: <20240521061617.667442-1-haochen.jiang@intel.com> From: Uros Bizjak Date: Tue, 21 May 2024 08:35:07 +0200 Message-ID: Subject: Re: [PATCH] i386: Disable ix86_expand_vecop_qihi2 when !TARGET_AVX512BW To: Haochen Jiang Cc: gcc-patches@gcc.gnu.org, hongtao.liu@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, May 21, 2024 at 8:16=E2=80=AFAM Haochen Jiang wrote: > > Hi all, > > Since vpermq is really slow, we should avoid using it when it is > the only instruction could be used for ix86_expand_vecop_qihi2. > > Bootstrapped and regtested on x86_64-pc-linux-gnu. Ok for trunk? > > Thx, > Haochen > > gcc/ChangeLog: > > PR target/115069 > * config/i386/i386-expand.cc (ix86_expand_vecop_qihi2): > Do not enable the optimization when AVX512BW is not enabled. > --- > gcc/config/i386/i386-expand.cc | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand= .cc > index a6132911e6a..f24c800bb4f 100644 > --- a/gcc/config/i386/i386-expand.cc > +++ b/gcc/config/i386/i386-expand.cc > @@ -24323,6 +24323,11 @@ ix86_expand_vecop_qihi2 (enum rtx_code code, rtx= dest, rtx op1, rtx op2) > bool op2vec =3D GET_MODE_CLASS (GET_MODE (op2)) =3D=3D MODE_VECTOR_INT= ; > bool uns_p =3D code !=3D ASHIFTRT; > > + /* vpermq is slow and we should not fall into the optimization when > + it is the only instruction to be selected. */ Please rather say something like: /* Without VPMOVWB (provided by AVX512BW ISA), the expansion uses the gener= ic permutation to merge the data back into the right place. This permutation results in VPERMQ, which is slow, so better fall back to expand_vecop_qihi. */ Uros. > + if (!TARGET_AVX512BW) > + return false; > + > if ((qimode =3D=3D V16QImode && !TARGET_AVX2) > || (qimode =3D=3D V32QImode && (!TARGET_AVX512BW || !TARGET_EVEX51= 2)) > /* There are no V64HImode instructions. */ > -- > 2.31.1 >