Jennifer Schmitz <jschm...@nvidia.com> writes: > As a follow-up to adding a pattern that folds x/sqrt(x) to sqrt(x) in > match.pd, this patch adds a test case for type Float16 for armv8.2-a+fp16. > > The patch was bootstrapped and regtested on aarch64-linux-gnu, no regression. > Ok for mainline? > > Signed-off-by: Jennifer Schmitz <jschm...@nvidia.com> > > gcc/testsuite/ > > * gcc.target/aarch64/sqrt_div_float16.c: New test. > > commit f909f882dda56e33fde2a06f4c1318d7e691e5c9 > Author: Jennifer Schmitz <jschm...@nvidia.com> > Date: Mon Jul 8 18:54:54 2024 +0530 > > [PATCH] testsuite: Test the pattern folding x/sqrt(x) to sqrt(x) for > Float16 > > As a follow-up to adding a pattern that folds x/sqrt(x) to sqrt(x) in > match.pd, > this patch adds a test case for type Float16 for armv8.2-a+fp16. > > The patch was bootstrapped and regtested on aarch64-linux-gnu, no > regression. > Ok for mainline? > > Signed-off-by: Jennifer Schmitz <jschm...@nvidia.com> > > gcc/testsuite/ > > * gcc.target/aarch64/sqrt_div_float16.c: New test. > > diff --git a/gcc/testsuite/gcc.target/aarch64/sqrt_div_float16.c > b/gcc/testsuite/gcc.target/aarch64/sqrt_div_float16.c > new file mode 100644 > index 00000000000..c4f297ef17a > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/sqrt_div_float16.c > @@ -0,0 +1,14 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -ffast-math -fdump-tree-forwprop-details" } */ > +/* { dg-require-effective-target c99_runtime } */ > + > +#pragma GCC target ("arch=armv8.2-a+fp16") > + > +_Float16 f (_Float16 x) > +{ > + _Float16 t1 = __builtin_sqrt (x); > + _Float16 t2 = x / t1; > + return t2; > +} > + > +/* { dg-final { scan-tree-dump "gimple_simplified to t2_\[0-9\]+ = .SQRT > .x_\[0-9\]*.D.." "forwprop1" } } */
I'm a bit nervous about tying a match.pd test to a specific dump file, since match.pd is indirectly used by many passes. How about instead matching the end result, with: /* { dg-options "-O2 -ffast-math" } */ /* { dg-final { check-function-bodies "**" "" } } */ #pragma ... /* ** f: ** fsqrt h0, h0 ** ret */ _Float16 f (_Float16 x) ... (tabs rather than spaces in the asm quote). OK with that change if you agree. Thanks, Richard