On Wed, 2023-04-26 at 17:53 +0800, Lulu Cheng wrote: > Hi, ruoyao: > > The performance of spec2006 is finished. The fixed-point > 400.perlbench has about 3% performance improvement, > > and the other basics have not changed, and the floating-point tests > have > basically remained the same. > > Do you have any questions about the test cases mentioned by Guo > Jie? If there is no problem, modify the test case, > > I think the code can be merged into the main branch.
I'll rewrite the test and commit in a few days (now I'm occupied with something :( ). > > Thanks! > > 在 2023/4/25 下午5:12, Guo Jie 写道: > > /* snip */ > > > > > > diff --git a/gcc/testsuite/gcc.target/loongarch/shrink-wrap.c > > > > b/gcc/testsuite/gcc.target/loongarch/shrink-wrap.c > > > > new file mode 100644 > > > > index 00000000000..f2c867a2769 > > > > --- /dev/null > > > > +++ b/gcc/testsuite/gcc.target/loongarch/shrink-wrap.c > > > > @@ -0,0 +1,22 @@ > > > > +/* { dg-do compile } */ > > > > +/* { dg-options "-O -fshrink-wrap" } */ > > > > + > > > > +/* f(x) should do nothing if x is 0. */ > > > > +/* { dg-final { scan-assembler > > > > "bnez\t\\\$r4,\[^\n\]*\n\tjr\t\\\$r1" } } */ > > > > + > > > > +void g(void); > > > > + > > > > +void > > > > +f(int x) > > > > +{ > > > > + if (x) > > > > + { > > > > + register int s0 asm("s0") = x; > > > > + register int s1 asm("s1") = x; > > > > + register int s2 asm("s2") = x; > > > > + asm("" : : "r"(s0)); > > > > + asm("" : : "r"(s1)); > > > > + asm("" : : "r"(s2)); > > > > + g(); > > > > + } > > > > +} > > > > I think the test case cannot fully reflect the optimization effect > > of > > the current patch, > > > > because even without the patch, -O -fshrink-wrap will still perform > > architecture independent optimization. > > > > This patch considers architecture related registers as finer grained > > optimization for shrink wrapping, > > > > I think a test case like the one below is more suitable: > > > > > > int foo(int x) > > { > > if (x) > > { > > __asm__ ("":::"s0","s1"); > > return x; > > } > > > > __asm__ ("":::"s2","s3"); > > return 0; > > } > > > > Otherwise LGTM, thanks! > -- Xi Ruoyao <xry...@xry111.site> School of Aerospace Science and Technology, Xidian University