From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ACAB83858D37; Mon, 16 Oct 2023 09:58:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACAB83858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697450332; bh=NLveC4NOhn1hOwYHXn7q41n4Si56k/E1j6+4qkmQoto=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pSeNVDVK6aisP1N+X/D8EU6cRmxpP9rNprZcf2LmQK9cSf0wIxw9vIaWqkPxzI850 RgSSfu+nhwtit+C1Z0x5yXZ7mRVWrQbgyI9bzCCI3vouPAEAYXRL/lm0BqN7Ur4i0f X/nsNxLRS55L4k+VUzCGa+fXuiAh3CGi6zwPEvWM= From: "rdapp at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111794] RISC-V: Missed SLP optimization due to mask mode precision Date: Mon, 16 Oct 2023 09:58:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rdapp at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111794 --- Comment #9 from Robin Dapp --- Yes, that's from pattern recog: slp.c:11:20: note: =3D=3D=3D vect_pattern_recog =3D=3D=3D slp.c:11:20: note: vect_recog_mask_conversion_pattern: detected: _5 =3D _= 2 & _4; slp.c:11:20: note: mask_conversion pattern recognized: patt_157 =3D patt_= 156 & _4; slp.c:11:20: note: extra pattern stmt: patt_156 =3D () = _2; slp.c:11:20: note: vect_recog_bool_pattern: detected: _6 =3D (int) _5; slp.c:11:20: note: bool pattern recognized: patt_159 =3D (int) patt_158; slp.c:11:20: note: extra pattern stmt: patt_158 =3D _5 ? 1 : 0; slp.c:11:20: note: vect_recog_mask_conversion_pattern: detected: _11 =3D = _8 & _10; slp.c:11:20: note: mask_conversion pattern recognized: patt_161 =3D patt_= 160 & _10; slp.c:11:20: note: extra pattern stmt: patt_160 =3D () = _8; ... In vect_recog_mask_conversion_pattern we arrive at if (TYPE_PRECISION (rhs1_type) < TYPE_PRECISION (rhs2_type)) { vectype1 =3D get_mask_type_for_scalar_type (vinfo, rhs1_type); if (!vectype1) return NULL; rhs2 =3D build_mask_conversion (vinfo, rhs2, vectype1, stmt_vinfo); } else { vectype1 =3D get_mask_type_for_scalar_type (vinfo, rhs2_type); if (!vectype1) return NULL; rhs1 =3D build_mask_conversion (vinfo, rhs1, vectype1, stmt_vinfo); } lhs =3D vect_recog_temp_ssa_var (TREE_TYPE (lhs), NULL); pattern_stmt =3D gimple_build_assign (lhs, rhs_code, rhs1, rhs2); vectype1 is then e.g. vector([8,8]) . Then vect_recog_bool_pattern creates the COND_EXPR. Testsuites are running with your proposed change.=