> Maybe the misunderstanding occurs when the mode of the subreg is less > than word_size? It would certainly make sense that a subreg write of > less than word_size leaves the bits undefined. > > ie, if word_size is SImode and we had a write to > > (subreg:HI (reg:SI) 0) > > Then the upper bits are left undefined. > > > Contrast that to the same RTL, but word_size is HImode > > (subreg:HI (reg:SI) 0) > > Would leave the upper bits untouched.
That's the conventional wisdom I think. Sub-word and word-sized subregs don't behave the same, in particular when they are on the LHS of an assignment. -- Eric Botcazou