From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 02FDF3858D20; Wed, 15 Nov 2023 14:42:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 02FDF3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700059366; bh=/w7pK5Z74lBeRG5l6M27JgBDzBm8JPCp1y7VtrsYSb4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tF7cyUh2by9WKfbceSTaDcqNkAjqc51IRVjmDdFEhFYXZXyXi54QbMrQYlCN6u9Yi bGvABQuCXZcO8reWahysbHyF2jbzXYNkkq1uS46aTFI9qiZB76L4/O6T7P4/JPcfpJ x0QQacrbMfy5DWcrOtRa9cPQq9FRVAB0xa1dUm6I= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109088] GCC does not always vectorize conditional reduction Date: Wed, 15 Nov 2023 14:42:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW 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=3D109088 --- Comment #20 from rguenther at suse dot de --- On Wed, 15 Nov 2023, juzhe.zhong at rivai dot ai wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109088 >=20 > --- Comment #19 from JuzheZhong --- > I have added: >=20 > + if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (PHI_RESULT (phi))) For TYPE_OVERFLOW_UNDEFINED you have to convert the ops to unsigned to avoid spurious undefined overflow. > + && !(FLOAT_TYPE_P (TREE_TYPE (PHI_RESULT (phi))) > + && !HONOR_SIGNED_ZEROS (TREE_TYPE (PHI_RESULT (phi))) > + && !HONOR_SIGN_DEPENDENT_ROUNDING (TREE_TYPE (PHI_RESULT (= phi))) > + && !HONOR_NANS (TREE_TYPE (PHI_RESULT (phi))))) You should check flag_associative_math which covers one half and !flag_trapping_math which covers spurious FP exceptions. > + return false; >=20 > for floating-point. I failed to see which situation will cause FP excepti= ons ? Ops with NaN cause INVALID, but there's also INEXACT which can be set differently after re-association.=