From patchwork Thu Apr 25 16:40:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kelvin Nilsen X-Patchwork-Id: 1090993 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-499673-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="RnJ6iQKn"; 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 44qjbk6h0xz9s7T for ; Fri, 26 Apr 2019 02:40:32 +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=nFraA kTGxeOJuU7Vz3XLS2yTkj2M3gOKHPafV0l+t3ENFCZYi3lY61HD3ZGLrLyPXNqAE kzI5CqJ9RXzg+fumqFR0HBHvGmLz0pY6Rn8sFCkb62fMJGmsAKtmCDqbXn5AUtWN NSO/H2+ak4F9D32j7VyHmrRc/1CDybwtsJCqxg= 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=iwVO86vs1Ky /6ZmAPrRLdg0O3Tg=; b=RnJ6iQKnjugbntpLGZfEiRPR6EsuqlZDkVH8k3xxl0h 0q3JxacL2FJvyn16N/cQpUv8ZZlUCw8zDtlRvCgkjMvGJfchbrwvbNKwywHCyRT7 d6bnCbJiPHUED9HELZt2jNx9kD6xaG1Ovff3+qcJTeaXiuBA9EiGABz6PnyyVUbg = Received: (qmail 67798 invoked by alias); 25 Apr 2019 16:40:24 -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 67789 invoked by uid 89); 25 Apr 2019 16:40:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 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= 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:40:22 +0000 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3PGZIKN123311 for ; Thu, 25 Apr 2019 12:40:21 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0a-001b2d01.pphosted.com with ESMTP id 2s3eysd598-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Apr 2019 12:40:21 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 25 Apr 2019 17:40:20 +0100 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e36.co.us.ibm.com (192.168.1.136) 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:40:18 +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 x3PGeHUk3408138 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Apr 2019 16:40:17 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E9606E093; Thu, 25 Apr 2019 16:40:17 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15E4C6E073; Thu, 25 Apr 2019 16:40:17 +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:40:16 +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:40:15 -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-0020-0000-0000-00000EDCEF60 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.01194248; UDB=6.00626118; IPR=6.00975076; MB=3.00026594; MTD=3.00000008; XFM=3.00000015; UTC=2019-04-25 16:40:20 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19042516-0021-0000-0000-00006590E7D7 Message-Id: <9e43261e-c4fd-e0d9-bf59-ce75b6c01f30@linux.ibm.com> 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-unknown-linux-gnu (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);