Hi!

On Mon, Apr 27, 2020 at 05:01:34PM -0500, will schmidt wrote:
> On Mon, 2020-04-27 at 15:53 -0400, Michael Meissner via Gcc-patches wrote:
> > This patch adds a test that verifies that the compiler generates a prefixed
> > load/store instruction where the compiler cannot generate the instruction
> > directly because the offset is not a valid DS or DQ offset.  A DS offset 
> > must
> > have the bottom 2 bits clear.  A DQ offset must have the bottom 4 bits 
> > clear.
> > Due to the way PowerPC instructions are encoded, some instructions use the 
> > DS
> > format and some use the DQ format.
> > 
> > This is patch #3 of 7.  The tests in this patch run on a little endian 
> > power8
> > system running Linux.
> > 
> > 2020-04-27  Michael Meissner  <meiss...@linux.ibm.com>
> > 
> >     * gcc.target/powerpc/prefix-ds-dq.c: New test to verify that we
> >     generate the prefix load/store instructions for traditional
> >     instructions with an offset that doesn't match DS/DQ
> >     requirements.
> 
> Can probably safely be shortened to end at "... for traditional
> instructions."   if not even just "New test".  

Yes, just "New." or "New test." please.  An explanation what the test
tests belongs in the test itself (it already is there in this case).

> > +/* { dg-require-effective-target powerpc_prefixed_addr } */
> > +/* { dg-options "-O2 -mdejagnu-cpu=future" } */

Same as for all other tests...  What do the effective targets mean
exactly, do they require some -mcpu=, etc.

> > +unsigned long
> > +load_us_offset1 (unsigned char *p)
> > +{
> > +  return *(unsigned short *)(p + 1);       /* should generate LHZ.  */
> > +}

This violates aliasing rules (without -fno-strict-aliasing), unless p
points to some "short" object -- in which case it has alignment 2
already!

So this testcase needs -fno-strict-aliasing, but also, you need to make
sure GCC does not assume alignment 2 (after the cast) already.  There
are attributes for this.

> > +void
> > +store_ul_offset1 (unsigned long ul, unsigned char *p)
> > +{
> > +  *(unsigned long *)(p + 1) = ul;  /* should generate PSTD.  */
> > +}
> > +
> > +void
> > +store_sl_offset1 (signed long sl, unsigned char *p)
> > +{
> > +  *(signed long *)(p + 1) = sl;            /* should generate PSTD.  */
> > +}

"long long".

> > +void
> > +store_float_offset1 (float f, unsigned char *p)
> > +{
> > +  *(float *)(p + 1) = f;           /* should generate STF.  */
> 
> Comment should be STFD ?
> 
> > +}
> > +
> > +void
> > +store_double_offset1 (double d, unsigned char *p)
> > +{
> > +  *(double *)(p + 1) = d;          /* should generate STD.  */
> 
> Comment should be STFS ? 

The other way around :-)  stfs is for single precision float ("float",
in C), while stfd is for double precision float ("double", in C).

> > +/* { dg-final { scan-assembler-times {\mextsb\M} 1 } } */

Maybe also test there are no extsh and extsw generated?


Segher

Reply via email to