From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 506BC3858D28; Sun, 9 Apr 2023 17:08:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 506BC3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681060095; bh=zRTvyZ499ZbINsLIzejCqpoFiTN410tqmNP9Io68MZo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VYE5zO3SYCnVEEuXtGxvb4hHo3Md4ZYRHS84A6Q48Rn+DhsyMiuDMI23QcVW5ukY+ khzCzG1EsPzjSy23CPIW6kLpsBS99H40Ovq6CIXFJs6kP9wrEaCiXXUjhYeg3Wz379 /37B7eA86U3ajFR+gJBpmDphOdU9PE6WMbil4hdA= From: "seeson at pku dot edu.cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109457] %z[asmSymbolicName] in AssemblerTemplate fails to compile Date: Sun, 09 Apr 2023 17:08:14 +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: seeson at pku dot edu.cn X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED 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: resolution cc 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 lyazj changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |FIXED CC| |seeson at pku dot edu.cn --- Comment #2 from lyazj --- ](In reply to Andrew Pinski from comment #1) > This has nothing to do with [x] but rather the constraint g and z operand > modifier. >=20 > The g constraint is defined as: > Any register, memory or immediate integer operand is allowed, except for > registers that are not general registers. >=20 >=20 >=20 > So constant 1 will be allowed here. >=20 > 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 >=20 > Note integer constants don't have a size ... >=20 >=20 > 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; > } >=20 >=20 >=20 > 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. Thanks very much for the quick and concise solution. I'm sorry that I missed the truth that I could have probably put the modifier `z` on an immediate a= nd did the substitution that broke the equivalence to the original code. Howev= er, since the modifier is case-sensitive, I suggest revising the error reporting routines to report the improper modifier 'z' instead of 'Z' looked like a b= ug. :)=