From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BF5E93858D33; Sun, 9 Apr 2023 16:48:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF5E93858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681058927; bh=Jx8YF6Dj63AUHupa0tOm/5ioYzo8HN1h8D8Jz3z6mpk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=op+q7T+MaCyx4leQVmfmu43hYREt0e/ahOcfkfoX8KPqz1qXsfhOZE8azK2eVus8d KBQScsdc9/t2Ao3VM6hW/+S6fdLF3WQ3qahwwwKOHisuRrbPNY+yuazkhmLkKogQ1g gMdDCPvsZqi5O52OpxXfyGOTgqFw1kX6MzNEm1kw= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109457] %z[asmSymbolicName] in AssemblerTemplate fails to compile Date: Sun, 09 Apr 2023 16:48:47 +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.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: bug_status resolution 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=3D109457 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski --- This has nothing to do with [x] but rather the constraint g and z operand modifier. The g constraint is defined as: Any register, memory or immediate integer operand is allowed, except for registers that are not general registers. So constant 1 will be allowed here. While the modifier z says: z Print the opcode suffix for the size of the current integer operand (one of b/w/l/q). %z0 l Note integer constants don't have a size ... This is the corrected inline-asm: template inline T onec_add(T a, T b) { asm( "add%z[a]\t%[b], %[a]" "\n\tadc%z[a]\t$0, %[a]" : [a]"+g"(a) // inputs : [b]"g"(b) // outputs : "cc" // clobbers ); return a; } Note I see you did the replacement of [a] and [b] in your example but when = you replaced %z[b], you replaced it with %z0 rather than what it was originally which was %z1.=