[PATCH V2] Use preferred mode for doloop iv [PR61837].

Segher Boessenkool segher@kernel.crashing.org
Wed Jul 14 18:04:56 GMT 2021


Hi!

On Wed, Jul 14, 2021 at 06:26:28PM +0800, guojiufu wrote:
> 	PR target/61837

Wrong PR number?

> +@deftypefn {Target Hook} machine_mode TARGET_PREFERRED_DOLOOP_MODE 
> (machine_mode @var{mode})
> +This hook takes a @var{mode} which is the original mode of doloop IV.
> +And if the target prefers other mode for doloop IV, this hook returns 
> the
> +preferred mode.
> +For example, on 64bit target, DImode may be preferred than SImode.
> +This hook could return the original mode itself if the target prefer to
> +keep the original mode.
> +The origianl mode and return mode should be MODE_INT.
> +@end deftypefn

(Typo, "original").  That has all the right contents, but needs someone
who is better at English than me to look at it / improve it.

> +/* { dg-final {scan-rtl-dump-not "zero_extend.*doloop" "loop2_doloop"} 
> } */
> +/* { dg-final {scan-rtl-dump-not "reg:SI.*doloop" "loop2_doloop" { 
> target lp64 } } } */

(Don't use format=flowed in your mails, or certainly not in those
containing patches -- it was rewrapped).

If you use .* in scan REs, you should be aware that "." matches newlines
by default, so you can match "reg:SI" on one line and "doloop" on a
later one, in that second one.

You can write

/* { dg-final {scan-rtl-dump-not {(?p)reg:SI.*doloop} "loop2_doloop" { target lp64 } } } */

(note: {} are much more convenient around most REs, you need a lot of
escaping without it) to get "partial newline-sensitive matching", which
is usually what you want (see "man re_syntax" for the details).


The generic changes look fine to me (but what do I know about Gimple!)
The rs6000 changes are fine if the rest is approved (and see the
testcase comments).  Thanks!


Segher


More information about the Gcc-patches mailing list