From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 607F43858429; Mon, 30 Aug 2021 09:28:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 607F43858429 From: "changyp6 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102124] [11/12 Regression] -ftree-loop-vectorize Causing Data To Lose Sign Bit on AARCH64 Platform Date: Mon, 30 Aug 2021 09:28:15 +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: 11.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: changyp6 at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Aug 2021 09:28:15 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102124 --- Comment #4 from Tomas Chang --- (In reply to Jakub Jelinek from comment #3) > Before vectorization the loop body is: > _1 =3D a_19(D) + i_29; > _2 =3D *_1; > _3 =3D (int) _2; > _4 =3D b_20(D) + i_29; > _5 =3D *_4; > _6 =3D (int) _5; > _7 =3D _3 - _6; > ab_21 =3D _7 | ab_25; > _10 =3D _6 - _3; > ba_22 =3D _10 | ba_27; > where _2 and _5 are unsigned char and _3, _6, _7, _10 are int. > It is vectorized as > vect_patt_54.17_61 =3D WIDEN_MINUS_LO_EXPR ; > vect_patt_54.17_62 =3D WIDEN_MINUS_HI_EXPR ; > vect_patt_53.18_63 =3D [vec_unpack_lo_expr] vect_patt_54.17_61; > vect_patt_53.18_64 =3D [vec_unpack_hi_expr] vect_patt_54.17_61; > vect_patt_53.18_65 =3D [vec_unpack_lo_expr] vect_patt_54.17_62; > vect_patt_53.18_66 =3D [vec_unpack_hi_expr] vect_patt_54.17_62; > _7 =3D _3 - _6; > vect_ab_21.19_67 =3D vect_patt_53.18_63 | vect_ab_25.9_13; > vect_ab_21.19_68 =3D vect_patt_53.18_64 | vect_ab_21.19_67; > vect_ab_21.19_69 =3D vect_patt_53.18_65 | vect_ab_21.19_68; > vect_ab_21.19_70 =3D vect_patt_53.18_66 | vect_ab_21.19_69; > ab_21 =3D _7 | ab_25; > which means it is vectorized as if it was instead of (int) _2 - (int) _6 > (int) (unsigned short) ((unsigned short) _2 - (unsigned short) _6). Thank you very much for confirming this issue so quicky! Hope this issue can be fixed soon!=