On Tue, May 14, 2013 at 6:03 PM, DJ Delorie <d...@redhat.com> wrote: > >> How can you then ever "truncate" from SImode to PSImode? > > If you use PARTIAL_INT_MODE(), you get a PSImode that has a "default" > bitsize (i.e. the value stored in the data structure) that's the same > as SImode, that is, 32. There is no way to specify the usable > bitsize, so it's "undefined/unspecified" but, IMHO, assumed to be less > than the bit size of the parent mode.
My question is, if you end up with (truncate:PSI (reg:SI 27)) and then constant propagate 0x7fffffff to reg:SI 27, what does simplify-rtx.c do here? Truncate to _what_ precision exactly? Recent introduction of PTImode to rs6000 makes me think that the PARTIAL_INT_MODE()s are a hack to simply get another name for TImode (in this case). Thus to the middle-end it shouldn't be (truncate:PSI (reg:SI 27)) but (set (reg:PSI 28 (reg:SI 27))) or maybe (subreg:PSI (reg:SI 27)) ? > One can assert that a PSImode will never have *more* precision than > SImode, though, so sign extending SImode to PSImode is never the right > thing to do. > >> btw, what's the relation to fractional int modes? > > I think fractional_int_mode allows you to specify the precision and > byte size, but in my experience, I've had trouble using it, especially > if you specify a non-power-of-two byte size. Interestingly we have exactly that for AVR: config/avr/avr-modes.def:FRACTIONAL_INT_MODE (PSI, 24, 3); and they call it PSImode ;) So ... time to remove PARTIAL_INT_MODE ()s? Btw, I wonder why INT_MODE (PSI, 4) would not work equally well as PARTIAL_INT_MODE (SI) ? Richard.