This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Rationale for an old TRUNCATE patch
Ian Lance Taylor writes:
> truncate has a machine independent meaning.
Yes, I guess with your definition below it does. It's interesting though that
Jim had said the opposite in the excerpts posted by Jeff:
And a later message from Jim:
Truncate converts a value from a larger to a smaller mode in a machine
dependent way.
A subreg just chops off the high bits. A truncate does not. The name might
be a little confusing, but the whole point of truncate is to have something
that operates differently than a subreg.
Combine is clearly making an invalid transformation.
> Yes. The bits in Nmode's mask are determined by the truncate. The
> other bits are don't-care. If the result of the truncate happens to
> wind up in a register, then in some cases PROMOTE_MODE will apply.
And IIUC this don't-care nature of the other bits that allows backends to
define the upper bits. For example to have sign-bit copies there in registers
to enforce the MIPS64 SI mode representation. And treating the don't care
bits outside SI mode in this way is true for any other SI-mode operations
performed on registers not just truncate, right? Hmm, nice.
Adam