Repost: [PATCH] Fix vec-splati-runnable.c test.

Michael Meissner meissner@linux.ibm.com
Mon Jul 12 17:11:12 GMT 2021


On Mon, Jul 12, 2021 at 10:49:26AM -0500, Bill Schmidt wrote:
> Hi Mike,
> 
> On 7/7/21 3:00 PM, Michael Meissner wrote:
> >[PATCH] Fix vec-splati-runnable.c test.
> >
> >I noticed that the vec-splati-runnable.c did not have an abort after one
> >of the tests.  If the test was run with optimization, the optimizer could
> >delete some of the tests and throw off the count.  However, due to the
> >fact that the value being loaded in that test is undefined, I did not
> >check what value was loaded, but I just stored it into a volatile global
> >variable.
> >
> >2021-07-07  Michael Meissner  <meissner@linux.ibm.com>
> >
> >gcc/testsuite/
> >	* gcc.target/powerpc/vec-splati-runnable.c: Run test with -O2
> >	optimization.  Do not check what XXSPLTIDP generates if the value
> >	is undefined.
> >---
> >  .../gcc.target/powerpc/vec-splati-runnable.c  | 29 ++++++-------------
> >  1 file changed, 9 insertions(+), 20 deletions(-)
> >
> >diff --git a/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c b/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
> >index e84ce77a21d..a135279b1d7 100644
> >--- a/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
> >+++ b/gcc/testsuite/gcc.target/powerpc/vec-splati-runnable.c
> >@@ -1,7 +1,7 @@
> >  /* { dg-do run { target { power10_hw } } } */
> >  /* { dg-do link { target { ! power10_hw } } } */
> >  /* { dg-require-effective-target power10_ok } */
> >-/* { dg-options "-mdejagnu-cpu=power10 -save-temps" } */
> >+/* { dg-options "-mdejagnu-cpu=power10 -save-temps -O2" } */
> 
> Why did you restrict optimization here?  The tests should be run at
> various opt levels if you don't specify this, right?
> 
> The test changes are otherwise okay, but I'd like to understand this first.

When doing tests with instruction counts, you always want to specify the
optimization level (with -O2 being the standard).  Otherwise, depending on the
other optimizations, the instruction counts might not line up.

In this particular case, because it didn't have an optimization flag, the
original code was compiled with -O0.  If you compile it with -O1, it deletes
the if statement with the empty then statement, and deletes the corresponding
XXSPLTIDP instruction.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797


More information about the Gcc-patches mailing list