Alexandre Oliva <ol...@adacore.com> writes:
> On Jun 25, 2024, Richard Sandiford <richard.sandif...@arm.com> wrote:
>
>>> Richard (Sandiford), do you happen to recall why the IRC conversation
>>> mentioned in the PR trail decided to drop it entirely, even for signed
>>> types?
>
>> In the PR, the original shift was 32768 >> x (x >= 16) on ints, which the
>> vectoriser was narrowing to 32768 >> x' on shorts.  The original shift is
>> well-defined for both signed and unsigned shifts, and no valid x' exists
>> for that case.
>
> It sounds like shifts on shorts proper, that would have benefitted from
> the optimization, was not covered and thus there may be room for
> reconsidering, eh?

What kind of case are you thinking of?  If a frontend creates a true
16-bit shift then it wouldn't need to be narrowed by this optimisation.

Like you say in the commit message, the problem here is that the values
are promoted to ints and then shifted as 32-bit values, so shifts by
>= 16 are well-defined.

Richard

Reply via email to