From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64946 invoked by alias); 20 Jul 2015 09:05:30 -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 61026 invoked by uid 48); 20 Jul 2015 09:05:27 -0000 From: "gccbugzilla at limegreensocks dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/49611] Inline asm should support input/output of flags Date: Mon, 20 Jul 2015 09:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: inline-asm X-Bugzilla-Version: 4.5.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: gccbugzilla at limegreensocks dot com 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: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg01700.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49611 --- Comment #16 from David --- I've tried it now and it seems to do good things. This code: int main(int argc, char *argv[]) { char x; asm("setc" : "=@ccc"(x)); if (!x) return 6; else return argc; } produces this output (-O3): movl $6, %eax /APP # 6 "./r.cpp" 1 setc # 0 "" 2 /NO_APP cmovc %ebx, %eax addq $32, %rsp popq %rbx ret Although a minor variation (change "return argc" to "return 7") ends up doing setc+cmpb, so it's not a perfect solution. Still, if I were Richard, I'd be closing this bug. If someone has optimization issues with his solution, that's a new bug.