From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ED665385086D; Thu, 13 Oct 2022 09:57:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED665385086D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665655056; bh=Zy/nR1izZx2mqsZrywMU39OD02S2oTcmwFzFTbttM+U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jRtBTM843foUH+Trp3ubjjtZP1KffI6puytQGyMgGgOGT4OjRSa0tOYVzs45jOqpw 3loXedQGk7mSjTtTJSymR0fgqKXKfHcKT2CN0SJfYHoPcck+Bwvk4dXLMF351RkWzR SIeJvYSCF6RrZj79NnZfKsFBir1IHpIEBEmK2RLI= From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/107160] [13 regression] r13-2641-g0ee1548d96884d causes verification failure in spec2006 Date: Thu, 13 Oct 2022 09:57:35 +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: linkw at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: linkw at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D107160 Kewen Lin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org, | |rsandifo at gcc dot gnu.org --- Comment #7 from Kewen Lin --- One reduced test case is: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D #include #include #define N 128 float fl[N]; __attribute__ ((noipa, optimize (0))) void init () { for (int i =3D 0; i < N; i++) fl[i] =3D i; } __attribute__ ((noipa)) float foo (int n1) { float sum0, sum1, sum2, sum3; sum0 =3D sum1 =3D sum2 =3D sum3 =3D 0.0f; int n =3D (n1 / 4) * 4; for (int i =3D 0; i < n; i +=3D 4) { sum0 +=3D fabs (fl[i]); sum1 +=3D fabs (fl[i + 1]); sum2 +=3D fabs (fl[i + 2]); sum3 +=3D fabs (fl[i + 3]); } return sum0 + sum1 + sum2 + sum3; } __attribute__ ((optimize (0))) int main () { init (); float res =3D foo (80); __builtin_printf ("res:%f\n", res); return 0; } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 incorrect result "res:670.000000" vs expected result "res:3160.000000" It looks it exposes one bug in vectorization reduction support. The reducti= on epilogue handling looks wrong, it generates gimple code like: # vect_sum3_31.16_101 =3D PHI # vect_sum3_31.16_102 =3D PHI # vect_sum3_31.16_103 =3D PHI # vect_sum3_31.16_104 =3D PHI _105 =3D BIT_FIELD_REF ; _106 =3D BIT_FIELD_REF ; _107 =3D BIT_FIELD_REF ; _108 =3D BIT_FIELD_REF ; _109 =3D BIT_FIELD_REF ; _110 =3D BIT_FIELD_REF ; _111 =3D BIT_FIELD_REF ; _112 =3D BIT_FIELD_REF ; ... it doesn't consider the reduced results vect_sum3_31.16_10{1,2,3,4} from the loop can be reduced again in loop exit block as they are in the same slp gr= oup.=