From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id A37F33858409 for ; Fri, 21 Jul 2023 17:41:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A37F33858409 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6b9ec15e014so1850275a34.0 for ; Fri, 21 Jul 2023 10:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689961297; x=1690566097; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=I9/TQWmrtHaCbP9QL3RopVIzuMjyGjQpRGMoblWUPss=; b=OKJfBBVy1ILpjOvRouVUqcwkMIOTUKZwsVOmdAhKu/ZmEBhYVjObLMOyLaMHN+uyRK JFgIf3Q6SpZ1/WZd4Sc8TVxQ1Szor6Ph4cFEt7g0DQ1ZxCit1mACjDK7BGPFdDEuZdc2 7YVJJW6OgndfUL/9zpitRRW2h9+ZIsHAh4faAaqVgvIXuPaRS2PI8t2MNx6yzM7eaDmh TgI+jl/KM2TE4b+Ql8pkqSRLPivz7JRJCjArWoB2piUumbcORjnlPBW4fHLkMawr7r16 zniFRuf6lpzlru1cM6GwQQTbPudDtga8iWIyTXnPeSFT1dqIjg+2w3sloED1/iDAsTbM gtVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689961297; x=1690566097; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I9/TQWmrtHaCbP9QL3RopVIzuMjyGjQpRGMoblWUPss=; b=AHEYpewl/vtSYTcEtNJO3RMaktndwdvi0GaQox1yub3Q5OsLAhPJPufHzAkv4K/Rp3 7zpPj2D3CAnxK5hdTugQEcIy3Xo4HDhOuIeuZXmNfKchz8TnlwlSdFlNDlfZASC68a6i IeIQyXLJAwdtLBiWHEuvjjsI7IerUM1Gaka09fFxGVAwq5llqrWp+MLNo9ESw4RadY6I auD5wduaGvkHbsalTC7m/BYZaSYvVpiFoJQwRr4gk6K26t8HJIPuccG8SJdUvmJtHrqN CsTBm/+eT4DbysMavBY+O4/whUE7rST0ThLub+k3mcYg3yX55MxH9+gV3cETJ/PaHsqh fyRw== X-Gm-Message-State: ABy/qLbJqg02RmcAJsyiZKCmB8KgiDGxK5P8s94v6PNUoLU91GLHyYjJ I9btL9VLDr9nMDToJW5e3r0gaz6pAJL8UduWOPY= X-Google-Smtp-Source: APBJJlG4F8qfgLl2x1D6SsWLHB70uDlXNXt8Q70FZL1RPzvwVy7dOGZr6ee7TdLV2m/Q/lv2+ULkCqCcjsOAnWK4QMc= X-Received: by 2002:a9d:6849:0:b0:6b8:7584:3aa4 with SMTP id c9-20020a9d6849000000b006b875843aa4mr850131oto.4.1689961296822; Fri, 21 Jul 2023 10:41:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrew Pinski Date: Fri, 21 Jul 2023 10:41:23 -0700 Message-ID: Subject: Re: [PATCH] Reduce floating-point difficulties in timevar.cc To: Matthew Malcomson Cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com, rguenther@suse.de Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Jul 21, 2023 at 5:13=E2=80=AFAM Matthew Malcomson via Gcc-patches wrote: > > On some AArch64 bootstrapped builds, we were getting a flaky test > because the floating point operations in `get_time` were being fused > with the floating point operations in `timevar_accumulate`. > > This meant that the rounding behaviour of our multiplication with > `ticks_to_msec` was different when used in `timer::start` and when > performed in `timer::stop`. These extra inaccuracies led to the > testcase `g++.dg/ext/timevar1.C` being flaky on some hardware. > > This change ensures those operations are not fused and hence stops the te= st > being flaky on that particular machine. There is no expected change in t= he > generated code. > Bootstrap & regtest on AArch64 passes with no regressions. Oh this does explain why powerpc also sees it: https://gcc.gnu.org/PR110316= . I wonder if not adding noinline here but rather changing the code to tolerate the fused multiple-subtract instead which is kinda related to what I suggested in comment #1 in PR 110316. Thanks, Andrew > > gcc/ChangeLog: > > * timevar.cc (get_time): Make this noinline to avoid fusing > behaviour and associated test flakyness. > > > N.b. I didn't know who to include as reviewer -- guessed Richard Biener a= s the > global reviewer that had the most contributions to this file and Richard > Sandiford since I've asked him for reviews a lot in the past. > > > ############### Attachment also inlined for ease of reply ########= ####### > > > diff --git a/gcc/timevar.cc b/gcc/timevar.cc > index d695297aae7f6b2a6de01a37fe86c2a232338df0..5ea4ec259e114f31f611e7105= cd102f4c9552d18 100644 > --- a/gcc/timevar.cc > +++ b/gcc/timevar.cc > @@ -212,6 +212,7 @@ timer::named_items::print (FILE *fp, const timevar_ti= me_def *total) > HAVE_WALL_TIME macros. */ > > static void > +__attribute__((noinline)) > get_time (struct timevar_time_def *now) > { > now->user =3D 0; > > >