public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Hongtao Liu <crazylht@gmail.com>,
	liuhongt <hongtao.liu@intel.com>,
	gcc-patches@gcc.gnu.org,  ubizjak@gmail.com
Subject: Re: [PATCH V2 2/2] [x86] x86: Add a new option -mdaz-ftz to enable FTZ and DAZ flags in MXCSR.
Date: Wed, 21 Dec 2022 14:43:43 -0800	[thread overview]
Message-ID: <CAMe9rOpTzEU-U2YpCHTO1Yau2vxCd4eHin8GHiHhbYqCS4up_Q@mail.gmail.com> (raw)
In-Reply-To: <Y6OKO1WliTOA481N@tucnak>

[-- Attachment #1: Type: text/plain, Size: 1681 bytes --]

On Wed, Dec 21, 2022 at 2:35 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Wed, Dec 21, 2022 at 12:20:23PM -0800, H.J. Lu wrote:
> > On Mon, Dec 19, 2022 at 8:52 PM Hongtao Liu <crazylht@gmail.com> wrote:
> > >
> > > On Thu, Dec 15, 2022 at 3:45 PM Hongtao Liu <crazylht@gmail.com> wrote:
> > > >
> > > > On Thu, Dec 15, 2022 at 3:39 PM Jakub Jelinek <jakub@redhat.com> wrote:
> > > > >
> > > > > On Thu, Dec 15, 2022 at 02:21:37PM +0800, liuhongt via Gcc-patches wrote:
> > > > > > --- 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
> > > > >
> > > > > s/Target/Driver/
> > > > Change to Driver and Got error like:cc1: error: command-line option
> > > > ‘-mdaz-ftz’ is valid for the driver but not for C.
> > > Hi Jakub:
> > >   I didn't find a good solution to handle this error after changing
> > > *Target* to *Driver*, Could you give some hints how to solve this
> > > problem?
> > > Or is it ok for you to mark this as *Target*(there won't be any save
> > > and restore in cfun since there's no variable defined here.)
> >
> > Since all -m* options are passed to cc1, -mdaz-ftz can't be marked
> > as Driver.  We need to give it a different name to mark it as Driver.
>
> It is ok like that.
>
>         Jakub
>

The GCC driver handles -mno-XXX automatically for -mXXX.  Use
a different name needs to handle the negation.   Or we can do something
like this to check for CL_DRIVER before passing it to cc1.
-- 
H.J.

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 1594 bytes --]

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 2568d541196..87cbea11ae1 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -3851,7 +3851,7 @@ alloc_switch (void)
 
 static void
 save_switch (const char *opt, size_t n_args, const char *const *args,
-	     bool validated, bool known)
+	     bool validated, bool known, bool driver = false)
 {
   alloc_switch ();
   switches[n_switches].part1 = opt + 1;
@@ -3868,6 +3868,7 @@ save_switch (const char *opt, size_t n_args, const char *const *args,
   switches[n_switches].validated = validated;
   switches[n_switches].known = known;
   switches[n_switches].ordering = 0;
+  switches[n_switches].driver = driver;
   n_switches++;
 }
 
@@ -4575,7 +4576,8 @@ driver_handle_option (struct gcc_options *opts,
   if (do_save)
     save_switch (decoded->canonical_option[0],
 		 decoded->canonical_option_num_elements - 1,
-		 &decoded->canonical_option[1], validated, true);
+		 &decoded->canonical_option[1], validated, true,
+		 cl_options[opt_index].flags == CL_DRIVER);
   return true;
 }
 
@@ -7465,7 +7467,8 @@ check_live_switch (int switchnum, int prefix_length)
 static void
 give_switch (int switchnum, int omit_first_word)
 {
-  if ((switches[switchnum].live_cond & SWITCH_IGNORE) != 0)
+  if ((switches[switchnum].live_cond & SWITCH_IGNORE) != 0
+      || switches[switchnum].driver)
     return;
 
   if (!omit_first_word)
diff --git a/gcc/opts.h b/gcc/opts.h
index ce4fd5c39b9..2900f0d9168 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -561,6 +561,7 @@ struct switchstr
   bool known;
   bool validated;
   bool ordering;
+  bool driver;
 };
 
 #endif

  reply	other threads:[~2022-12-21 22:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14  2:18 [PATCH] [x86] x86: Don't add crtfastmath.o for -shared and add " liuhongt
2022-12-14  8:08 ` Richard Biener
2022-12-14  8:16   ` Jakub Jelinek
2022-12-14  8:23     ` Richard Biener
2022-12-14  8:34       ` Liu, Hongtao
2022-12-14  8:52         ` Richard Biener
2022-12-14  9:07           ` Uros Bizjak
2022-12-15  6:21             ` [PATCH V2 1/2] x86: Don't add crtfastmath.o for -shared liuhongt
2022-12-15  6:21               ` [PATCH V2 2/2] [x86] x86: Add a new option -mdaz-ftz to enable FTZ and DAZ flags in MXCSR liuhongt
2022-12-15  7:39                 ` Jakub Jelinek
2022-12-15  7:45                   ` Hongtao Liu
2022-12-20  4:51                     ` Hongtao Liu
2022-12-21 20:20                       ` H.J. Lu
2022-12-21 22:35                         ` Jakub Jelinek
2022-12-21 22:43                           ` H.J. Lu [this message]
2022-12-21 22:46                             ` Jakub Jelinek
2022-12-22  4:40                               ` Hongtao Liu
2022-12-22  8:04                                 ` Uros Bizjak
2023-05-04  5:35                                   ` Hongtao Liu
2023-05-04  5:36                                     ` Hongtao Liu
2023-05-04  9:49                                       ` Richard Biener
2023-05-10  1:41                                         ` Hongtao Liu
2023-05-10  6:41                                           ` Richard Biener
2023-05-10  9:07                                             ` [PATCH] " liuhongt
2023-05-12  5:43                                               ` Hongtao Liu
2023-05-15  1:16                                                 ` Hongtao Liu
2022-12-16  9:50               ` [PATCH V2 1/2] x86: Don't add crtfastmath.o for -shared Uros Bizjak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMe9rOpTzEU-U2YpCHTO1Yau2vxCd4eHin8GHiHhbYqCS4up_Q@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongtao.liu@intel.com \
    --cc=jakub@redhat.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).