This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] Add new target-hook truncated_to_mode


Richard Sandiford writes:
> Adam Nemet <anemet@sonic.net> writes:
> > If understand your idea correctly then I agree it would.  You
> > basically want to expose the properties of SIGN_EXTEND and TRUNCATE
> > together because they really complement each other.
> 
> Not really.  This isn't about the properties of SIGN_EXTEND and
> TRUNCATE, which are just two rtl codes that you use on DImode
> and SImode values.  It's a property of SImode values themselves.
> Codes like PLUS have to preserve it too.  (You couldn't implement
> (plus:SI ...) using 64-bit addition, for example.)

This feels like a little bit of playing with words and perspectives.
You still want to expose this behavior through describing properties
or more precisely equivalences of mode-switching operations.  Instead
of saying that truncation is not a noop (narrowing subreg) we will now
say that sign-extension is a noop (widening subreg) which is what I
meant by these instructions complementing each other.  Or in other
words instead of:

  narrowing SUBREG != TRUNCATE

we will now say:

  widening SUBREG == SIGN_EXTEND

and try to derive the former property from the latter.  But overall I
do agree that it usually carries more information to say what
something _is_ than what it _is not_.

I will try to work on this but I am sure since it involves more
interface changes than my current patch I will have some questions.
Also I see that you might have a close-to-ready plan in your head.  If
that is the case you can go ahead and take it over from here.

Adam


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