Kyrylo Tkachov <ktkac...@nvidia.com> writes:
>> On 24 Oct 2024, at 10:39, Soumya AR <soum...@nvidia.com> wrote:
>> 
>> Hi Richard,
>> 
>> > On 23 Oct 2024, at 5:58 PM, Richard Sandiford <richard.sandif...@arm.com> 
>> > wrote:
>> > 
>> > External email: Use caution opening links or attachments
>> > 
>> > 
>> > Soumya AR <soum...@nvidia.com> writes:
>> >> diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc 
>> >> b/gcc/config/aarch64/aarch64-sve-builtins.cc
>> >> index 41673745cfe..aa556859d2e 100644
>> >> --- a/gcc/config/aarch64/aarch64-sve-builtins.cc
>> >> +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
>> >> @@ -1143,11 +1143,14 @@ aarch64_const_binop (enum tree_code code, tree 
>> >> arg1, tree arg2)
>> >>       tree type = TREE_TYPE (arg1);
>> >>       signop sign = TYPE_SIGN (type);
>> >>       wi::overflow_type overflow = wi::OVF_NONE;
>> >> -
>> >> +      unsigned int element_bytes = tree_to_uhwi (TYPE_SIZE_UNIT (type));
>> >>       /* Return 0 for division by 0, like SDIV and UDIV do.  */
>> >>       if (code == TRUNC_DIV_EXPR && integer_zerop (arg2))
>> >>      return arg2;
>> >> -
>> >> +      /* Return 0 if shift amount is out of range. */
>> >> +      if (code == LSHIFT_EXPR
>> >> +               && tree_to_uhwi (arg2) >= (element_bytes * BITS_PER_UNIT))
>> > 
>> > tree_to_uhwi is dangerous because a general shift might be negative
>> > (even if these particular shift amounts are unsigned).  We should
>> > probably also key off TYPE_PRECISION rather than TYPE_SIZE_UNIT.  So:
>> > 
>> >        if (code == LSHIFT_EXPR
>> >            && wi::geu_p (wi::to_wide (arg2), TYPE_PRECISION (type)))
>> > 
>> > without the element_bytes variable.  Also: the indentation looks a bit off;
>> > it should be tabs only followed by spaces only.
>> 
>> Thanks for the feedback, posting an updated patch with the suggested changes.
>
> Thanks Soumya, I’ve pushed this patch to trunk as commit 3e7549ece7c after 
> adjusting
> the ChangeLog slightly to start the lines with tabs instead of spaces.

Sorry Soumya, I forgot that you didn't have commit access yet.
It's time you did though.  Could you follow the instructions
on https://gcc.gnu.org/gitwrite.html ?  I'm happy to sponsor
(and I'm sure Kyrill would be too).

Thanks,
Richard

Reply via email to