From: Michael Meissner <meissner@linux.ibm.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: Michael Meissner <meissner@linux.ibm.com>,
gcc-patches@gcc.gnu.org,
Segher Boessenkool <segher@kernel.crashing.org>,
David Edelsohn <dje.gcc@gmail.com>,
Peter Bergner <bergner@linux.ibm.com>
Subject: Re: Repost [PATCH 1/6] Add -mcpu=future
Date: Tue, 6 Feb 2024 01:01:52 -0500 [thread overview]
Message-ID: <ZcHLULl6xlOe71JL@cowardly-lion.the-meissners.org> (raw)
In-Reply-To: <e42116b4-540c-f068-1a42-f2e142b3dc19@linux.ibm.com>
On Tue, Jan 23, 2024 at 04:44:32PM +0800, Kewen.Lin wrote:
> > --- a/gcc/config/rs6000/rs6000-cpus.def
> > +++ b/gcc/config/rs6000/rs6000-cpus.def
> > @@ -88,6 +88,10 @@
> > | OPTION_MASK_POWER10 \
> > | OTHER_POWER10_MASKS)
> >
> > +/* Flags for a potential future processor that may or may not be delivered. */
> > +#define ISA_FUTURE_MASKS (ISA_3_1_MASKS_SERVER \
> > + | OPTION_MASK_FUTURE)
> > +
>
> Nit: Named as "ISA_FUTURE_MASKS_SERVER" seems more accurate as it's constituted
> with ISA_3_1_MASKS_**SERVER** ...
Well the _SERVER stuff was due to the power7 days when we still had to support
the E500 in the main rs6000 tree. But I will change it to be more consistant
in the future patches.
> ..., then this need to be updated accordingly.
>
> > diff --git a/gcc/config/rs6000/rs6000-opts.h b/gcc/config/rs6000/rs6000-opts.h
> > index 33fd0efc936..25890ae3034 100644
> > --- a/gcc/config/rs6000/rs6000-opts.h
> > +++ b/gcc/config/rs6000/rs6000-opts.h
> > @@ -67,7 +67,9 @@ enum processor_type
> > PROCESSOR_MPCCORE,
> > PROCESSOR_CELL,
> > PROCESSOR_PPCA2,
> > - PROCESSOR_TITAN
> > + PROCESSOR_TITAN,
> > +
>
> Nit: unintentional empty line?
>
> > + PROCESSOR_FUTURE
> > };
It was more as a separation. The MPCCORE, CELL, PPCA2, and TITAN are rather
old processors. I don't recall why we kept them after the POWER<x>.
Logically we should re-order the list and move MPCCORE, etc. earlier, but I
will delete the blank line in future patches.
> > +static int
> > +rs600_cpu_index_lookup (enum processor_type processor)
>
> s/rs600_cpu_index_lookup/rs6000_cpu_index_lookup/
I'm going to redo it, and eliminate rs600_cpu_index_lookup. Thanks for
catching the spelling of rs600 instead of rs6000.
> > +{
> > + for (size_t i = 0; i < ARRAY_SIZE (processor_target_table); i++)
> > + if (processor_target_table[i].processor == processor)
> > + return i;
> > +
> > + return -1;
> > +}
>
> Nit: Since this is given with a valid enum processor_type, I think it should
> never return -1? If so, may be more clear with gcc_unreachable () or adjust
> with initial -1, break when hits and assert it's not -1.
As I said, in looking at it, I think I will rewrite the code that uses it to
call rs6000_cpu_name_lookup instead.
> > +
> > \f
> > /* Return number of consecutive hard regs needed starting at reg REGNO
> > to hold something of mode MODE.
> > @@ -3756,23 +3768,45 @@ rs6000_option_override_internal (bool global_init_p)
> > rs6000_isa_flags &= ~OPTION_MASK_POWERPC64;
> > #endif
> >
> > + /* At the moment, we don't have explict -mtune=future support. If the user
>
> Nit: s/explict/explicit/
Thanks.
>
> > + explicitly tried to use -mtune=future, give a warning. If not, use the
>
> Nit: s/tried/tries/?
Thanks. I will reword the comment.
> > + power10 tuning until future tuning is added. */
> > if (rs6000_tune_index >= 0)
> > - tune_index = rs6000_tune_index;
> > + {
> > + enum processor_type cur_proc
> > + = processor_target_table[rs6000_tune_index].processor;
> > +
> > + if (cur_proc == PROCESSOR_FUTURE)
> > + {
> > + static bool issued_future_tune_warning = false;
> > + if (!issued_future_tune_warning)
> > + {
> > + issued_future_tune_warning = true;
>
> This seems to ensure we only warn this once, but I noticed that in rs6000/
> only some OPT_Wpsabi related warnings adopt this way, I wonder if we don't
> restrict it like this, for a tiny simple case, how many times it would warn?
In a simple case, you would only get the warning once. But if you use
__attribute__((__target__(...))) or #pragma target ... you might see it more
than once.
> > + warning (0, "%qs is not currently supported", "-mtune=future");
> > + }
> > +> + rs6000_tune_index = rs600_cpu_index_lookup (PROCESSOR_POWER10);
> > + }
> > + tune_index = rs6000_tune_index;
> > + }
> > else if (cpu_index >= 0)
> > - rs6000_tune_index = tune_index = cpu_index;
> > + {
> > + enum processor_type cur_cpu
> > + = processor_target_table[cpu_index].processor;
> > +
> > + rs6000_tune_index = tune_index
> > + = (cur_cpu == PROCESSOR_FUTURE
> > + ? rs600_cpu_index_lookup (PROCESSOR_POWER10)
>
> s/rs600_cpu_index_lookup/rs6000_cpu_index_lookup/
See above.
> > + : cpu_index);
> > + }
> > else
> > {
> > - size_t i;
> > enum processor_type tune_proc
> > = (TARGET_POWERPC64 ? PROCESSOR_DEFAULT64 : PROCESSOR_DEFAULT);
> >
> > - tune_index = -1;
> > - for (i = 0; i < ARRAY_SIZE (processor_target_table); i++)
> > - if (processor_target_table[i].processor == tune_proc)
> > - {
> > - tune_index = i;
> > - break;
> > - }
> > + tune_index = rs600_cpu_index_lookup (tune_proc == PROCESSOR_FUTURE
> > + ? PROCESSOR_POWER10
> > + : tune_proc);
>
> This part looks useless, as tune_proc is impossible to be PROCESSOR_FUTURE.
Well in theory, you could configure the compiler with --with-cpu=future or
--with-tune=future.
> > }
>
> Maybe re-structure the above into:
>
> bool explicit_tune = false;
> if (rs6000_tune_index >= 0)
> {
> tune_index = rs6000_tune_index;
> explicit_tune = true;
> }
> else if (cpu_index >= 0)
> // as before
> rs6000_tune_index = tune_index = cpu_index;
> else
> {
> //as before
> ...
> }
>
> // Check tune_index here instead.
>
> if (processor_target_table[tune_index].processor == PROCESSOR_FUTURE)
> {
> tune_index = rs6000_cpu_index_lookup (PROCESSOR_POWER10);
> if (explicit_tune)
> warn ...
> }
>
> // as before
> rs6000_tune = processor_target_table[tune_index].processor;
>
> >
> > if (cpu_index >= 0)
> > @@ -4785,6 +4819,7 @@ rs6000_option_override_internal (bool global_init_p)
> > break;
> >
> > case PROCESSOR_POWER10:
> > + case PROCESSOR_FUTURE:
> > rs6000_cost = &power10_cost;
> > break;
> >
> > @@ -5944,6 +5979,8 @@ rs6000_machine_from_flags (void)
> > /* Disable the flags that should never influence the .machine selection. */
> > flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL);
> >
> > + if ((flags & (ISA_FUTURE_MASKS & ~ISA_3_1_MASKS_SERVER)) != 0)
> > + return "future";
> > if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
> > return "power10";
> > if ((flags & (ISA_3_0_MASKS_SERVER & ~ISA_2_7_MASKS_SERVER)) != 0)
> > @@ -24500,6 +24537,7 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] =
> > { "float128-hardware", OPTION_MASK_FLOAT128_HW, false, true },
> > { "fprnd", OPTION_MASK_FPRND, false, true },
> > { "power10", OPTION_MASK_POWER10, false, true },
> > + { "future", OPTION_MASK_FUTURE, false, true },
> > { "hard-dfp", OPTION_MASK_DFP, false, true },
> > { "htm", OPTION_MASK_HTM, false, true },
> > { "isel", OPTION_MASK_ISEL, false, true },
> > diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
> > index 2291fe8d3a3..43209f9a6e7 100644
> > --- a/gcc/config/rs6000/rs6000.h
> > +++ b/gcc/config/rs6000/rs6000.h
> > @@ -163,6 +163,7 @@
> > mcpu=e5500: -me5500; \
> > mcpu=e6500: -me6500; \
> > mcpu=titan: -mtitan; \
> > + mcpu=future: -mfuture; \
> > !mcpu*: %{mpower9-vector: -mpower9; \
> > mpower8-vector|mcrypto|mdirect-move|mhtm: -mpower8; \
> > mvsx: -mpower7; \
>
> I think we should also update asm_names in driver-rs6000.cc.
Ok. Though the driver-rs6000.cc stuff won't kick in until we have a real
system that matches "future".
--
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: meissner@linux.ibm.com
next prev parent reply other threads:[~2024-02-06 6:01 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-05 23:27 Repost [PATCH 0/6] PowerPC Future patches Michael Meissner
2024-01-05 23:35 ` Repost [PATCH 1/6] Add -mcpu=future Michael Meissner
2024-01-19 18:43 ` Ping " Michael Meissner
2024-01-23 8:44 ` Repost " Kewen.Lin
2024-02-06 6:01 ` Michael Meissner [this message]
2024-02-07 9:21 ` Kewen.Lin
2024-02-07 19:58 ` Michael Meissner
2024-02-20 10:35 ` Kewen.Lin
2024-02-21 7:19 ` Michael Meissner
2024-02-26 10:46 ` Kewen.Lin
2024-02-23 17:57 ` Segher Boessenkool
2024-02-08 18:42 ` Segher Boessenkool
2024-02-08 18:35 ` Segher Boessenkool
2024-02-08 20:10 ` Segher Boessenkool
2024-01-05 23:37 ` Repost [PATCH 2/6] PowerPC: Make -mcpu=future enable -mblock-ops-vector-pair Michael Meissner
2024-01-19 18:44 ` Ping " Michael Meissner
2024-01-23 8:54 ` Repost " Kewen.Lin
2024-01-05 23:38 ` Repost [PATCH 3/6] PowerPC: Add support for accumulators in DMR registers Michael Meissner
2024-01-19 18:46 ` Ping " Michael Meissner
2024-01-25 9:28 ` Repost " Kewen.Lin
2024-02-07 0:06 ` Michael Meissner
2024-02-07 9:38 ` Kewen.Lin
2024-02-08 0:26 ` Michael Meissner
2024-01-05 23:39 ` Repost [PATCH 4/6] PowerPC: Make MMA insns support " Michael Meissner
2024-01-19 18:47 ` Ping " Michael Meissner
2024-02-04 3:21 ` Repost " Kewen.Lin
2024-02-07 3:31 ` Michael Meissner
2024-01-05 23:40 ` Repost [PATCH 5/6] PowerPC: Switch to dense math names for all MMA operations Michael Meissner
2024-01-19 18:48 ` Ping " Michael Meissner
2024-02-04 5:47 ` Repost " Kewen.Lin
2024-02-07 20:01 ` Michael Meissner
2024-01-05 23:42 ` Repost [PATCH 6/6] PowerPC: Add support for 1,024 bit DMR registers Michael Meissner
2024-01-19 18:49 ` Ping " Michael Meissner
2024-02-05 3:58 ` Repost " Kewen.Lin
2024-02-08 0:35 ` Michael Meissner
2024-02-08 18:22 ` Repost [PATCH 0/6] PowerPC Future patches Segher Boessenkool
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=ZcHLULl6xlOe71JL@cowardly-lion.the-meissners.org \
--to=meissner@linux.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linkw@linux.ibm.com \
--cc=segher@kernel.crashing.org \
/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).