From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28480 invoked by alias); 28 Dec 2013 00:23:20 -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 28455 invoked by uid 48); 28 Dec 2013 00:23:16 -0000 From: "hpa at zytor dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59615] New: "asm goto" output or at least clobbered operands Date: Sat, 28 Dec 2013 00:23:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: hpa at zytor dot com X-Bugzilla-Status: UNCONFIRMED 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: 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: 2013-12/txt/msg02284.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615 Bug ID: 59615 Summary: "asm goto" output or at least clobbered operands Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: hpa at zytor dot com There are a number of uses of "asm goto" which requires at least on dyadic architectures like x86 the ability to clobber an operand. However, the current definition of "asm goto" doesn't allow any output operands, and the clobber list only works on specific registers (which are generally not allowed to be inputs, anyway.) For example: asm goto("add %1,%0 ; " "jc %l[t_err] ; " "cmp %2,%0 ; " "ja %l[t_err] ; " : "+r" (addr) : "g" (size), "g" (limit) : : t_err); return false; t_err: return true; This is part of a proposed implementation of access_ok(), a limit test with a guard for wraparound, used heavily in the Linux kernel. There needs to be a way to communicate to gcc that "addr" is clobbered by the first instruction.