From patchwork Fri Feb 21 17:56:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 322978 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8D0DF2C0331 for ; Sat, 22 Feb 2014 04:56:08 +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=RZ3 kUHvmTxi8Ai+UU8TfHxJZwpvC6TVh0Tzdr/U29gQrha+908LY7h6tCtD7uLaqaNG 0pEpgdaOyoRSVSCySanrAqoQSFoXFMgBMCZAA6dgQLebGYiri0LJ2UBP97BYTh7Q 92aw5ET+w7XSEHpIn+Abl1k2BGwIFFZRxTriHvKs= 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=HvLceWmrv IMdbYp3KLeRIMPSzwc=; b=i5JiN8AfP7YZ2AqWaYrOZ/VDwhlrQGHMAjHvIYZ8f KVQvRThidrWkFwNg4yiZDrszNjfcuIHITeEHq0dTUQDlHcQLUgd/Svx5auh7s2yK 9MeqhGSWymhVI2k5PLdU683rI329wvTWH204lQ7zQJCXgfIk3Wa8222xk/02KC0M A8= Received: (qmail 26210 invoked by alias); 21 Feb 2014 17:56:01 -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 26201 invoked by uid 89); 21 Feb 2014 17:56:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e28smtp05.in.ibm.com Received: from e28smtp05.in.ibm.com (HELO e28smtp05.in.ibm.com) (122.248.162.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 21 Feb 2014 17:55:59 +0000 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Feb 2014 23:25:54 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp05.in.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 21 Feb 2014 23:25:52 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 641BB394005A for ; Fri, 21 Feb 2014 23:25:52 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s1LHtgg43145996 for ; Fri, 21 Feb 2014 23:25:43 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s1LHtpDh013268 for ; Fri, 21 Feb 2014 23:25:51 +0530 Received: from [9.77.131.26] (sig-9-77-131-26.mts.ibm.com [9.77.131.26]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s1LHtm6r013166; Fri, 21 Feb 2014 23:25:50 +0530 Message-ID: <1393005370.20991.56.camel@gnopaine> Subject: [PATCH, rs6000] vec_sums must define all result vector elements From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: dje.gcc@gmail.com Date: Fri, 21 Feb 2014 11:56:10 -0600 Mime-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14022117-8256-0000-0000-00000B96397C X-IsSubscribed: yes Hi, The little-endian implementation of vec_sums is incorrect. I had misread the specification and thought that the fields not containing the result value were undefined, but in fact they are defined to contain zero. My previous implementation used a vector splat to copy the field from BE element 3 to LE element 3. The corrected implementation will use a vector shift left to move the field and fill the remaining fields with zeros. When I fixed this, I discovered I had also missed a use of gen_altivec_vsumsws, which should now use gen_altivec_vsumsws_direct instead. This is fixed in this patch as well. Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions. Bootstrap and regression test on powerpc64-unknown-linux-gnu is in progress. If no big-endian regressions are found, is this ok for trunk? Thanks, Bill gcc: 2014-02-21 Bill Schmidt * config/rs6000/altivec.md (altivec_vsumsws): Replace second vspltw with vsldoi. (reduc_uplus_v16qi): Use gen_altivec_vsumsws_direct instead of gen_altivec_vsumsws. gcc/testsuite: 2014-02-21 Bill Schmidt * gcc.dg/vmx/vsums.c: Check entire result vector. * gcc.dg/vmx/vsums-be-order.c: Likewise. Index: gcc/config/rs6000/altivec.md =================================================================== --- gcc/config/rs6000/altivec.md (revision 207967) +++ gcc/config/rs6000/altivec.md (working copy) @@ -1651,7 +1651,7 @@ if (VECTOR_ELT_ORDER_BIG) return "vsumsws %0,%1,%2"; else - return "vspltw %3,%2,0\n\tvsumsws %3,%1,%3\n\tvspltw %0,%3,3"; + return "vspltw %3,%2,0\n\tvsumsws %3,%1,%3\n\tvsldoi %0,%3,%3,12"; } [(set_attr "type" "veccomplex") (set (attr "length") @@ -2483,7 +2539,7 @@ emit_insn (gen_altivec_vspltisw (vzero, const0_rtx)); emit_insn (gen_altivec_vsum4ubs (vtmp1, operands[1], vzero)); - emit_insn (gen_altivec_vsumsws (dest, vtmp1, vzero)); + emit_insn (gen_altivec_vsumsws_direct (dest, vtmp1, vzero)); DONE; }) Index: gcc/testsuite/gcc.dg/vmx/vsums-be-order.c =================================================================== --- gcc/testsuite/gcc.dg/vmx/vsums-be-order.c (revision 207967) +++ gcc/testsuite/gcc.dg/vmx/vsums-be-order.c (working copy) @@ -8,12 +8,13 @@ static void test() #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ vector signed int vb = {128,0,0,0}; + vector signed int evd = {136,0,0,0}; #else vector signed int vb = {0,0,0,128}; + vector signed int evd = {0,0,0,136}; #endif vector signed int vd = vec_sums (va, vb); - signed int r = vec_extract (vd, 3); - check (r == 136, "sums"); + check (vec_all_eq (vd, evd), "sums"); } Index: gcc/testsuite/gcc.dg/vmx/vsums.c =================================================================== --- gcc/testsuite/gcc.dg/vmx/vsums.c (revision 207967) +++ gcc/testsuite/gcc.dg/vmx/vsums.c (working copy) @@ -4,9 +4,9 @@ static void test() { vector signed int va = {-7,11,-13,17}; vector signed int vb = {0,0,0,128}; + vector signed int evd = {0,0,0,136}; vector signed int vd = vec_sums (va, vb); - signed int r = vec_extract (vd, 3); - check (r == 136, "sums"); + check (vec_all_eq (vd, evd), "sums"); }