From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by sourceware.org (Postfix) with ESMTPS id CBCC33858D39 for ; Fri, 26 May 2023 06:03:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBCC33858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-62382e86f81so3356306d6.2 for ; Thu, 25 May 2023 23:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685081021; x=1687673021; 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=WSrrciNI9b7c61hjlZ3DmHAfZvaDGenegKCgry5Cj4o=; b=i2zTIddnoPGuU//NaXbZ+Qy/YMbuZx3/QCKtk7hAIaoJgW4Wvvcduh8ILFo02W65/J FugUK2EKANaEg7nhlH5Hfm40h9sd/OYfzx5FPxgGpp0gkOP3lnhm1f0fBiN9z7zEV8De sgALdwaDdYx31JhfHAP5E03sSO/IK0S0hW2x4pQ07qtirbN6CWjOq28I4omNnIJc91q9 r20L1IVOStGgHz9ryOgtU0odF4/5U9Ali2t97QyUdvVcR9lnn1f6xc8wX48cxLh9UDt7 rmeB6Je/vexumH1CWRq4Ue4UAUpf+Fe6lh3ImErp08a4F5fDlzkKlJDUcljd8pIra6sP XesA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685081021; x=1687673021; 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=WSrrciNI9b7c61hjlZ3DmHAfZvaDGenegKCgry5Cj4o=; b=UtVrMYUormCDbw/ayHyz7O3Ql/0Fg07ysfPE144wb+XPy9jT6VCd5f7A76Elh34i7B wVf80rmTXPPnln8KlSx19mvd1/YED1QQJYhZ5bNweeeBuVRMo/6wr42zfDIjB0+4pogb B3s2MQ2WsdqXf6Cv98FGEHe86ckBGsw4B5Ca+NyxMPETRlfVOaYrj5dYvVgKZ1hnJewX phewxTiXwTHTIPRjq25Kl0gDDnO/L4RmNQQAHoks1wRzuXGAmQW4SfUf2Buu4QkEVl8T P9sIsSoNgkNFjDAq6kHbEp1JSzj0HYaMTUdgCf+tlm9IzWtt1/8l1qQu2qgr5p/iBxut meiw== X-Gm-Message-State: AC+VfDxIxEoudrNNc4YD6uUkOoxy+VTZp/Zx3luLv3Dvq9vlwtB1tSas J6XRGlbIDFQn5G4Yeea7ZfrmQiWoYgD/VrN5hXQtA6kj/faSvw== X-Google-Smtp-Source: ACHHUZ79KYGgRGbNYkq69xqw01Xk71JSrBrqfWLBs30GQNFnVVt5iulQ19NcWXp/VsO9Kh3Lp+c0wpFTreVlfXolzP0= X-Received: by 2002:a05:6214:f2c:b0:623:8519:87af with SMTP id iw12-20020a0562140f2c00b00623851987afmr1146992qvb.15.1685081021051; Thu, 25 May 2023 23:03:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Uros Bizjak Date: Fri, 26 May 2023 08:03:29 +0200 Message-ID: Subject: Re: [COMMITTED] i386: Use 2x-wider modes when emulating QImode vector instructions To: "Jiang, Haochen" Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no 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 Fri, May 26, 2023 at 4:12=E2=80=AFAM Jiang, Haochen wrote: > > > gcc/ChangeLog: > > > > * config/i386/i386-expand.cc (ix86_expand_vecop_qihi2): > > Rewrite to expand to 2x-wider (e.g. V16QI -> V16HImode) > > instructions when available. Emulate truncation via > > ix86_expand_vec_perm_const_1 when native truncate insn > > is not available. > > (ix86_expand_vecop_qihi_partial) : Use pmovzx > > when available. Trivially rename some variables. > > (ix86_expand_vecop_qihi): Unconditionally call ix86_expand_vecop_qi= hi2. > > Hi Uros, > > I suppose you pushed wrong patch to trunk. Ouch... I was preparing before/after asm sequences for the ChangeLog entry and took a shortcut by disabling the call in my main devel worktree. I forgot to remove it before committing... Anyway, the regression test was done with the correct version (there are several tests already present in the testsuite that would fail otherwise). I fixed it with an obvious patch. gcc/ChangeLog: * config/i386/i386-expand.cc (ix86_expand_vecop_qihi): Do not disable call to ix86_expand_vecop_qihi2. Thanks for spotting this oversight! Uros. > On trunk, we see this: > > @@ -23409,9 +23457,7 @@ ix86_expand_vecop_qihi (enum rtx_code code, rtx d= est, rtx op1, rtx op2) > && ix86_expand_vec_shift_qihi_constant (code, dest, op1, op2)) > return; > > - if (TARGET_AVX512BW > - && VECTOR_MODE_P (GET_MODE (op2)) > - && ix86_expand_vecop_qihi2 (code, dest, op1, op2)) > + if (0 && ix86_expand_vecop_qihi2 (code, dest, op1, op2)) > return; > > switch (qimode) > > It should not be if (0 && ix86_expand_vecop_qihi2 (code, dest, op1, op2)) > > The patch in this thread is correct, where is: > > @@ -23409,9 +23457,7 @@ ix86_expand_vecop_qihi (enum rtx_code code, rtx d= est, rtx op1, rtx op2) > && ix86_expand_vec_shift_qihi_constant (code, dest, op1, op2)) > return; > > - if (TARGET_AVX512BW > - && VECTOR_MODE_P (GET_MODE (op2)) > - && ix86_expand_vecop_qihi2 (code, dest, op1, op2)) > + if (ix86_expand_vecop_qihi2 (code, dest, op1, op2)) > return; > > switch (qimode) > > Thx, > Haochen > > > * config/i386/i386.cc (ix86_multiplication_cost): Rewrite cost > > calculation of V*QImode emulations to account for generation of > > 2x-wider mode instructions. > > (ix86_shift_rotate_cost): Update cost calculation of V*QImode > > emulations to account for generation of 2x-wider mode instructions. > > > > gcc/testsuite/ChangeLog: > > > > * gcc.target/i386/avx512vl-pr95488-1.c: Revert 2023-05-18 change. > > > > Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. > > > > Uros.