From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39306 invoked by alias); 7 Nov 2015 05:09:41 -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 39278 invoked by uid 89); 7 Nov 2015 05:09:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 07 Nov 2015 05:09:40 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id C6848A4502; Sat, 7 Nov 2015 05:09:38 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-107.phx2.redhat.com [10.3.113.107]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA759cLu019101; Sat, 7 Nov 2015 00:09:38 -0500 Subject: Re: Move const char * -> int/fp folds to fold-const-call.c To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com References: <87wptvrw3m.fsf@e105548-lin.cambridge.arm.com> From: Jeff Law Message-ID: <563D8791.6090808@redhat.com> Date: Sat, 07 Nov 2015 05:09:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <87wptvrw3m.fsf@e105548-lin.cambridge.arm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00762.txt.bz2 On 11/06/2015 08:22 AM, Richard Sandiford wrote: > This patch moves folds that deal with constant string arguments and > return a constant integer or floating-point value. For example, it > handles strcmp ("foo", "bar") but not strstr ("foobar", "bar"), > which wouldn't currently be accepted by the gimple folders. > > The builtins.c folding for strlen (via c_strlen) is a bit more general > than what the fold-const-call.c code does (and more general than we need > for the gimple folders). I've therefore left it as-is, even though it > partially duplicates the new code. > > Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi. > OK to install? > > Thanks, > Richard > > > gcc/ > * builtins.c (fold_builtin_nan): Delete. > (fold_builtin_memcmp): Remove case where both arguments are constant. > (fold_builtin_strcmp, fold_builtin_strncmp): Likewise. > (fold_builtin_strspn, fold_builtin_strcspn): Likewise. > (fold_builtin_1): Remove BUILT_IN_NAN* handling. > * fold-const-call.c: Include fold-const.h. > (host_size_t_cst_p): New function. > (build_cmp_result, fold_const_builtin_nan): Likewise. > (fold_const_call_1): New function, split out from... > (fold_const_call): ...here (for all three interfaces). Handle > constant nan, nans, strlen, strcmp, strncmp, strspn and strcspn. > OK. jeff