On Fri, Jul 22, 2022 at 10:22:51AM +0800, Kewen.Lin wrote:
> on 2022/7/22 02:48, Segher Boessenkool wrote:
> > 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=".

And that is the problem.  GCC's automatic setting is *not* an explicit
option, not given by the user.  --with-tune= should not result in adding
an -mtune= option in the resulting compiler, it should not set command-
line options.

> 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).

And it should not do that.

> >> 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.

Sure, it probably works without -mcpu=, but it does not make sense :-)

Only using -mtune= while not having -mcpu= serves no purpose in any
"normal" use, so we shouldn't do that in the testsuite either.

> > 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.

So that needs some actual fixes.  Something in how --with-tune= works
is suboptimal?

> > 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.

... or that.


Segher

Reply via email to