From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3DBA43858439; Sun, 12 Mar 2023 18:44:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DBA43858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678646642; bh=fCy8+RsJG3hDQWXmz1kDKoB9FTRi+NeLWux4NSaY38w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tRgcEoCyzUYScg6tTbYPD1swmYb9z6qX5V3KuEDd+Bk6lv2D00ol7CaehKY5AmYvt I3k6rYabafnTuSsLYMqzmQBat14VTVpMQJ957Zui8x203rT4TPWDRqDpJ49SGr4Lly BFD9Kswuc8Qyvr6RTAdI6832xsoh9wcS8LMW2WwY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108583] [13 Regression] wrong code with vector division by uint16 at -O2 Date: Sun, 12 Mar 2023 18:44:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: tnfchris at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D108583 --- Comment #29 from CVS Commits --- The master branch has been updated by Tamar Christina : https://gcc.gnu.org/g:81fd62d1378b7ddc1fa0967cbddcdcdcdd2d8d8c commit r13-6619-g81fd62d1378b7ddc1fa0967cbddcdcdcdd2d8d8c Author: Tamar Christina Date: Sun Mar 12 18:42:04 2023 +0000 middle-end: Implement preferred_div_as_shifts_over_mult [PR108583] This now implements a hook preferred_div_as_shifts_over_mult that indicates whether a target prefe= rs that the vectorizer decomposes division as shifts rather than multiplication when possible. In order to be able to use this we need to check whether the current precision has enough bits to do the operation without any of the additions overflowing. We use range information to determine this and only do the operation if we're sure am overflow won't occur. This now uses ranger to do this range che= ck. This seems to work better than vect_get_range_info which uses range_que= ry, but I have not switched the interface of vect_get_range_info over in this PR = fix. As Andy said before initializing a ranger instance is cheap but not fre= e, and if the intention is to call it often during a pass it should be instantiat= ed at pass startup and passed along to the places that need it. This is a big refactoring and doesn't seem right to do in this PR. But we should in = GCC 14. Currently we only instantiate it after a long series of much cheaper checks. gcc/ChangeLog: PR target/108583 * target.def (preferred_div_as_shifts_over_mult): New. * doc/tm.texi.in: Document it. * doc/tm.texi: Regenerate. * targhooks.cc (default_preferred_div_as_shifts_over_mult): New. * targhooks.h (default_preferred_div_as_shifts_over_mult): New. * tree-vect-patterns.cc (vect_recog_divmod_pattern): Use it. gcc/testsuite/ChangeLog: PR target/108583 * gcc.dg/vect/vect-div-bitmask-4.c: New test. * gcc.dg/vect/vect-div-bitmask-5.c: New test.=