From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15729 invoked by alias); 16 Jun 2011 17:03:30 -0000 Received: (qmail 15721 invoked by uid 22791); 16 Jun 2011 17:03:30 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,TW_TQ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jun 2011 17:03:14 +0000 Received: (qmail 11577 invoked from network); 16 Jun 2011 17:03:13 -0000 Received: from unknown (HELO digraph.polyomino.org.uk) (joseph@127.0.0.2) by mail.codesourcery.com with ESMTPA; 16 Jun 2011 17:03:13 -0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1QXFyJ-0006lT-08; Thu, 16 Jun 2011 17:03:11 +0000 Date: Thu, 16 Jun 2011 17:08:00 -0000 From: "Joseph S. Myers" To: Georg-Johann Lay cc: gcc-patches@gcc.gnu.org, Denis Chertykov , Anatoly Sokolov , "Eric B. Weddington" Subject: Re: [Patch, AVR]: QI builtins for parity, popcount, 1<< n In-Reply-To: <4DFA26FE.1000400@gjlay.de> Message-ID: References: <4DFA26FE.1000400@gjlay.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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-06/txt/msg01275.txt.bz2 On Thu, 16 Jun 2011, Georg-Johann Lay wrote: > The recent implementation of some asm function in libgcc added > __popcountqi2 and __parityqi2. This patch makes these functions > available as __builtin_avr_popcount8 resp. __builtin_avr_parity8. > > Moreover, just out of a mood, I wrote a builtin for 1< 1< a fast, loop-free implementation. I hope this whole patch is just intended as an example of how to add built-in functions and not as a serious proposal for an addition to GCC, since it doesn't make sense to add machine-specific built-in functions for things that can so readily be represented in generic GNU C; instead, you should make generic GNU C generate the right code (for example, by handling __builtin_parity and __builtin_popcount smartly on zero-extended values if QImode patterns are available - if it doesn't already do so). -- Joseph S. Myers joseph@codesourcery.com