From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6096 invoked by alias); 13 Mar 2018 20:35:29 -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 5453 invoked by uid 89); 13 Mar 2018 20:35:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1598 X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Mar 2018 20:35:22 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BADDDFB646 for ; Tue, 13 Mar 2018 20:35:20 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.36.118.110]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E84431102E2C for ; Tue, 13 Mar 2018 20:35:19 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id w2DFO1pE023390; Tue, 13 Mar 2018 16:24:01 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id w2DFNxhE023389; Tue, 13 Mar 2018 16:23:59 +0100 Date: Tue, 13 Mar 2018 20:35:00 -0000 From: Jakub Jelinek To: Martin =?utf-8?B?TGnFoWth?= Cc: gcc-patches@gcc.gnu.org, Marc Glisse , "H.J. Lu" Subject: Re: [PATCH] Prefer mempcpy to memcpy on x86_64 target (PR middle-end/81657). Message-ID: <20180313152359.GB8577@tucnak> Reply-To: Jakub Jelinek References: <5111b095-ebdd-692a-02bf-0e00ec0daf10@suse.cz> <20180313083212.GX8577@tucnak> <45ff50a3-71ac-6028-02dd-d4384ec425ec@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <45ff50a3-71ac-6028-02dd-d4384ec425ec@suse.cz> User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00618.txt.bz2 On Tue, Mar 13, 2018 at 04:19:21PM +0100, Martin Liška wrote: > > Yes, see e.g. TARGET_LIBC_HAS_FUNCTION target hook, > > where in particular linux_libc_has_function deals with various C libraries. > > Of course, in this case you need another target hook, that is dependent both > > on the target backend and C library. > > > > It would be nice to make the target hook a little bit more generic as well, > > e.g. pass it enum builtin_function and query if it is fast, slow or > > unknown, or even some kind of cost, where the caller could ask for cost of > > BUILT_IN_MEMCPY and BUILT_IN_MEMPCPY and decide based on the relative costs. > > Let me start with simple return enum value of FAST,SLOW,UNKNOWN. I've added new hook > definition to gcc/config/gnu-user.h that will point to gnu_libc_function_implementation. > I would like to implement the function in gcc/targhooks.c, but I don't know how to > make ifdef according to target? Put there just the default implementation (everything is UNKNOWN?). > One another issue is that built_in_function is enum defined in tree.h. Thus I'll replace the > callback argument with int, that will be casted. One last issue: am I right that I'll have to define > TARGET_LIBC_FUNCTION_IMPLEMENTATION in each config file (similar to no_c99_libc_has_function)? And define the i386/x86_64 glibc one in config/i386/*.h, check there OPTION_GLIBC and only in that case return something other than UNKNOWN. And redefine TARGET_LIBC_FUNCTION_IMPLEMENTATION only in that case. Jakub