From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 22D4B386F430; Wed, 15 Jul 2020 09:29:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22D4B386F430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594805346; bh=/aibsRI7hPY7jMCatuWvDGOMfdy9UuBM8S5OETzasFw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JCjd2tiKV6xt7u5+wnDdDBe/EqdKksqbSikdfkySsF4Hp2FPDQIPWwkvXLPvF71xR LaeGNZQ3kdxQNcvpjm5lsDdhkL+6osLf5pm1Ofzlj/vSO1TM9YHzVAolBhTJtEI+OT JQdCLGUCINwNagdiEfQV+HBjZd3QJHpY3qI27zU4= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/96176] Failure to omit extraneous movzx in atomic compare exchange with unsigned char Date: Wed, 15 Jul 2020 09:29:06 +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.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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 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 Jul 2020 09:29:06 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96176 --- Comment #3 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:410675cb63466d8de9ad590521f0766b012d2475 commit r11-2103-g410675cb63466d8de9ad590521f0766b012d2475 Author: Jakub Jelinek Date: Wed Jul 15 11:26:22 2020 +0200 builtins: Avoid useless char/short -> int promotions before atomics [PR96176] As mentioned in the PR, we generate a useless movzbl insn before lock cmpxchg. The problem is that the builtin for the char/short cases has the argume= nts promoted to int and combine gives up, because the instructions have MEM_VOLATILE_P arguments and recog in that case doesn't recognize anyth= ing when volatile_ok is false, and nothing afterwards optimizes the (reg:SI a) =3D (zero_extend:SI (reg:QI a)) ... (subreg:QI (reg:SI a) 0) ... The following patch fixes it at expansion time, we already have a funct= ion that is meant to undo the promotion, so this just adds the very common = case to that. 2020-07-15 Jakub Jelinek PR target/96176 * builtins.c: Include gimple-ssa.h, tree-ssa-live.h and tree-outof-ssa.h. (expand_expr_force_mode): If exp is a SSA_NAME with different m= ode from MODE and get_gimple_for_ssa_name is a cast from MODE, use = the cast's rhs. * gcc.target/i386/pr96176.c: New test.=