From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id B76CA3858D28 for ; Tue, 11 Apr 2023 09:33:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B76CA3858D28 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-lf1-x12a.google.com with SMTP id t14so9435404lft.7 for ; Tue, 11 Apr 2023 02:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681205629; x=1683797629; 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=sYXTSCcBa6rLBpGibgnZCpauOwDbCEYiKPGmfozR23w=; b=GtMlGhEhHAtwMXbR5vWVr0hZxerPS5m5ZnYzldqAuvMbD2p9+SKwmjyv4PJGnPoMlD UwlMJMpRydOQHofy2EiKj92femXVLVqwa4IrC4T5w70zR+Pl1AS35Rvslzt2E4KJF5NE m/zmBdUMMYGAcyIStOhK9dfIFGDi4NbM6CPGBWcCaH9PWnme7MSi5I+cddeU9sEc7pNX 0W+eKjZ8IbigfZEeQanducz5sXn94B1JBkvuvRCfqG4oNMWXvUyOJbU3M+fXfxFKXMnM yuN+gUxRVAw+apgLN7kA4c2sda5TVS1b71azP7xPKzZwQ5P9RIaEkd3NKTwJW+yTCwiw xB0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681205629; x=1683797629; 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=sYXTSCcBa6rLBpGibgnZCpauOwDbCEYiKPGmfozR23w=; b=QxO/WqHXJvj3Kt8VvOCXb/8zVtsjwJ9727Ky9mMSpZbnJ9kTY/Cbv7XqxnVKmiD7bD W/iDciPEL3hB7lVkde7h7eI9aLt01QR3ImPQrYT1JAJDBbdP5K6TYACZHZxAaDb+CygQ Joh0Zd8ubqfI65OAqqIZrVc7HiDyCXdMjaMzHzYr9fwiMWoOaFnvXSqaCRhD/Ewlxeop 0V5k5XnWSqoBFxQy6taMb+5KjjDtTjL8++gL92BIgabqRXQIs2r58whg79PVhxUYfExd xE9XFh5nKmGmZCYtLWlOa2XEz9IyIigCYNlV6xt0kW7G3d0Fxf6TX3R6+6t+LDzSkJqQ VTTw== X-Gm-Message-State: AAQBX9elqZjUEZhKqUHeRskO9jWQy7kPxFQ2mYhbMBCvjcUfr4338Lb7 c96dppYEdUF7qSrPYMqVQObqocP63PVU8r6YxM0= X-Google-Smtp-Source: AKy350YKHlxTruvuMMp8ZwHrJz11PXEyOJNxl0R+TCE9/VO1ZPUgFS0W1gmGkg6xIqQGfLLOlZChlzzUWJ/pAqrh3tw= X-Received: by 2002:a05:6512:4010:b0:4e8:6261:7dd0 with SMTP id br16-20020a056512401000b004e862617dd0mr5854963lfb.4.1681205628968; Tue, 11 Apr 2023 02:33:48 -0700 (PDT) MIME-Version: 1.0 References: <20230327160157.4111747-1-kevinl@rivosinc.com> In-Reply-To: <20230327160157.4111747-1-kevinl@rivosinc.com> From: Richard Biener Date: Tue, 11 Apr 2023 11:32:50 +0200 Message-ID: Subject: Re: [PATCH v2][RFC] vect: Verify that GET_MODE_NUNITS is greater than one for vect_grouped_store_supported To: Kevin Lee , Richard Sandiford Cc: gcc-patches@gcc.gnu.org, collison@rivosinc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,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 Mon, Mar 27, 2023 at 6:02=E2=80=AFPM Kevin Lee wro= te: > > This patch is a proper fix to the previous patch > https://gcc.gnu.org/pipermail/gcc-patches/2023-March/614463.html > vect_grouped_store_supported checks if the count is a power of 2, but > doesn't check the size of the GET_MODE_NUNITS. > This should handle the riscv case where the mode is VNx1DI since the > nelt would be {1, 1}. > It was tested on RISCV and x86_64-linux-gnu. Would this be correct > for the vectors with size smaller than 2? > > --- > gcc/tree-vect-data-refs.cc | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc > index 8daf7bd7dd3..04ad12f7d04 100644 > --- a/gcc/tree-vect-data-refs.cc > +++ b/gcc/tree-vect-data-refs.cc > @@ -5399,6 +5399,8 @@ vect_grouped_store_supported (tree vectype, unsigne= d HOST_WIDE_INT count) > poly_uint64 nelt =3D GET_MODE_NUNITS (mode); > > /* The encoding has 2 interleaved stepped patterns. */ > + if(!nelt.is_constant() && maybe_lt(nelt, (unsigned int) 2)) > + return false; Indentation is off (or your MUA is broken). I think the nelt.is_constant (= ) check is superfluous but with constant nelt we'd never end up with a grouped store. Note the calls are guarded with && ! known_eq (TYPE_VECTOR_SUBPARTS (vectype), 1U) maybe the better fix is to change those to ! maybe_eq? Richard should know best here. Richard. > vec_perm_builder sel (nelt, 2, 3); > sel.quick_grow (6); > for (i =3D 0; i < 3; i++) > -- > 2.25.1 >