From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15544 invoked by alias); 29 Sep 2015 22:19:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 15527 invoked by uid 89); 29 Sep 2015 22:19:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f52.google.com Received: from mail-oi0-f52.google.com (HELO mail-oi0-f52.google.com) (209.85.218.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 29 Sep 2015 22:19:50 +0000 Received: by oiww128 with SMTP id w128so12403829oiw.2 for ; Tue, 29 Sep 2015 15:19:48 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.179.69 with SMTP id c66mr226716oif.67.1443565188232; Tue, 29 Sep 2015 15:19:48 -0700 (PDT) Received: by 10.76.175.132 with HTTP; Tue, 29 Sep 2015 15:19:48 -0700 (PDT) In-Reply-To: <1A59492D-2B14-44C0-97BA-08D8A5406672@comcast.net> References: <2AB9494F-91EC-4CF6-945B-0CB03A583513@comcast.net> <1A59492D-2B14-44C0-97BA-08D8A5406672@comcast.net> Date: Tue, 29 Sep 2015 23:08:00 -0000 Message-ID: Subject: Re: [PATCH] x86 interrupt attribute From: "H.J. Lu" To: Mike Stump Cc: Yulia Koval , GCC Patches , Uros Bizjak Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg02278.txt.bz2 On Tue, Sep 29, 2015 at 2:12 PM, Mike Stump wrote: > On Sep 29, 2015, at 1:16 PM, H.J. Lu wrote: >> On Tue, Sep 29, 2015 at 11:49 AM, Mike Stump wro= te: >>> To be feature complete, it would be nice to have two styles of interrup= t functions, one that returns with iret, and one that returns with ret. Th= e point is that the user might want to call functions from a interrupt hand= ler and not save and restore all call clobbered registers. By allowing a r= et style interrupt handler, calls to a ret style interrupt routine can avoi= d saving and restoring all call clobbered registers. >> >> Do you have a testcase for this? I think the current implementation >> covers most use cases. > > When I wrote my interrupt support for my cpu, I ran these through the cod= e generator=E2=80=A6 I have many registers, and noticed saving and restori= ng them all just because two interrupt handlers used the same routine was s= illy. Test case is trivial: > > interrupt void foo2() { > bar(); > } > > interrupt void foo1() { > bar(); > } > > if more than 1-2 registers are saved, then likely it is saving all call u= sed registers. Saving all means that one cannot use functions to compose s= emantics and attain performance. Performance of ISR routines I think is us= eful to shoot for, given that it is easy enough to attain, I don=E2=80=99t = see the harm in doing that. Even if in the first implementation you don=E2= =80=99t bother with performance, if you spec the other function, the user c= ode need never change; and when performance does matter, it is then a mere = matter of enhancing the code gen to do the right thing. It is pretty easy = to get most of the benefit without much work. i call the main interrupt fu= nction interrupt, and the recursive (ret style), I call interruptr. The r = is for recursive. I added: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D66960#c3 Thanks. --=20 H.J.