[RFA} Patch to implement "Switch statement fdo reordering"

Edmar Wienskoski-RA8797 edmar@freescale.com
Tue Apr 29 21:21:00 GMT 2008


Janis Johnson wrote:
> The patch was tested on x86_64 as well as on powerpc (and please
> specify the operating system as well as the architecture), but the
> single new test is limited to be run on a subset of powerpc targets:
>   
I have defined a target hook for powerpc only. But, because the patch 
affects files outside
the rs6000 directory I decided to do a regression test on the x86_64 as 
well.
(Just being paranoid...)
(Also, in a separate test, I forced the optimization to always happen, 
to make sure nothing breaks
whenever someone defines a target hook for the x86)
> +/* { dg-do run { target powerpc*-*-* } }*/
> +/* { dg-require-effective-target powerpc_altivec_ok } */
> +/* { dg-options "-O2 -fdump-tree-expand -mcpu=power4" } */
>
> The requirement for powerpc_altivec_ok is confusing because the test
> isn't compiled with -maltivec, and if it were then you'd instead need
> to skip the test if it's not running on a machine with AltiVec, not
> just a compiler that can generate code for it.  If that check is used
> to limit the powerpc targets on which the test will be run to those that
> support -mcpu=power4, please add a comment.
>   
> If the same test can be used on other targets, the test directives can
> be modified to:
>
>  /* { dg-do run { target { { powerpc*-*-* && powerpc_altivec_ok } || { other-targets} } } } */
>  /* { dg-options "-O2 -fdump-tree-expand -mcpu=power4" { target powerpc*-*-* } } */
>  /* { dg-options "-O2 -fdump-tree-expand -mother1" { target other1*-*-* } } */
>  /* { dg-options "-O2 -fdump-tree-expand -mother2" { target other2*-*-* } } */
>
>  /* { dg-final-use { scan-tree-dump "default case 5 with cost 774 promoted" "expand" { target powerpc*-*-* } } */
>  /* { dg-final-use { scan-tree-dump "expected string for other1" "expand" { target other1*-*-* } } */
>  /* { dg-final-use { scan-tree-dump "expected string for other2" "expand" { target other2*-*-* } } */
>   
Ah, I didn't know that dg-final-use could take this extra condition. Can 
I write this ?
/* For now, only power[456] has a target hook definition that will
   cause the optimization to happen.  Although no altivec code is
   used, any machine that is altivec capable can be used to run this
   test case */
/* { dg-final-use { scan-tree-dump "default case 5 with cost 774 
promoted" "expand" }
 { target powerpc*-*-* && powerpc_altivec_ok } } */

Then I would remove the { dg-do run } altogether, and the test would run 
in all machines, but the code
transformation would be checked only on the ones that supports it.
> Tcl can be picky about spaces around curly braces, so add a space here
> between "expand" and "}":
>   
Ok.
> +/* { dg-final-use { scan-tree-dump "default case 5 with cost 774 promoted" "expand"} } */
>
> The test looks fine otherwise.
>
> Janis
>   
Thank you very much for the help.
Edmar




More information about the Gcc-patches mailing list