This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SUBREGs and modes


> > > weird usage of SUBREGs. According to my uderstanding the docs, when
> > > WORDNUM is nonzero, the  innermode must be greater than word and
> > > the outer mode must be word.
> > 
> > Where does it say that the outer mode must be word?
> The other use of @code{subreg} is to extract the individual registers of
> a multi-register value.  Machine modes such as @code{DImode} and
> @code{TImode} can indicate values longer than a word, values which
> usually require two or more consecutive registers.  To access one of the
> registers, use a @code{subreg} with mode @code{SImode} and a
> @var{wordnum} that says which register. 
> 
> Actually speaks about SImode, but is interpreted in the code as
> word.

Well, this is not a definition, but (a part of) an enumeration of uses.
A subreg can fulfill both uses at a time.
Actually, the very next paragraph hints at that:

Storing in a non-paradoxical @code{subreg} has undefined results for
bits belonging to the same word as the @code{subreg}.  This laxity makes
it easier to generate efficient code for such instructions.  To
represent an instruction that preserves all the bits outside of those in

This implies that there are cases where you have a subreg of a reg with
multiple words, where not all bits of a word are stored to.

Note that nested subregs are not allowed, so we really *have* to express
the access of a single smaller-than-word part of a multi word register
with a single SUBREG.

Do you have a suggestion how to make the documentation more clear on that
count?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]