public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kewen.Lin" <linkw@linux.ibm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	David Edelsohn <dje.gcc@gmail.com>,
	Peter Bergner <bergner@linux.ibm.com>
Subject: Re: [PATCH] rs6000/test: Update some cases with -mdejagnu-tune
Date: Fri, 22 Jul 2022 10:22:51 +0800	[thread overview]
Message-ID: <11061a26-e6db-2f61-065e-b1c9a32d3181@linux.ibm.com> (raw)
In-Reply-To: <20220721184806.GK25951@gate.crashing.org>

Hi Segher,

Thanks for the comments!

on 2022/7/22 02:48, Segher Boessenkool wrote:
> Hi!
> 
> On Wed, Jul 20, 2022 at 05:31:11PM +0800, Kewen.Lin wrote:
>> As PR106345 shows, some test cases should be updated with
>> -mdejagnu-tune, since their test points are sensitive to
>> rs6000_tune, such as: group_ending_nop, loop align (ic),
>> float conversion cost etc.
> 
> It does not make sense to require -mdejagnu-tune= if -mdejagnu-cpu= is
> already given?  What is the failure case?
> 

I think cpu setting only sets tune setting when tune setting isn't
explicitly provided as:

  if (rs6000_tune_index >= 0)
    tune_index = rs6000_tune_index;
  else if (cpu_index >= 0)
    rs6000_tune_index = tune_index = cpu_index;

As PR106345 shows, GCC can use an explicit tune setting when it's
configured, even if there is one "-mdejagnu-cpu=", it doesn't
override the explicit given one, so we need one explicit
"-mdejagnu-tune=".

One failure example is gcc.target/powerpc/loop_align.c

See function rs6000_loop_align:

/* Implement LOOP_ALIGN. */
align_flags
rs6000_loop_align (rtx label)
{

...

  /* Align small loops to 32 bytes to fit in an icache sector, otherwise return default. */
  if (ninsns > 4 && ninsns <= 8
      && (rs6000_tune == PROCESSOR_POWER4
	  || rs6000_tune == PROCESSOR_POWER5
	  || rs6000_tune == PROCESSOR_POWER6
	  || rs6000_tune == PROCESSOR_POWER7
	  || rs6000_tune == PROCESSOR_POWER8))
    return align_flags (5);
  else
    return align_loops;

Although the test case has adopted option "-mdejagnu-cpu=power7", but
the configured "--with-tune-64=power9" takes effect and make it
return align_loops instead of align_flags (5).

>> This patch is to replace -mdejagnu-cpu with -mdejagnu-tune
>> or append -mdejagnu-tune (keep the original -mdejagnu-cpu
>> when it's required) accordingly.
> 
> It is *always* required.  Testcases with -mtune= but unspecified -mcpu=
> make no sense.
> 

The loop_align.c testings made me think if we know the insn count for
the loop on all cpus is in range (4,8] then the cpu setting doesn't matter.

I think I get your point, it's risky to assume that even if it works
for all existing cpus, will update with an explicit -mdejagnu-cpu here.

>> --- a/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c
>> +++ b/gcc/testsuite/gcc.target/powerpc/compress-float-ppc-pic.c
>> @@ -1,5 +1,5 @@
>>  /* { dg-do compile { target powerpc_fprs } } */
>> -/* { dg-options "-O2 -fpic -mdejagnu-cpu=power5" } */
>> +/* { dg-options "-O2 -fpic -mdejagnu-cpu=power5 -mdejagnu-tune=power5" } */
>>  /* { dg-require-effective-target fpic } */
> 
> This should only make a difference if you have -mtune= in your
> RUNTEST_FLAGS, and you shouldn't do silly things like that.  I suspect
> you see it in other cases, and those are actual bugs then, that need
> actual fixing instead of sweeping under the carper.
> 

Unfortunately it's due to the explicit tune setting in configuration.

> The testcase suggests this is with a compiler configured with
> --with-cpu= --with-tune=, which should just work, and -mcpu= should
> override both of those!
> 

Unfortunately -mcpu= (-mdejagnu-cpu=) doesn't actually override here.

BR,
Kewen

  reply	other threads:[~2022-07-22  2:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20  9:31 Kewen.Lin
2022-07-21 18:48 ` Segher Boessenkool
2022-07-22  2:22   ` Kewen.Lin [this message]
2022-07-22 18:17     ` Segher Boessenkool
2022-07-22 18:53       ` Peter Bergner
2022-07-22 19:28         ` Peter Bergner
2022-07-25  6:09           ` Kewen.Lin

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=11061a26-e6db-2f61-065e-b1c9a32d3181@linux.ibm.com \
    --to=linkw@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).