From patchwork Thu Apr 25 16:02:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelvin Nilsen X-Patchwork-Id: 1090950 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-499671-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="s6JY0PDa"; dkim-atps=neutral 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 44qhmc52F8z9s00 for ; Fri, 26 Apr 2019 02:03:12 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=L7hqF anLOfq61IEJsNFE3gccHRNtsQk8PdZEAZdyE/YrnbalFW9aw/2PaBEcUcQvShwWL I66ubRlVBVFb2JoTmDRHsPTjSH+xoVxY37CSyuedJWrgrzhTtPw8BFhrLwBX2t1R lyfZd/2Fj9f2zYl1oTCCN8ExJSfcyq7cZG1Drc= 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:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=3uLE/cs2vvO iByZBEd3HSneryOc=; b=s6JY0PDaw2CVsjRe0FkbUE5v8Dx5dTxQgBzHyMKm3d4 SI4vtHiGcHO3ENsJh32PJQH5n5kySjmkhrN7mBynifpbNofANPfl/ya0DWtq6bF+ X8P9/CpNO9VeQe2Ior5NBEY+xvO7i66FhigoiXxN8TNof9rAGhUuHhqzwh/IpLto = Received: (qmail 44766 invoked by alias); 25 Apr 2019 16:03:05 -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 44753 invoked by uid 89); 25 Apr 2019 16:03:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=capability, sk:dgrequ, sk:dg-requ, kelvingccgnuorg X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Apr 2019 16:03:03 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3PG2bBN052794 for ; Thu, 25 Apr 2019 12:03:01 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2s3edu4xst-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Apr 2019 12:02:50 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Apr 2019 17:02:14 +0100 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 25 Apr 2019 17:02:12 +0100 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3PG2BmO2687454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Apr 2019 16:02:11 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 726546E04E; Thu, 25 Apr 2019 16:02:11 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 383546E065; Thu, 25 Apr 2019 16:02:11 +0000 (GMT) Received: from kelvins-mbp-2.rchland.ibm.com (unknown [9.10.86.53]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 25 Apr 2019 16:02:11 +0000 (GMT) To: gcc-patches List Cc: segher@gcc.gnu.org From: Kelvin Nilsen Subject: [PATCH, rs6000] PR89424: __builtin_vec_ext_v1ti (v, i) results in ICE with variable i (RS6000) Date: Thu, 25 Apr 2019 11:02:09 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 x-cbid: 19042516-0012-0000-0000-0000172BE7C0 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010993; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000285; SDB=6.01194235; UDB=6.00626110; IPR=6.00975064; MB=3.00026594; MTD=3.00000008; XFM=3.00000015; UTC=2019-04-25 16:02:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19042516-0013-0000-0000-00005701DDAD Message-Id: The attached patch resolves the issue described in this problem report. The patch has been bootstrapped and tested without regressions on powerpc64le-unknown-linux-gnu (both P8 and P9) and on powerpc64-linux (P7 and P8, both -m32 and -m64). Is this ok for trunk and backports? Thanks. gcc/ChangeLog: 2019-04-25 Kelvin Nilsen PR target/89424 * config/rs6000/rs6000.c (rs6000_expand_vector_extract): Add handling of V1TImode. gcc/testsuite/ChangeLog: 2019-04-25 Kelvin Nilsen PR target/89424 * gcc.target/powerpc/pr89424-0.c: New test. * gcc.target/powerpc/vsx-builtin-13a.c: Define macro PR89424 to enable testing of newly patched capability. * gcc.target/powerpc/vsx-builtin-13b.c: Likewise. * gcc.target/powerpc/vsx-builtin-20a.c: Likewise. * gcc.target/powerpc/vsx-builtin-20b.c: Likewise. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 270513) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -6944,6 +6944,10 @@ rs6000_expand_vector_extract (rtx target, rtx vec, switch (mode) { + case E_V1TImode: + emit_move_insn (target, gen_lowpart (TImode, vec)); + return; + case E_V2DFmode: emit_insn (gen_vsx_extract_v2df_var (target, vec, elt)); return; Index: gcc/testsuite/gcc.target/powerpc/pr89424-0.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/pr89424-0.c (nonexistent) +++ gcc/testsuite/gcc.target/powerpc/pr89424-0.c (working copy) @@ -0,0 +1,78 @@ +/* { dg-do run { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { } } */ +/* { dg-options "-mvsx" } */ + +/* This test should run the same on any target that supports vsx + instructions. Intentionally not specifying cpu in order to test + all code generation paths. */ + +#include + +extern void abort (void); + +/* Define PR89626 after that pr is addressed. */ +#ifdef PR89626 +#define SIGNED +#else +#define SIGNED signed +#endif + +#define CONST0 (((__int128) 31415926539) << 60) + +/* Test that indices > length of vector are applied modulo the vector + length. */ + + +/* Test for variable selector and vector residing in register. */ +__attribute__((noinline)) +__int128 ei (vector SIGNED __int128 v, int i) +{ + return __builtin_vec_ext_v1ti (v, i); +} + +/* Test for variable selector and vector residing in memory. */ +__int128 mei (vector SIGNED __int128 *vp, int i) +{ + return __builtin_vec_ext_v1ti (*vp, i); +} + +int main (int argc, char *argv[]) { + vector SIGNED __int128 dv = { CONST0 }; + __int128 d; + + d = ei (dv, 0); + if (d != CONST0) + abort (); + + d = ei (dv, 1); + if (d != CONST0) + abort (); + + d = ei (dv, 2); + if (d != CONST0) + abort (); + + d = ei (dv, 3); + if (d != CONST0) + abort (); + + d = mei (&dv, 0); + if (d != CONST0) + abort (); + + d = mei (&dv, 1); + if (d != CONST0) + abort (); + + d = mei (&dv, 2); + if (d != CONST0) + abort (); + + d = mei (&dv, 3); + if (d != CONST0) + abort (); + + return 0; +} Index: gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c (revision 270513) +++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-13a.c (working copy) @@ -9,7 +9,7 @@ #include /* Define this after PR89424 is addressed. */ -#undef PR89424 +#define PR89424 /* Define this after PR89626 is addressed. */ #undef PR89626 Index: gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c (revision 270513) +++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-13b.c (working copy) @@ -9,7 +9,7 @@ #include /* Define this after PR89424 is addressed. */ -#undef PR89424 +#define PR89424 /* Define this after PR89626 is addressed. */ #undef PR89626 Index: gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c (revision 270513) +++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-20a.c (working copy) @@ -9,7 +9,7 @@ #include /* Define this after PR89424 is addressed. */ -#undef PR89424 +#define PR89424 extern void abort (void); Index: gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c (revision 270513) +++ gcc/testsuite/gcc.target/powerpc/vsx-builtin-20b.c (working copy) @@ -9,7 +9,7 @@ #include /* Define this after PR89424 is addressed. */ -#undef PR89424 +#define PR89424 extern void abort (void);