on 2022/8/10 05:34, Segher Boessenkool wrote: > On Tue, Aug 09, 2022 at 11:14:16AM +0800, Kewen.Lin wrote: >> on 2022/8/8 14:04, HAO CHEN GUI wrote: >>> +/* { dg-do run { target { has_arch_ppc64 } } } */ >>> +/* { dg-options "-O2 -mdejagnu-cpu=power9 -save-temps" } */ >>> +/* { dg-require-effective-target int128 } */ >>> +/* { dg-require-effective-target p9modulo_hw } */ >>> +/* { dg-final { scan-assembler-times {\mmaddld\M} 2 } } */ >>> +/* { dg-final { scan-assembler-times {\mmaddhd\M} 1 } } */ >>> +/* { dg-final { scan-assembler-times {\mmaddhdu\M} 1 } } */ >>> + >> >> Maybe it's good to split this case into two, one for compiling and the other >> for running. >> Since the generated asm is a test point here, with one separated case for >> compiling, we >> can still have that part of test coverage on hosts which are unable to run >> this case. >> You can move functions multiply_add and multiply_addu into one common header >> file, then >> include it in both source files. > > Yeah, good point. You cannot make dg-do do different things on > different targets. Fortunatelt just duplicating this test and then > removing the things not relevant to run resp. compile testing makes > things even more clear :-) > >> Nit: better to add one explicit "return 0;" to avoid possible warning. > > This is in main(), the C standard requires this to work without return > (and it is common). But, before C99 the implicit return value from > main() was undefined, so yes, it could warn then. Does it? >
Yes, exactly, with explicit -std=c89 -Wreturn-type it will have a warning: warning: control reaches end of non-void function... BR, Kewen