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: [RFC][PR target/39726 P4 regression] match.pd pattern to do type narrowing


On Tue, 10 Feb 2015, Jeff Law wrote:

> I think the way to go is to always convert the inner operands to an unsigned
> type.  In fact, everything except the outer convert should be using an
> unsigned type of the same size/precision as @0's type.  The outer convert
> should, of course, be the final type.
> 
> That avoids all the concerns about sign bit propagation from the narrow type
> into the wider final type.

Subject of course to allowing for the cases where the original expression 
uses sign-extension (signed narrow type), the mask is consistent with this 
(sign bit of narrow type and all higher bits set, e.g. -128), and the 
operation is bitwise not arithmetic, if you want to optimize those as 
well.

-- 
Joseph S. Myers
joseph@codesourcery.com


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