From patchwork Fri Mar 2 15:57:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Bergner X-Patchwork-Id: 144277 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 5DC2AB6EE6 for ; Sat, 3 Mar 2012 02:58:20 +1100 (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=1331308701; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:Message-ID:Subject:From:To: Cc:Date:Content-Type:Content-Transfer-Encoding:Mime-Version: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=Y27wZxOLFMJlO996hYbl x94hPHw=; b=nn8YiVXnf6WMKiZHR2aX3SzsNSGFlFYLrQds/Ea5ZLj97KbbedtP IUDn539HDENBa9ACJ/sVSmkauAWYqLeHlm4FV4vjdSmHyVnpex+iaBBbM6ZKOJm1 LylWP/Inbcxw/zQBHxTl6LwuHnuMFhbB7vACNS17FiYWHL6mOBu9qn0= 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:Received:Received:Received:Received:Received:Message-ID:Subject:From:To:Cc:Date:Content-Type:Content-Transfer-Encoding:Mime-Version:X-Content-Scanned:x-cbid:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KHnxhigPAvvGy/6vpUbmiZ5wEPjG+TXdk5hWY5AAVHDr9vLtYBfW2ujraUvBJR i9SUS8Kg0MSDamDuOi/Tz7jQcvUeW6gfnjqc8CyzPXjlEb4XDBWXQTm50WHpmp0e BUEC+WOICPDFdJRF1IbgxlqfmD8B41qGLL9DkqqCLq3PA=; Received: (qmail 1387 invoked by alias); 2 Mar 2012 15:58:14 -0000 Received: (qmail 1379 invoked by uid 22791); 2 Mar 2012 15:58:13 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e38.co.us.ibm.com (HELO e38.co.us.ibm.com) (32.97.110.159) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Mar 2012 15:57:58 +0000 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Mar 2012 08:57:56 -0700 Received: from d01dlp03.pok.ibm.com (9.56.224.17) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 2 Mar 2012 08:57:43 -0700 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 1D159C90058 for ; Fri, 2 Mar 2012 10:57:42 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q22Fvg9a282250 for ; Fri, 2 Mar 2012 10:57:42 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q22Fvf9o012671 for ; Fri, 2 Mar 2012 10:57:41 -0500 Received: from [192.168.1.103] (vorma.rchland.ibm.com [9.10.86.174]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q22Fvbva012358; Fri, 2 Mar 2012 10:57:37 -0500 Message-ID: <1330703856.29904.3.camel@otta> Subject: [PATCH, rs6000][trunk, 4.7, 4.6, 4.5] Fix PR52457, wrong code for -O1 -m32 -mcpu=power7 From: Peter Bergner To: "gcc-patches@gcc.gnu.org" Cc: David Edelsohn , Michael Meissner Date: Fri, 02 Mar 2012 09:57:36 -0600 Mime-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12030215-5518-0000-0000-000002AF6655 X-IsSubscribed: yes 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 The patch below fixes a typo in the vsx_set_ pattern that causes wrong code to be generated when using -mcpu=power7. This passed bootstrap and regression testing on trunk using powerpc64-linux. Ok for trunk? This is also broken on the 4.7, 4.6 and 4.5 branches, is this ok for those release branches once the branches are open for fixes and my bootstrapping/regtesting are complete? Peter * gcc/config/rs6000/vsx.md (vsx_set_): Reorder operands. * gcc/testsuite/gcc.target/powerpc/pr52457.c: New test. Index: gcc/config/rs6000/vsx.md =================================================================== --- gcc/config/rs6000/vsx.md (revision 184791) +++ gcc/config/rs6000/vsx.md (working copy) @@ -1119,9 +1119,9 @@ (define_insn "vsx_set_" "VECTOR_MEM_VSX_P (mode)" { if (INTVAL (operands[3]) == 0) - return \"xxpermdi %x0,%x1,%x2,1\"; + return \"xxpermdi %x0,%x2,%x1,1\"; else if (INTVAL (operands[3]) == 1) - return \"xxpermdi %x0,%x2,%x1,0\"; + return \"xxpermdi %x0,%x1,%x2,0\"; else gcc_unreachable (); } Index: gcc/testsuite/gcc.target/powerpc/pr52457.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/pr52457.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/pr52457.c (revision 0) @@ -0,0 +1,34 @@ +/* { dg-do run { target { powerpc*-*-linux* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-O1 -mcpu=power7" } */ + +extern void abort (void); + +typedef long long T; +typedef T vl_t __attribute__((vector_size(2 * sizeof (T)))); + +vl_t +buggy_func (T x) +{ + vl_t w; + T *p = (T *)&w; + p[0] = p[1] = x; + return w; +} + +int +main(void) +{ + vl_t rval; + T *pl; + + pl = (T *) &rval; + rval = buggy_func (2); + + if (pl[0] != 2 || pl[1] != 2) + abort (); + + return 0; +}