From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5082 invoked by alias); 3 Aug 2011 04:59:29 -0000 Received: (qmail 5074 invoked by uid 22791); 3 Aug 2011 04:59:28 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,SPF_NEUTRAL X-Spam-Check-By: sourceware.org Received: from relmlor1.renesas.com (HELO relmlor1.renesas.com) (210.160.252.171) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Aug 2011 04:59:13 +0000 Received: from relmlir1.idc.renesas.com ([10.200.68.151]) by relmlor1.idc.renesas.com ( SJSMS) with ESMTP id <0LPC00LRH5UND0A0@relmlor1.idc.renesas.com> for gcc@gcc.gnu.org; Wed, 03 Aug 2011 13:59:11 +0900 (JST) Received: from relmlac3.idc.renesas.com ([10.200.69.23]) by relmlir1.idc.renesas.com (SJSMS) with ESMTP id <0LPC00MBH5UNN5C0@relmlir1.idc.renesas.com> for gcc@gcc.gnu.org; Wed, 03 Aug 2011 13:59:11 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 3751018077; Wed, 03 Aug 2011 13:59:11 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 314E918071; Wed, 03 Aug 2011 13:59:11 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id PAF01802; Wed, 03 Aug 2011 13:59:11 +0900 Received: from unknown (HELO relay21.aps.necel.com) ([10.29.19.50]) by relmlii1.idc.renesas.com with ESMTP; Wed, 03 Aug 2011 13:59:11 +0900 Received: from relay21.aps.necel.com ([10.29.19.50] [10.29.19.50]) by relay21.aps.necel.com with ESMTP; Wed, 03 Aug 2011 13:59:11 +0900 Received: from dhlpc061 ([10.114.96.19] [10.114.96.19]) by relay21.aps.necel.com with ESMTP; Wed, 03 Aug 2011 13:59:11 +0900 Received: by dhlpc061 (Postfix, from userid 31295) id DF7EA52E237; Wed, 03 Aug 2011 13:59:10 +0900 (JST) From: Miles Bader To: Richard Guenther Cc: Hans-Peter Nilsson , Mikael Pettersson , Michael Walle , Georg-Johann Lay , Richard Henderson , gcc@gcc.gnu.org Subject: Re: libgcc: strange optimization References: <201108012230.29989.michael@walle.cc> <4E371AC5.5090509@redhat.com> <20023.47611.116809.875356@pilspetsen.it.uu.se> <4E37CAFB.5010401@gjlay.de> <27466ae6b9a714679fcba410cce130ba.squirrel@ssl.serverraum.org> <20023.59456.782598.31450@pilspetsen.it.uu.se> System-Type: x86_64-unknown-linux-gnu Blat: Foop Date: Wed, 03 Aug 2011 04:59:00 -0000 In-reply-to: Message-id: MIME-version: 1.0 Content-type: text/plain Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg00062.txt.bz2 Richard Guenther writes: > But then can't people use a pure assembler stub instead? Without > inlining there isn't much benefit left from writing > > void f1(int arg) > { > register int a1 asm("r8") = 10; > register int a2 asm("r1") = arg; > > asm("scall" : : "r"(a1), "r"(a2)); > } > > instead of > > f1: > mov r8, 10 > mov r1, rX > scall > ret > > in a .s file no? I doubt much prologue/epilogue is needed. > > Or even write > > void f1(int arg) > { > asm("mov r8, %0; mov r1 %1; scall;" : : "g"(a1), "g"(a2) : "r8", "r1"); > } Of course in practice people _do_ want to use it with f1 inlined, where using reg variables (or alternatively, some expanded constraint language for the asm parameters) can really get rid of tons of unnecessary asm moves, and they want the compiler to guard against conflicts. -Miles -- "Whatever you do will be insignificant, but it is very important that you do it." Mahatma Gandhi