Thanks Jakub for explaining.

Hi Richard,

Does it mean we need to do some promotion similar as this patch to make the 
vectorizable_call happy
when there is a constant operand? I am not sure if there is a better approach 
for this case.

Pan 

-----Original Message-----
From: Jakub Jelinek <ja...@redhat.com> 
Sent: Sunday, August 18, 2024 5:21 AM
To: Li, Pan2 <pan2...@intel.com>
Cc: Richard Biener <richard.guent...@gmail.com>; gcc-patches@gcc.gnu.org; 
juzhe.zh...@rivai.ai; kito.ch...@gmail.com; tamar.christ...@arm.com; 
jeffreya...@gmail.com; rdapp....@gmail.com; Liu, Hongtao <hongtao....@intel.com>
Subject: Re: [PATCH v1] Vect: Promote unsigned .SAT_ADD constant operand for 
vectorizable_call

On Sat, Aug 17, 2024 at 05:03:14AM +0000, Li, Pan2 wrote:
> Thanks Richard for confirmation. Sorry almost forget this thread.
> 
> Please feel free to let me know if there is anything I can do to fix this 
> issue. Thanks a lot.

There is no bug.  The operands of .{ADD,SUB,MUL}_OVERFLOW don't have to
have the same type, as described in the
__builtin_{add,sub,mul}_overflow{,_p} documentation, each argument can have
different type and result yet another one, the behavior is then (as if) to
perform the operation in infinite precision and if that result fits into
the result type, there is no overflow, otherwise there is.
So, there is no need to promote anything, promoted constants would have the
same value as the non-promoted ones and the value is all that matters for
constants.

        Jakub

Reply via email to