From patchwork Wed Jul 17 11:55:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 1133284 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-505203-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="c/iAqX+U"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iMks+/J0"; 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 45pbMb0D2Fz9s00 for ; Wed, 17 Jul 2019 21:56:25 +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 :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=lojwOwofLAyIWZq0Na1DaqReDIDEif3ozj1NysQmTBFEGq kEiObmTHn4LQlmsZQHTcr9eO1ZRM/HXO1oREDSn/HRvS6oV+wEWVu/sBqDSqkqa4 c/wxVVmyN264SrWpwHnDGlBti2essUxdpXqP/Ba/2lQwJAaOIJQ03xDh3RJ5w= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=DWPfMDeGKIU6NJ+1KD6aIiij8i4=; b=c/iAqX+Ur//KPJrdz7NO muk1CaxwP4bgStw9yoP60oy5+dkbvHy+2iOOMSXw7D8LPCiR/VzbbGumGnPEkvan JB23o1hFML54TZj8mBvJ0FfUi76lybPkBiCiUQIT8/5EZyrWuiX3Gi8ubB/ucizm IiGnSui9S0ZIjWm7ARyNC8A= Received: (qmail 122702 invoked by alias); 17 Jul 2019 11:56:17 -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 122684 invoked by uid 89); 17 Jul 2019 11:56:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-lj1-f175.google.com Received: from mail-lj1-f175.google.com (HELO mail-lj1-f175.google.com) (209.85.208.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Jul 2019 11:56:15 +0000 Received: by mail-lj1-f175.google.com with SMTP id m23so23288105lje.12 for ; Wed, 17 Jul 2019 04:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=0iYQPPY0DNTS6KveUJ4sZtoSb9bHSkTFfunkzRmN9Ak=; b=iMks+/J0VDCsd7Hy9WV7fUP/c/0Z+DbZjCZW/zUG46upADdCD1tYVn3NtqCjB5JrRF y/ujI7Kbw7T07xdi+qMf7REcG2680doOD+DiOGTEj8oNmT74VvYD6xUBf18IBZ25FpWA xgum0c00fJ+3A9WrKhUA5sMqva/HaooYKNEq7L+AM2apoYGzjcknkwtCBEgbIlmrTuxW RpTNOJ2hWlNj6LtkJ4I0W6i37gvwfoXL9MW1ylxCbt90oJlSEaGYWVcfleuf3UbQH/fP tXGiPZHS41W0BNq+AatSBSeXGpb77WPgPxkJtO/S7nMBggzpQR0SDPkh3NJ9P8c9YZ6R pDdw== MIME-Version: 1.0 From: Prathamesh Kulkarni Date: Wed, 17 Jul 2019 17:25:36 +0530 Message-ID: Subject: PR91166 - Unfolded ZIPs of constants To: Richard Sandiford , Richard Biener , gcc Patches X-IsSubscribed: yes Hi, The attached patch tries to fix PR91166. Does it look OK ? Bootstrap+test in progress on aarch64-linux-gnu and x86_64-unknown-linux-gnu. Thanks, Prathamesh 2019-07-17 Prathamesh Kulkarni PR middle-end/91166 * match.pd (vec_perm_expr(v, v, mask) -> v): New pattern. (define_predicates): Add entry for uniform_vector_p. testsuite/ * gcc.target/aarch64/sve/pr91166.c: New test. diff --git a/gcc/match.pd b/gcc/match.pd index 4a7aa0185d8..2ad98c28fd8 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -36,7 +36,8 @@ along with GCC; see the file COPYING3. If not see integer_valued_real_p integer_pow2p uniform_integer_cst_p - HONOR_NANS) + HONOR_NANS + uniform_vector_p) /* Operator lists. */ (define_operator_list tcc_comparison @@ -5568,3 +5569,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) { bitsize_int (at * tree_to_uhwi (TYPE_SIZE (TREE_TYPE (type)))); }) (if (changed) (vec_perm { op0; } { op1; } { op2; })))))))))) + +/* VEC_PERM_EXPR (v, v, mask) -> v where v contains same element. */ +(simplify + (vec_perm (vec_duplicate@0 @1) @0 @2) + { @0; }) + +(simplify + (vec_perm uniform_vector_p@0 @0 @1) + { @0; }) diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr91166.c b/gcc/testsuite/gcc.target/aarch64/sve/pr91166.c new file mode 100644 index 00000000000..42654be3b31 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr91166.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=armv8.2-a+sve -fdump-tree-optimized" } */ + +void +f1 (double x[][4]) +{ + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) + x[i][j] = 0; +} + +void +f2 (double x[][4], double y) +{ + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) + x[i][j] = y; +} + +/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized"} } */