From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43013 invoked by alias); 15 Apr 2016 16:43:05 -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 42963 invoked by uid 89); 15 Apr 2016 16:43:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=sk:CONSTAN, Hx-languages-length:1066 X-HELO: mail3-relais-sop.national.inria.fr Received: from mail3-relais-sop.national.inria.fr (HELO mail3-relais-sop.national.inria.fr) (192.134.164.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 15 Apr 2016 16:43:03 +0000 Received: from 81-65-27-132.rev.numericable.fr (HELO laptop-mg.local) ([81.65.27.132]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2016 18:42:59 +0200 Date: Fri, 15 Apr 2016 16:43:00 -0000 From: Marc Glisse Reply-To: gcc-patches@gcc.gnu.org To: "Hurugalawadi, Naveen" cc: Richard Biener , Senthil Kumar Selvaraj , "gcc-patches@gcc.gnu.org" , "Pinski, Andrew" Subject: Re: PATCH] Fix PR 31531: A microoptimization of isnegative of signed integer In-Reply-To: Message-ID: References: <87egcn7eae.fsf@atmel.com> , User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-SW-Source: 2016-04/txt/msg00762.txt.bz2 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1896,10 +1896,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (for cmp (simple_comparison) scmp (swapped_simple_comparison) (simplify - (cmp (bit_not@2 @0) CONSTANT_CLASS_P@1) + (cmp (convert?@3 (bit_not@2 @0)) CONSTANT_CLASS_P@1) (if (single_use (@2) - && (TREE_CODE (@1) == INTEGER_CST || TREE_CODE (@1) == VECTOR_CST)) - (scmp @0 (bit_not @1))))) + && (TREE_CODE (@1) == INTEGER_CST || TREE_CODE (@1) == VECTOR_CST) + && (TYPE_PRECISION (TREE_TYPE (@3)) == TYPE_PRECISION (TREE_TYPE (@2))) + && tree_nop_conversion_p (type, TREE_TYPE (@0))) + (with { tree newtype = TREE_TYPE (@1); } + (scmp (view_convert:newtype @0) (bit_not @1)))))) Could you explain in English what you are doing? 'type' is always the outer type, in this case the result of the comparison, could be boolean for instance. Asking for tree_nop_conversion_p between @0 and that type seems strange. Also, you are not allowed to use TYPE_PRECISION on a vector type. -- Marc Glisse