From patchwork Tue May 8 18:39:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Glisse X-Patchwork-Id: 157802 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AC3B9B6FA0 for ; Wed, 9 May 2012 04:40:22 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1337107223; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:cc:Subject:In-Reply-To:Message-ID:References:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=iFN/4448FWqWum3OuNiFrjXjxvw=; b=AmVlQCjd3kkQDF/ oja622IZQ5aZ2/ZL4Zvs6/ZMyaXINgTKQkyi0vW9WMD1S8twnEPSM5PP7XEGGEmi afdrIbsMfj9kMKLqZs1yK+zI8XdUFCs66lCHWutO/CcnXh4uumvD6Kvjt1Ny/EGY l26l56XUoz/CB87lpCY/e8AFqVIE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KknOe9Bxdk+9mVa/4Zx4FiwsHVirVHDy9n3y87AKfNZynNG2gJKVHJNfCJnHts hDpptFkNNH3jPcFOtdKuF/EGK36MbXXReKCSUPaudq/I6cU7LDHfhVknyv769MW5 VtQUZGk1y6K4/D1UEz947mG0uzV2EeSSsET9sKUo/S1Gs=; Received: (qmail 21159 invoked by alias); 8 May 2012 18:40:15 -0000 Received: (qmail 21147 invoked by uid 22791); 8 May 2012 18:40:12 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail1-relais-roc.national.inria.fr (HELO mail1-relais-roc.national.inria.fr) (192.134.164.82) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 May 2012 18:39:45 +0000 Received: from ip-254.net-81-220-143.rev.numericable.fr (HELO laptop-mg.local) ([81.220.143.254]) by mail1-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 08 May 2012 20:39:43 +0200 Date: Tue, 8 May 2012 20:39:21 +0200 (CEST) From: Marc Glisse To: Richard Sandiford cc: gcc-patches@gcc.gnu.org Subject: Re: [rtl, patch] combine concat+shuffle In-Reply-To: <87d36epnjs.fsf@talisman.home> Message-ID: References: <87d36epnjs.fsf@talisman.home> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Tue, 8 May 2012, Richard Sandiford wrote: > Marc Glisse writes: >> Here is a new version. >> >> gcc/ChangeLog >> 2012-05-08 Marc Glisse >> >> * simplify-rtx.c (simplify_binary_operation_1): Optimize shuffle >> of concatenations. > > OK, thanks. I'll leave an x86 maintainer to review the testcase, > but it looks like it'll need some markup to ensure an SSE target. Oups, I'd thought about that, then completely forgot. For 64 bits, it always works. For 32 bits, it requires -msse2 -mfpmath=sse (without -mfpmath=sse we can still test for shufpd, but apparently not unpcklpd, I could remove that second test if people prefer, as it isn't important). Since this is a compile-only test, I think this would be enough: /* { dg-options "-O -msse2 -mfpmath=sse" } */ >> Note to self: if you want to grep for "shuf" in the asm, don't put "shuf" >> in the name of the file... > > Yeah :-) For MIPS tests I tend to add "\t" to the beginning of the regexp. > (And to the end if possible.) Good idea. I was trying to make the check as wide as possible, but that's not so useful. Attached a new version of the testcase. Index: gcc.target/i386/shuf-concat.c =================================================================== --- gcc.target/i386/shuf-concat.c (revision 0) +++ gcc.target/i386/shuf-concat.c (revision 0) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O -msse2 -mfpmath=sse" } */ + +typedef double v2df __attribute__ ((__vector_size__ (16))); + +v2df f(double d,double e){ + v2df x={-d,d}; + v2df y={-e,e}; + return __builtin_ia32_shufpd(x,y,1); +} + +/* { dg-final { scan-assembler-not "\tv?shufpd\t" } } */ +/* { dg-final { scan-assembler-times "\tv?unpcklpd\t" 1 } } */