From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id B6C6B3884546 for ; Wed, 19 Jun 2024 12:34:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6C6B3884546 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 B6C6B3884546 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718800494; cv=none; b=k37pztlA9dvEWNCzaabfUUgHSgWX+LfTpx+4OLhqdTPd3sFOq9KEUf8HWejcu3nATdHEPNEKKKyiKMzBy79AHX0Td18HAV+F9iNcm9TRsRskmMTsbn59KD3hul2YeFGSo3TAznlLijeUG94kPHijBcPpfjnxoG4tK6VnWEYyQdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718800494; c=relaxed/simple; bh=sniZ1dD1IpxSkjOUCf8r4ncJq2rHJZUumqIG5ALjz1o=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=rxsyavD1aN8NUd/mBSdCPw16M0CLqjnsCgJsh/+4kYiDHgeTsDLJZqipWxPEICpiWw01iYa2W9Mdp/RfWnqk0L9kw+MJQidq+Wwas1yqxLHuliE1sPgEtbl/B/uFR5hYQdqWR9d1rCQdcO2LFzy4n00Sj+YbLCdJQMbYpxOQWU4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ebe40673d8so69339421fa.3 for ; Wed, 19 Jun 2024 05:34:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718800490; x=1719405290; 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=7XQDQ90k0QoF7PZkLUhrkvE9SeG3YR57fmNtFfYwXqo=; b=TL/q9AOYqMaUSBKEqQzdorLKclPEr0gGnIaw9qolp/wW/Ga95s6A/uovBdb4xu/+6h 4XfCkYY5N9N77DSeANKi7N42y9vaQ7SdICp7U6st1DLow8DvtF8R3/pdI2fNgFmMp3FC ktjdElMhZLBjXpICGoegCroNBhoEtkXqZYVpM8LOSV5OFkiDncGFvoS48W7JT0XcTEjD BoTx9L6B8bhhalbYge70jABUBeLaNu238eKeBsGGdmLeby6K9MPDzhD+Qt+G80GZiqCs hbUfmaeJQINT7MuIXV+SFXneGPuAqyX9egBuBMPwcBHwW+TDzRsicXPQWuaEwYYWW7Yu 2FgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718800490; x=1719405290; 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=7XQDQ90k0QoF7PZkLUhrkvE9SeG3YR57fmNtFfYwXqo=; b=K/S0mNrUHt15BzFJkKy+ED5pdMIJnHM3nPUF88CLTjozimDwj28OeCmrphXMVW/GpA axT3uDyLpM7qrsNUb/mg7Ix+Srok0F/mrbZoIIT59wmBPGZZ0OGR1d42XzIfXTaDcK6c 33exAoYAIDIKBbMk8xFF6IOGU0A9PgJNmhI5l8vFuOrj7nG1BzbB7fcscNgChRaeGdx1 oIq0T1WuPy/S2lqajRx9TES5iTcj8ceoi9H+0rzui+6U5A939VKyznO3TieGtnTge3eh CaHcXpeZwr7+AQFzbM7kl3ImpehEN7Df+mvHgIilgpKDUIEJ/kDgewM6aaNd1jELQbvE 2VjA== X-Gm-Message-State: AOJu0YxXU3XygAAX/xI3y8UgTa0nz/FT0yuCtLGVdKldQ6AB9vWB9YpD njF6sk+9+PGu9z++6PHNI+Qf3878mn+fWQ9A5616X9tMQvNG6tZh4T0syWlkD+CvrECvP03IIev uWDkuvyS7tD2UGCvTEFctrE14bIEPiw== X-Google-Smtp-Source: AGHT+IH4kEmMzkZirPXk/3dZ95GBW18ih/azz2WQJvI9qDdE4CVDD4dAT1FtYVQT95Jnrtql7zs/b2DM2mIiysBXSQo= X-Received: by 2002:a2e:9f13:0:b0:2ec:2695:fc16 with SMTP id 38308e7fff4ca-2ec3ce9f6e8mr15088531fa.8.1718800489740; Wed, 19 Jun 2024 05:34:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Wed, 19 Jun 2024 14:34:38 +0200 Message-ID: Subject: Re: [PATH 1/8] vect: Add a function to check lane-reducing stmt To: Feng Xue OS Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.9 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,T_SCC_BODY_TEXT_LINE 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 Sun, Jun 16, 2024 at 9:21=E2=80=AFAM Feng Xue OS wrote: > > The series of patches are meant to support multiple lane-reducing reducti= on statements. Since the original ones conflicted with the new single-lane = slp node patches, I have reworked most of the patches, and split them as sm= all as possible, which may make code review easier. Thanks for that - as always please feel free to push approved parts of the series if dependences allow. > In the 1st one, I add a utility function to check if a statement is lane-= reducing operation, > which could simplify some existing code. OK. Thanks, Richard. > Thanks, > Feng > > --- > gcc/ > * tree-vectorizer.h (lane_reducing_stmt_p): New function. > * tree-vect-slp.cc (vect_analyze_slp): Use new function > lane_reducing_stmt_p to check statement. > --- > gcc/tree-vect-slp.cc | 4 +--- > gcc/tree-vectorizer.h | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc > index 7e3d0107b4e..b4ea2e18f00 100644 > --- a/gcc/tree-vect-slp.cc > +++ b/gcc/tree-vect-slp.cc > @@ -3919,7 +3919,6 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tre= e_size) > scalar_stmts.create (loop_vinfo->reductions.length ()); > for (auto next_info : loop_vinfo->reductions) > { > - gassign *g; > next_info =3D vect_stmt_to_vectorize (next_info); > if ((STMT_VINFO_RELEVANT_P (next_info) > || STMT_VINFO_LIVE_P (next_info)) > @@ -3931,8 +3930,7 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tre= e_size) > { > /* Do not discover SLP reductions combining lane-reduci= ng > ops, that will fail later. */ > - if (!(g =3D dyn_cast (STMT_VINFO_STMT (next= _info))) > - || !lane_reducing_op_p (gimple_assign_rhs_code (g))= ) > + if (!lane_reducing_stmt_p (STMT_VINFO_STMT (next_info))= ) > scalar_stmts.quick_push (next_info); > else > { > diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h > index 6bb0f5c3a56..60224f4e284 100644 > --- a/gcc/tree-vectorizer.h > +++ b/gcc/tree-vectorizer.h > @@ -2169,12 +2169,24 @@ vect_apply_runtime_profitability_check_p (loop_ve= c_info loop_vinfo) > && th >=3D vect_vf_for_cost (loop_vinfo)); > } > > +/* Return true if CODE is a lane-reducing opcode. */ > + > inline bool > lane_reducing_op_p (code_helper code) > { > return code =3D=3D DOT_PROD_EXPR || code =3D=3D WIDEN_SUM_EXPR || code= =3D=3D SAD_EXPR; > } > > +/* Return true if STMT is a lane-reducing statement. */ > + > +inline bool > +lane_reducing_stmt_p (gimple *stmt) > +{ > + if (auto *assign =3D dyn_cast (stmt)) > + return lane_reducing_op_p (gimple_assign_rhs_code (assign)); > + return false; > +} > + > /* Source location + hotness information. */ > extern dump_user_location_t vect_location; > > -- > 2.17.1