From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 68DA03834357 for ; Wed, 14 Dec 2022 08:16:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 68DA03834357 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671005773; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=VOQJoxdZxk0NksgK1ZZ0QyXIFlvoVjCkMtm1EQPP/Tk=; b=WFFFm8U8GMQlSarkzoSlA/oRM5hdYPWazvbjDeXtYKU5G7A1PvF8rcMwcLs+iiZlhunu7k 1Heu72fHL+sm/FXn/bq7czPKBTX9ojHhi5YQMtGzDk0AYqMe4zOgW0lg6jX5HW83e3Zjd9 dKlvIrJFnazkrmUuMwV6S1fsfyWaVe8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-595-ZU3NGP0GNh62-5F_Gs2sXw-1; Wed, 14 Dec 2022 03:16:08 -0500 X-MC-Unique: ZU3NGP0GNh62-5F_Gs2sXw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 649E2811E6E; Wed, 14 Dec 2022 08:16:08 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1040379A1; Wed, 14 Dec 2022 08:16:07 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2BE8G3Dj1133778 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 14 Dec 2022 09:16:03 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2BE8G2uF1133777; Wed, 14 Dec 2022 09:16:02 +0100 Date: Wed, 14 Dec 2022 09:16:01 +0100 From: Jakub Jelinek To: Richard Biener Cc: liuhongt , gcc-patches@gcc.gnu.org, crazylht@gmail.com, hjl.tools@gmail.com, ubizjak@gmail.com Subject: Re: [PATCH] [x86] x86: Don't add crtfastmath.o for -shared and add a new option -mdaz-ftz to enable FTZ and DAZ flags in MXCSR. Message-ID: Reply-To: Jakub Jelinek References: <20221214021842.1015348-1-hongtao.liu@intel.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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 Wed, Dec 14, 2022 at 09:08:02AM +0100, Richard Biener via Gcc-patches wrote: > On Wed, Dec 14, 2022 at 3:21 AM liuhongt via Gcc-patches > wrote: > > > > Don't add crtfastmath.o for -shared to avoid changing the MXCSR > > register when loading a shared library. crtfastmath.o will be used > > only when building executables. > > > > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. > > Ok for trunk? > > You reject negative -mdaz-ftz but wouldn't that be useful with > -Ofast -mno-daz-ftz since there's otherwise no way to avoid that? Agreed. I even wonder if the best wouldn't be to make the option effectively three state, default, no and yes, where if the option isn't specified at all, then crtfastmath.o* is linked as is now except for -shared, if it is -mno-daz-ftz, then it is never linked in regardless of other options and if it is -mdaz-ftz, then it is linked even for -shared. > > --- a/gcc/config/i386/i386.opt > > +++ b/gcc/config/i386/i386.opt > > @@ -420,6 +420,10 @@ mpc80 > > Target RejectNegative > > Set 80387 floating-point precision to 80-bit. > > > > +mdaz-ftz > > +Target RejectNegative > > +Set the FTZ and DAZ Flags. As the option is only used in the driver, shouldn't it be marked Driver and not Target? It doesn't need to be saved/restored on every cfun switch etc. > > +@item -mdaz-ftz > > +@opindex mdaz-ftz > > + > > +the flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register Shouldn't description start with capital letter? > > +are used to control floating-point calculations.SSE and AVX instructions > > +including scalar and vector instructions could benefit from enabling the FTZ > > +and DAZ flags when @option{-mdaz-ftz} is specified. > > Maybe say that the MXCSR register is set at program start to achieve > this when the > flag is specified at _link_ time and say this switch is ignored when > -shared is specified? Jakub