From patchwork Sat Oct 20 22:27:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 29822 Received: (qmail 63067 invoked by alias); 20 Oct 2018 22:27:23 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63053 invoked by uid 89); 20 Oct 2018 22:27:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=timestamp, H*f:sk:w@mail., UD:x86intrin.h, x86intrinh X-HELO: mail-oi1-f171.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yrsWBnYEYxXP3k1V79I2C/psCeefe86h+E3mta5eQJU=; b=r2ro0fSUxYqYgEGOtAr2DMkdWd1WQteefH3/VWZnEs7jDGDwtZ6+2OhLFTjMteHxUJ uRPXQ5OWJYvsu0ALIPFhl0tXa95ySR60Uc0KAJ7Fyaz1v92vssYZTeriDaTt3qMct/CB RGCjzEWjlcxqtBtGrMRrc/E4IIjPRPPZxyLnGhKFHAj1/UBlBqRTL0Z3e1qi1kuqrNNL dQeOBBHmKo9fDobSqVzqT6eseGBjn2vdEc9c0tHiaBmoZtM9JTa7s1p7yXFmVDFcpFa+ MxsjN/5CMqbzZMAwpxvBG8H22EON8dJjFd9UiRGH6U/0sjiZKPrKce/Y/AOkonT9IFwN h2Fw== MIME-Version: 1.0 In-Reply-To: <87bm7oegrs.fsf@mid.deneb.enyo.de> References: <20181001220836.20131-1-hjl.tools@gmail.com> <2b463e8a-4f78-2850-0375-425803b96f83@linaro.org> <87ftx0ehh2.fsf@mid.deneb.enyo.de> <87bm7oegrs.fsf@mid.deneb.enyo.de> From: "H.J. Lu" Date: Sat, 20 Oct 2018 15:27:18 -0700 Message-ID: Subject: Re: V2 [PATCH] x86: Use _rdtsc intrinsic for HP_TIMING_NOW To: Florian Weimer Cc: Adhemerval Zanella , GNU C Library On 10/20/18, Florian Weimer wrote: > * Florian Weimer: > > >> I'm trying to remove the #include from >> , but I don't know how hard this will be. > > That doesn't help. It's pulled in via and as well. > We would need a separate header file to avoid that > because hp_timing_t is required in a few central places (thread > descriptor and link map). > Please try this. From a4fac17d8bc95fc405faa1fac0a383719b72bccf Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 20 Oct 2018 15:22:01 -0700 Subject: [PATCH] x86: Don't include Use __builtin_ia32_rdtsc directly since including is very slow with GCC 6. * sysdeps/x86/hp-timing.h: Don't include . (HP_TIMING_NOW): Replace _rdtsc with __builtin_ia32_rdtsc. --- sysdeps/x86/hp-timing.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sysdeps/x86/hp-timing.h b/sysdeps/x86/hp-timing.h index 1c20e9d828..950a2feb6b 100644 --- a/sysdeps/x86/hp-timing.h +++ b/sysdeps/x86/hp-timing.h @@ -22,8 +22,6 @@ #include #if MINIMUM_ISA == 686 || MINIMUM_ISA == 8664 -# include - /* We always assume having the timestamp register. */ # define HP_TIMING_AVAIL (1) # define HP_SMALL_TIMING_AVAIL (1) @@ -38,8 +36,11 @@ typedef unsigned long long int hp_timing_t; might not be 100% accurate since there might be some more instructions running in this moment. This could be changed by using a barrier like 'cpuid' right before the `rdtsc' instruciton. But we are not interested - in accurate clock cycles here so we don't do this. */ -# define HP_TIMING_NOW(Var) ((Var) = _rdtsc ()) + in accurate clock cycles here so we don't do this. + + NB: Use __builtin_ia32_rdtsc directly since including + is very slow with GCC 6. */ +# define HP_TIMING_NOW(Var) ((Var) = __builtin_ia32_rdtsc ()) # include #else -- 2.17.2