From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 79677385DC1E; Wed, 15 Apr 2020 17:10:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79677385DC1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586970654; bh=vQ08pdXM54oXRVCzi2liTb2MqCOKIkKdLkk1Aq6CRK8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=L8S+XE+GMznUfeM14Z30NQptcOP3ij2KyX4/Z6e7vKoe07AQ7QqDMlWnJfqPDAEOB 4WhzwDTfmj8s9OlewpM3FIZjS6z2QZHgiqaq70I5D70vFNPG5FFZ0E5WWMUOxuBuHy euRvQIHfOobYuGo6jnhYx1KpXDGEaeLYfmzBvNYc= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/94567] [10 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu Date: Wed, 15 Apr 2020 17:10:54 +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: 10.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: law at redhat dot com X-Bugzilla-Target-Milestone: 10.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 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: Wed, 15 Apr 2020 17:10:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94567 --- Comment #10 from Jakub Jelinek --- So something like: --- gcc/config/i386/i386.md.jj 2020-03-16 22:56:55.556043275 +0100 +++ gcc/config/i386/i386.md 2020-04-15 19:07:04.405933639 +0200 @@ -8732,8 +8732,20 @@ && ix86_match_ccmode (insn, /* *testdi_1 requires CCZmode if the mask has bit 31 set and all bits above it clear. */ - GET_MODE (operands[2]) =3D=3D DImode - && INTVAL (operands[3]) + INTVAL (operands[4]) =3D= =3D 32 + (GET_MODE (operands[2]) =3D=3D DImode + && INTVAL (operands[3]) + INTVAL (operands[4]) = =3D=3D 32) + /* If zero_extract mode precision is the same + as len, the SF of the zero_extract + comparison will be the most significant + extracted bit, but this could be matched + after splitting only for pos 0 len all bits + trivial extractions. Require CCZmode. */ + || (GET_MODE_PRECISION (mode) + =3D=3D INTVAL (operands[3])) + /* Otherwise, require CCZmode if we'd use a mask + with the most significant bit set. */ + || (INTVAL (operands[3]) + INTVAL (operands[4]) + =3D=3D GET_MODE (operands[2])) ? CCZmode : CCNOmode)" "#" "&& 1" @@ -8758,7 +8770,12 @@ } /* Small HImode tests can be converted to QImode. */ - if (register_operand (val, HImode) && pos + len <=3D 8) + if (register_operand (val, HImode) + && (pos + len < 8 + /* If the mask would include all bits, ensure we don't + care about the SF. */ + || (pos + len =3D=3D 8 + && GET_MODE (operands[0]) =3D=3D CCZmode))) { val =3D gen_lowpart (QImode, val); mode =3D QImode;=