From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8382 invoked by alias); 8 May 2009 18:44:32 -0000 Received: (qmail 8369 invoked by uid 22791); 8 May 2009 18:44:30 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM X-Spam-Check-By: sourceware.org Received: from e6.ny.us.ibm.com (HELO e6.ny.us.ibm.com) (32.97.182.146) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 May 2009 18:44:26 +0000 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e6.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n48IkXcX010724 for ; Fri, 8 May 2009 14:46:33 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n48IiNfg202226 for ; Fri, 8 May 2009 14:44:23 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n48IiNqB018768 for ; Fri, 8 May 2009 14:44:23 -0400 Received: from hungry-tiger.westford.ibm.com (hungry-tiger.westford.ibm.com [9.33.20.67]) by d01av03.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n48IiNe9018738; Fri, 8 May 2009 14:44:23 -0400 Received: by hungry-tiger.westford.ibm.com (Postfix, from userid 500) id B83E31EE9AC; Fri, 8 May 2009 14:44:22 -0400 (EDT) Date: Fri, 08 May 2009 21:05:00 -0000 From: Michael Meissner To: DJ Delorie Cc: Andrew Pinski , gcc@gcc.gnu.org Subject: Re: opaque vector types? Message-ID: <20090508184422.GA18919@hungry-tiger.westford.ibm.com> Mail-Followup-To: Michael Meissner , DJ Delorie , Andrew Pinski , gcc@gcc.gnu.org References: <200905060604.n4664Skm024765@greed.delorie.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i X-IsSubscribed: yes 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: 2009-05/txt/msg00230.txt.bz2 On Wed, May 06, 2009 at 02:29:46AM -0400, DJ Delorie wrote: > > Andrew Pinski writes: > > You could do what the rs6000 back-end does for the altivec builtins > > and resolve them while the parser is run (the SPU back-end does the > > same thing too). Yes there are opaque vector types, you just use > > build_opaque_vector_type instead of build_vector_type. > > Thanks, I'll look at those. Any way to prototype such functions in C ? As Andrew says the rs6000/spu have the notion of overloaded builtins. I've been working in this area somewhat for the power7 port, and you might want to look at my power7-branch. In rs6000.h it uses REGISTER_TARGET_PRAGMAS to set the resolve_overloaded_builtin target hook: /* Target pragma. */ #define REGISTER_TARGET_PRAGMAS() do { \ c_register_pragma (0, "longcall", rs6000_pragma_longcall); \ targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin; \ } while (0) In rs6000-c.c you have the function that tries to resolve the builtin given the argument types: tree altivec_resolve_overloaded_builtin (tree fndecl, void *passed_arglist) { ... } It returns a tree of the builtin function with the appropriate types. In the code, there is a giant table (altivec_overloaded_builtins) that maps the generic builtin functions to the specific ones based on the argument types. For example, altivec has a builtin function that does absolute value for any vector type, and internally it converts this to the appropriate builtin for each type: const struct altivec_builtin_types altivec_overloaded_builtins[] = { /* Unary AltiVec/VSX builtins. */ { ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 }, { ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 }, { ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 }, { ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 }, ... }; -- Michael Meissner, IBM 4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA meissner@linux.vnet.ibm.com