From patchwork Fri Nov 22 15:41:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 293504 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 895F12C00A4 for ; Sat, 23 Nov 2013 02:43:58 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:cc:date:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=bHb x9fjuEkO0Ad4xPKE0+tKTdX2kCujmFquhEnxaLL0G0jB+M0OrK2WSfouuCWi42IV Ta3SG9B5y+jv/ggHYSC0unFqHeANeOfPBqIgB4LemPQ+j/f3cjn+IN5XpbIlIwDH cdZIGmPk/mPFioeQnhtiE9MHtYi0rOyM9SPt/f7M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:to:cc:date:content-type :content-transfer-encoding:mime-version; s=default; bh=zII91thdl vFsob1MF59FBf5gbVk=; b=G4cQMwXOAuq3TtkW8YWlKJ1XLIb2MpzuN2vmcunV8 ZsSl9mKm+eGmaCI2eg/AaRDK5hfb7sDinYRPmnK6lhO5n+qiUv+qFTL9v3i5xN/K hVS0logcxZM9AZVMCubOpDsjw19QiXMunAAHiPKT+SJylYNVFhj8ALVnVmpji1Sy 0Q= Received: (qmail 3757 invoked by alias); 22 Nov 2013 15:43:48 -0000 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 Received: (qmail 3737 invoked by uid 89); 22 Nov 2013 15:43:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_50, RDNS_NONE autolearn=no version=3.3.2 X-HELO: e28smtp03.in.ibm.com Received: from Unknown (HELO e28smtp03.in.ibm.com) (122.248.162.3) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 22 Nov 2013 15:42:27 +0000 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Nov 2013 21:12:14 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Nov 2013 21:12:12 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id BD5743940058 for ; Fri, 22 Nov 2013 21:12:11 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rAMFg2uS44695758 for ; Fri, 22 Nov 2013 21:12:02 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rAMFg9aW003458 for ; Fri, 22 Nov 2013 21:12:09 +0530 Received: from [9.48.97.196] (sig-9-48-97-196.mts.ibm.com [9.48.97.196]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rAMFfrpH002291; Fri, 22 Nov 2013 21:11:56 +0530 Message-ID: <1385134908.3052.4.camel@gnopaine> Subject: [PATCH, rs6000] Generate correct constant permutes using xxpermdi From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com Date: Fri, 22 Nov 2013 09:41:48 -0600 Mime-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13112215-3864-0000-0000-00000B32D8A8 X-IsSubscribed: yes Hi, Most of our constant vector permutes use the vperm instructions, but for V2DImode and V2DFmode we use xxpermdi. This patch corrects the generated xxpermdi to be correct for little endian, which fixes failures of the test cases gcc.dg/torture/vshuf-v2d[fi].c. Note that we can't fix this directly in the pattern for xxpermdi, because that pattern is used by the corresponding intrinsic. Bootstrapped and tested on powerpc64{,le}-unknown-linux-gnu with no regressions. Ok for trunk? Thanks, Bill 2013-11-22 Bill Schmidt * config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Correct for little endian. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 205243) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -30021,6 +30021,21 @@ rs6000_expand_vec_perm_const_1 (rtx target, rtx op gcc_assert (GET_MODE_NUNITS (vmode) == 2); dmode = mode_for_vector (GET_MODE_INNER (vmode), 4); + /* For little endian, swap operands and invert/swap selectors + to get the correct xxpermdi. The operand swap sets up the + inputs as a little endian array. The selectors are swapped + because they are defined to use big endian ordering. The + selectors are inverted to get the correct doublewords for + little endian ordering. */ + if (!BYTES_BIG_ENDIAN) + { + int n; + perm0 = 3 - perm0; + perm1 = 3 - perm1; + n = perm0, perm0 = perm1, perm1 = n; + x = op0, op0 = op1, op1 = x; + } + x = gen_rtx_VEC_CONCAT (dmode, op0, op1); v = gen_rtvec (2, GEN_INT (perm0), GEN_INT (perm1)); x = gen_rtx_VEC_SELECT (vmode, x, gen_rtx_PARALLEL (VOIDmode, v));