From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14704 invoked by alias); 24 Sep 2014 15:21:37 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 14669 invoked by uid 48); 24 Sep 2014 15:21:33 -0000 From: "rearnsha at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/63359] aarch64: 32bit registers in inline asm Date: Wed, 24 Sep 2014 15:21:00 -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: 4.9.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rearnsha at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-09/txt/msg02281.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63359 --- Comment #8 from Richard Earnshaw --- (In reply to James Molloy from comment #6) > Good example, although I might argue slightly pathological. > Agreed, this is somewhat pathological, but I only need to find one valid counter-example :-) Furthermore, something similar will be quite common on results. Eg: int i, j; unsigned long r; asm("add %w0, %w1, %w2" : "=r"(r) : "r"(i), "r"(j)); // zero-extend result. here we *want* the 64-bit result from the implicit zero-extend of writing the lower 32 bits. > So in this case currently, GCC doesn't even implicitly promote the argument, > just uses it as-is. It seems a very dangerous behaviour to have as default. > Could there not be a more sensible default and an explicit constraint > modifier to allow this instead? One of the things I dislike so much about GCC's inline assembly is that it's just an exposure to users of an internal API in the compiler. That makes it very difficult to say precisely what will happen in all cases and *very* hard to fix problems with it when it exposes bugs. I'm not saying I'll never accept a warning for this sort of code; but I'd need convincing that it won't unduly pessimize real code with no acceptable work-arounds.