From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13239 invoked by alias); 25 Oct 2017 16:29:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 13230 invoked by uid 89); 25 Oct 2017 16:29:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Oct 2017 16:29:16 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 973A1C059B62; Wed, 25 Oct 2017 16:29:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 973A1C059B62 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law@redhat.com Received: from localhost.localdomain (ovpn-112-30.phx2.redhat.com [10.3.112.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28EB76FAAD; Wed, 25 Oct 2017 16:29:14 +0000 (UTC) Subject: Re: [02/nn] Add more vec_duplicate simplifications To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org References: <87wp3mxgir.fsf@linaro.org> <87o9oyxgdf.fsf@linaro.org> From: Jeff Law Message-ID: Date: Wed, 25 Oct 2017 16:35:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <87o9oyxgdf.fsf@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg01825.txt.bz2 On 10/23/2017 05:17 AM, Richard Sandiford wrote: > This patch adds a vec_duplicate_p helper that tests for constant > or non-constant vector duplicates. Together with the existing > const_vec_duplicate_p, this complements the gen_vec_duplicate > and gen_const_vec_duplicate added by a previous patch. > > The patch uses the new routines to add more rtx simplifications > involving vector duplicates. These mirror simplifications that > we already do for CONST_VECTOR broadcasts and are needed for > variable-length SVE, which uses: > > (const:M (vec_duplicate:M X)) > > to represent constant broadcasts instead. The simplifications do > trigger on the testsuite for variable duplicates too, and in each > case I saw the change was an improvement. E.g.: > [ snip ] > > The best way of testing the new simplifications seemed to be > via selftests. The patch cribs part of David's patch here: > https://gcc.gnu.org/ml/gcc-patches/2016-07/msg00270.html . Cool. I really wish I had more time to promote David's work by adding selftests to various things. There's certainly cases where it's the most direct and useful way to test certain bits of lower level infrastructure we have. Glad to see you found it useful here. > > > 2017-10-23 Richard Sandiford > David Malcolm > Alan Hayward > David Sherwood > > gcc/ > * rtl.h (vec_duplicate_p): New function. > * selftest-rtl.c (assert_rtx_eq_at): New function. > * selftest-rtl.h (ASSERT_RTX_EQ): New macro. > (assert_rtx_eq_at): Declare. > * selftest.h (selftest::simplify_rtx_c_tests): Declare. > * selftest-run-tests.c (selftest::run_tests): Call it. > * simplify-rtx.c: Include selftest.h and selftest-rtl.h. > (simplify_unary_operation_1): Recursively handle vector duplicates. > (simplify_binary_operation_1): Likewise. Handle VEC_SELECTs of > vector duplicates. > (simplify_subreg): Handle subregs of vector duplicates. > (make_test_reg, test_vector_ops_duplicate, test_vector_ops) > (selftest::simplify_rtx_c_tests): New functions. Thanks for the examples of how this affects various targets. Seems like it ought to be a consistent win when they trigger. jeff