From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29326 invoked by alias); 3 May 2011 15:21:53 -0000 Received: (qmail 29317 invoked by uid 22791); 3 May 2011 15:21:52 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,MIME_QP_LONG_LINE,RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from qmta06.emeryville.ca.mail.comcast.net (HELO qmta06.emeryville.ca.mail.comcast.net) (76.96.30.56) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 15:21:34 +0000 Received: from omta15.emeryville.ca.mail.comcast.net ([76.96.30.71]) by qmta06.emeryville.ca.mail.comcast.net with comcast id f2bF1g0021Y3wxoA63MaRg; Tue, 03 May 2011 15:21:34 +0000 Received: from [10.0.0.9] ([24.4.193.8]) by omta15.emeryville.ca.mail.comcast.net with comcast id f3MX1g00d0BKwT48b3MYL2; Tue, 03 May 2011 15:21:32 +0000 References: <20110429025248.90D61B21AB@azwildcat.mtv.corp.google.com> In-Reply-To: Mime-Version: 1.0 (iPad Mail 8H7) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: <18AB1349-F1AD-4AF4-80AA-70E148C33721@comcast.net> Cc: Xinliang David Li , Sriraman Tallam , "reply@codereview.appspotmail.com" , "gcc-patches@gcc.gnu.org" From: Mike Stump Subject: Re: [google] Patch to support calling multi-versioned functions via new GCC builtin. (issue4440078) Date: Tue, 03 May 2011 15:21:00 -0000 To: Richard Guenther 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: 2011-05/txt/msg00186.txt.bz2 On May 3, 2011, at 3:07 AM, Richard Guenther w= rote: >>=20 >> There is no possibility for a high-level dispatch at the source level. >> And if I'd have to design one I would use function overloading, like >>=20 >> float compute_sth (float) __attribute__((version("sse4"))) >> { >> ... sse4 code ... >> } >>=20 >> float compute_sth (float) >> { >> ... fallback ... >> } >>=20 >> float foo (float f) >> { >> return compute_sth (f); >> } >>=20 >> and if you not only want to dispatch for target features you could >> specify a selector function and value in the attribute. You might >> notice that the above eventually matches the target attribute >> directly, just the frontends need to be taught to emit dispatch >> code whenever overload resolution results in ambiguities involving >> target attribute differences. >=20 > Which also would allow the frontend to directly call the sse4 variant > if you compile with -msse4, avoiding the need for any fancy processing. And to go one step further, if we had this, we could use this to define all= data manipulation machine built-ins as generic functions, available to all= compiles as normal c code, so portable code could use them everywhere, and= on platforms that had instructions for any of them, they could define them= as normal built-ins. >=20