On Tue, Jun 02, 2020 at 04:56:49PM -0400, David Edelsohn wrote:
> > > + if (TREE_CODE (type) == RECORD_TYPE
> > > + && rs6000_discover_homogeneous_aggregate (TYPE_MODE (type), type,
> > > NULL,
> > > + NULL))
> > > + {
> > > + tree field_type = TREE_TYPE (first_field (type));
> > > + if (field_type && TREE_CODE (field_type) == ARRAY_TYPE
> > > + && TREE_CODE (TREE_TYPE (field_type)) == REAL_TYPE)
> > > + elt_mode = TYPE_MODE (TREE_TYPE (field_type));
> > > + }
> >
> > Homogeneous aggregates only exist in the ELFv2 ABI, while the problem
> > here is the SP float things. You also noticed (elsewhere) that if the
> > struct contains (say) SI, SF, SI, SF, then this does not help.
> >
> > Is there some better condition this could use, and maybe an expansion
> > that works in more cases as well?
> >
> > And, it would be lovely if generic code could expand to something better
> > already (not expand to a block move at all, certainly not for something
> > as tiny as this).
>
> And please don't refer to homogeneous aggregates outside of ELFv2 ABI
> code because that will miss an optimization or generate incorrect code
> other PowerPC OSes and ABIs, such as AIX.
Yes, rs6000_discover_homogeneous_aggregate always returns false if some
other ABI is in use, which means for this particular code that the
problem isn't solved for those other ABIs at all.
Segher