From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0A61C3858024; Mon, 16 Oct 2023 07:56:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A61C3858024 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697443012; bh=8AWN0QpU5mZDpZdh3cYrHruKOvhv+YBTLa9oJFAxa6k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lCDxjkcSwJPyMAjQV98Yr/tsCb6X5ClRrDxuT9XrUqukohcxVscU7m5k6ywW5d5/X hd+07XVWl44hoXafOJREEDFxLvnjUD9kh93rRYdEoXoTPM3Ws5cf7W91neCZfoB8KA 4oT6j8o35Yjap2xY7vol6W3ivmLmJ5Wg4MdY+x8o= 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 07:56: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 #5 from Robin Dapp --- Disregarding the reasons for the precision adjustment, for this case here, = we seem to fail at: /* We do not handle bit-precision changes. */ if ((CONVERT_EXPR_CODE_P (code) || code =3D=3D VIEW_CONVERT_EXPR) && ((INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest)) && !type_has_mode_precision_p (TREE_TYPE (scalar_dest))) || (INTEGRAL_TYPE_P (TREE_TYPE (op)) && !type_has_mode_precision_p (TREE_TYPE (op)))) /* But a conversion that does not change the bit-pattern is ok. */ && !(INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest)) && INTEGRAL_TYPE_P (TREE_TYPE (op)) && (TYPE_PRECISION (TREE_TYPE (scalar_dest)) > TYPE_PRECISION (TREE_TYPE (op))) && TYPE_UNSIGNED (TREE_TYPE (op)))) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, "type conversion to/from bit-precision " "unsupported.\n"); return false; } for the expression patt_156 =3D () _2; where _2 (op) is of type _Bool (i.e. TYPE_MODE QImode) and patt_156 (scalar_dest) is signed-boolean:1. In that case the mode's precision (8) d= oes not match the type's precision (1) for both op and _scalar_dest. The second part of the condition I don't fully get. When does a conversion change the bit pattern? When the source has higher precision than the dest= we would need to truncate which we probably don't want. When the dest has hig= her precision that's considered ok? What about equality? If both op and dest have precision 1 the padding could differ (or rather th= e 1 could be at different positions) but do we even support that? In other wor= ds, could we relax the condition to TYPE_PRECISION (TREE_TYPE (scalar_dest)) >= =3D TYPE_PRECISION (TREE_TYPE (op)) (>=3D instead of >)? FWIW bootstrap and testsuite unchanged with >=3D instead of > on x86, aarch= 64 and power10 but we might not have a proper test for that?=