From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 431213858D28; Wed, 12 Apr 2023 11:07:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 431213858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681297650; bh=xF2NfmRDCO3tl1CTr6c6pT6pKQ84cvoTCPI4aPjKDHI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=myPojgjRq1wfKwK7Z5J85sZSK+H2e0UagO3u31ZX0Sfp3k8XLb+XIbH2IA6pRsfuc UORInXRAV20nxOxEGfdsuI/WGa1JbWqyNGTHfrqy9dbA6lYzmwRgmpmNSqE0FhmhD8 kA1HlL1ZcWFP5jaUA8CMHZrjPpDLyUx24+Uw9zrM= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109484] [Wrong Code][inline-asm] output operands overlap with output Date: Wed, 12 Apr 2023 11:07:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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=3D109484 --- Comment #3 from Richard Biener --- (In reply to =E3=80=82 from comment #2) > (In reply to Richard Biener from comment #1) > > but you clobber 'temp' early and fail to indicate that so GCC allocates= the > > same register as part of the "+m" output. >=20 > The requirements you describe are not reflected in the documentation. The > document only says that `GCC assumpts that the assembler code consumes its > inputs before producing outputs`, and this code fits the assumption. Firs= t, > it reads the input from %1, then write the output to %0, then write the > output to %1. No outputs happend before inputs. You first write to 'temp' and then read from it. The wording applies to the assigned register / address, _not_ to the C variables mapped. Note I'm not an expert here and I wonder if an output operand is the appropriate way to create a scratch register for arbitrary use.=