From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29240 invoked by alias); 15 Aug 2010 22:00:23 -0000 Received: (qmail 29227 invoked by uid 22791); 15 Aug 2010 22:00:22 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-iw0-f175.google.com (HELO mail-iw0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 15 Aug 2010 22:00:18 +0000 Received: by iwn38 with SMTP id 38so1015426iwn.20 for ; Sun, 15 Aug 2010 15:00:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.15.70 with SMTP id j6mr4545417iba.141.1281909616417; Sun, 15 Aug 2010 15:00:16 -0700 (PDT) Received: by 10.231.16.139 with HTTP; Sun, 15 Aug 2010 15:00:16 -0700 (PDT) In-Reply-To: References: Date: Sun, 15 Aug 2010 22:05:00 -0000 Message-ID: Subject: Re: Vector comparison From: Richard Guenther To: "Joseph S. Myers" Cc: Artem Shinkarov , gcc-patches@gcc.gnu.org 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: 2010-08/txt/msg01128.txt.bz2 On Sun, Aug 15, 2010 at 10:03 PM, Joseph S. Myers wrote: > On Sun, 15 Aug 2010, Artem Shinkarov wrote: > >> On Sun, Aug 15, 2010 at 7:45 PM, Joseph S. Myers >> wrote: >> > On Sun, 15 Aug 2010, Artem Shinkarov wrote: >> > >> >> This patch implements vector comparison according to OpenCL standard. >> > >> > Suppose your target's vector comparison instructions encode the result >> > some way other than a vector of 0 and -1 values. =A0How effectively ca= n such >> > instructions be used in the context of your patch? >> >> SSE and AltiVec at least define vector comparison result as a vector >> of 0 and -1. So I think that this would be an exotic architecture (but >> I'm not sure). Anyway, if the target returns boolean value, then the > > I'm thinking in particular of TI C64X (which can probably be considered an > exotic architecture in lots of ways), where vector comparisons set the > low-order two or four bits of the target register and then you need a > separate XPND2 or XPND4 instruction to convert this to a vector with 0 and > -1 values. =A0The comparison instructions are single-cycle while XPND2 and > XPND4 are two-cycle instructions; it would be nice to avoid excess > instructions where possible. =A0(The GCC port for C6X exists based on 4.4 > but isn't yet ready for upstream submission; I sent the binutils port > upstream in March.) The current patch would support this by always emitting builtins for the separate XPND2/4 instructions. Dependent on the use (I expect that openCL code will mostly use the comparison result as a mask, not reduce it to a single bool) the not needed result could be optimized by combine. Richard. > -- > Joseph S. Myers > joseph@codesourcery.com