This is the mail archive of the gcc@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: Generating gimple assign stmt that changes sign


On 05/21/2018 05:25 PM, Kugan Vivekanandarajah wrote:
> Hi Jeff,
> 
> Thanks for the prompt reply.
> 
> On 22 May 2018 at 09:10, Jeff Law <law@redhat.com> wrote:
>> On 05/21/2018 04:50 PM, Kugan Vivekanandarajah wrote:
>>> Hi,
>>>
>>> I am looking to introduce ABSU_EXPR and that would create:
>>>
>>> unsigned short res = ABSU_EXPR (short);
>>>
>>> Note that the argument is signed and result is unsigned. As per the
>>> review, I have a match.pd entry to generate this as:
>>> (simplify (abs (convert @0))
>>>  (if (ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)))
>>>   (convert (absu @0))))
>>>
>>>
>>> Now when gimplifying the converted tree, how do we tell that ABSU_EXPR
>>> will take a signed arg and return unsigned. I will have other match.pd
>>> entries so this will be generated while in gimple.passes too. Should I
>>> add new functions in gimple.[h|c] for this.
>>>
>>> Is there any examples I can refer to. Conversion expressions seems to
>>> be the only place where sign can change in gimple assignment but they
>>> are very specific.
>> What's the value in representing ABSU vs a standard ABS followed by a
>> conversion?
> 
> It is based on PR https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64946.
> Specifically, comment 13.
Thanks.  I was wondering if it was supposed to allow you to exploit
hardware capability in the vectorizer better.
> 
>>
>> You'll certainly want to do verification of the type signedness in the
>> gimple verifier.
> I am doing it and it is failing now.
Yea, you're going to have to dig into those.

There may also be some propagations you want to disable or enable given
the semantics you're defining for ABSU.


Jeff


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