From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36418 invoked by alias); 17 Dec 2015 17:38:59 -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 36406 invoked by uid 89); 17 Dec 2015 17:38:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=H*u:31.2.0, H*UA:31.2.0 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Dec 2015 17:38:56 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 25F55491; Thu, 17 Dec 2015 09:38:30 -0800 (PST) Received: from [10.2.206.200] (e100706-lin.cambridge.arm.com [10.2.206.200]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 331573F21A; Thu, 17 Dec 2015 09:38:54 -0800 (PST) Message-ID: <5672F32C.8020306@foss.arm.com> Date: Thu, 17 Dec 2015 17:38:00 -0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: James Greenhalgh CC: GCC Patches , Marcus Shawcroft , Richard Earnshaw Subject: Re: [PATCH][AArch64][1/2] PR rtl-optimization/68796 Add compare-of-zero_extract pattern References: <5672D688.7010403@foss.arm.com> <20151217172420.GA40748@arm.com> In-Reply-To: <20151217172420.GA40748@arm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2015-12/txt/msg01801.txt.bz2 Hi James, On 17/12/15 17:24, James Greenhalgh wrote: > On Thu, Dec 17, 2015 at 03:36:40PM +0000, Kyrill Tkachov wrote: >> 2015-12-17 Kyrylo Tkachov >> >> PR rtl-optimization/68796 >> * config/aarch64/aarch64.md (*and3nr_compare0_zextract): >> New pattern. >> * config/aarch64/aarch64.c (aarch64_select_cc_mode): Handle >> ZERO_EXTRACT comparison with zero. >> (aarch64_mask_from_zextract_ops): New function. >> * config/aarch64/aarch64-protos.h (aarch64_mask_from_zextract_ops): >> New prototype. >> >> 2015-12-17 Kyrylo Tkachov >> >> PR rtl-optimization/68796 >> * gcc.target/aarch64/tst_3.c: New test. >> * gcc.target/aarch64/tst_4.c: Likewise. > Two comments. > >> diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h >> index 87d6eb1358845527d7068550925949802a7e48e2..febca98d38d5f09c97b0f79adc55bb29eca217b9 100644 >> --- a/gcc/config/aarch64/aarch64-protos.h >> +++ b/gcc/config/aarch64/aarch64-protos.h >> @@ -330,6 +330,7 @@ int aarch64_uxt_size (int, HOST_WIDE_INT); >> int aarch64_vec_fpconst_pow_of_2 (rtx); >> rtx aarch64_final_eh_return_addr (void); >> rtx aarch64_legitimize_reload_address (rtx *, machine_mode, int, int, int); >> +rtx aarch64_mask_from_zextract_ops (rtx, rtx); >> const char *aarch64_output_move_struct (rtx *operands); >> rtx aarch64_return_addr (int, rtx); >> rtx aarch64_simd_gen_const_vector_dup (machine_mode, int); >> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c >> index cb8955d5d6c909e8179bb1ab8203eb165f55e4b6..58a9fc68f391162ed9847d7fb79d70d3ee9919f5 100644 >> --- a/gcc/config/aarch64/aarch64.c >> +++ b/gcc/config/aarch64/aarch64.c >> @@ -4147,7 +4147,9 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y) >> && y == const0_rtx >> && (code == EQ || code == NE || code == LT || code == GE) >> && (GET_CODE (x) == PLUS || GET_CODE (x) == MINUS || GET_CODE (x) == AND >> - || GET_CODE (x) == NEG)) >> + || GET_CODE (x) == NEG >> + || (GET_CODE (x) == ZERO_EXTRACT && CONST_INT_P (XEXP (x, 1)) >> + && CONST_INT_P (XEXP (x, 2))))) >> return CC_NZmode; >> >> /* A compare with a shifted operand. Because of canonicalization, >> @@ -10757,6 +10759,21 @@ aarch64_simd_imm_zero_p (rtx x, machine_mode mode) >> return x == CONST0_RTX (mode); >> } >> >> + >> +/* Return the bitmask CONST_INT to select the bits required by a zero extract >> + operation of width WIDTH at bit position POS. */ >> + >> +rtx >> +aarch64_mask_from_zextract_ops (rtx width, rtx pos) >> +{ > It is up to you, but would this not more naturally be: > > unsigned HOST_WIDE_INT > aarch64_mask_from_zextract_ops (rtx width, rtx pos) > > Given how it gets used elsewhere? It gets used in exactly two places, once in the condition of the pattern where we have to extract its UINTVAL and once when outputting the assembly string where we want the rtx wrapper around it to assign it to operands[1], so I'd argue it's a 50-50 choice. So I'll leave it as it is unless you have a strong preference. >> + gcc_assert (CONST_INT_P (width)); >> + gcc_assert (CONST_INT_P (pos)); >> + >> + unsigned HOST_WIDE_INT mask >> + = ((unsigned HOST_WIDE_INT)1 << UINTVAL (width)) - 1; > Space between (unsigned HOST_WIDE_INT) and 1. > Consider it done. Thanks, Kyrill >> + return GEN_INT (mask << UINTVAL (pos)); >> +} >> + >> bool >> aarch64_simd_imm_scalar_p (rtx x, machine_mode mode ATTRIBUTE_UNUSED) >> { > Otherwise, this is OK. > > Thanks, > James >