From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13651 invoked by alias); 27 Apr 2012 14:39:04 -0000 Received: (qmail 13487 invoked by uid 22791); 27 Apr 2012 14:39:02 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-qc0-f175.google.com (HELO mail-qc0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 Apr 2012 14:38:48 +0000 Received: by qcso7 with SMTP id o7so423533qcs.20 for ; Fri, 27 Apr 2012 07:38:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.135.202 with SMTP id o10mr2813450qct.84.1335537528070; Fri, 27 Apr 2012 07:38:48 -0700 (PDT) Received: by 10.229.136.69 with HTTP; Fri, 27 Apr 2012 07:38:47 -0700 (PDT) In-Reply-To: References: <20120307004630.A503DB21B6@azwildcat.mtv.corp.google.com> Date: Fri, 27 Apr 2012 14:39:00 -0000 Message-ID: Subject: Re: User directed Function Multiversioning via Function Overloading (issue5752064) From: "H.J. Lu" To: Sriraman Tallam Cc: Richard Guenther , Jan Hubicka , Uros Bizjak , reply@codereview.appspotmail.com, gcc-patches@gcc.gnu.org, David Li Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2012-04/txt/msg01775.txt.bz2 On Fri, Apr 27, 2012 at 7:35 AM, Sriraman Tallam wrot= e: > On Fri, Apr 27, 2012 at 6:38 AM, H.J. Lu wrote: >> On Thu, Apr 26, 2012 at 10:08 PM, Sriraman Tallam = wrote: >>> Hi, >>> >>> =A0 I have made the following changes in this new patch which is attach= ed: >>> >>> * Use target attribute itself to create function versions. >>> * Handle any number of ISA names and arch=3D =A0args to target attribut= e, >>> generating the right dispatchers. >>> * Integrate with the CPU runtime detection checked in this week. >>> * Overload resolution: If the caller's target matches any of the >>> version function's target, then a direct call to the version is >>> generated, no need to go through the dispatching. >>> >>> Patch also available for review here: >>> http://codereview.appspot.com/5752064 >>> >> >> Does it work with >> >> int foo (); >> int foo () __attribute__ ((targetv("arch=3Dcorei7"))); >> >> int (*foo_p) () =3D foo? > > Yes, this will work. foo_p will be the address of the dispatcher > function and hence doing (*foo_p)() will call the right version. Even when foo_p is a global variable and compiled with -fPIC? Thanks. --=20 H.J.