Because for integer shift instructions the shift count is truncated. We ensure 
that we only use integer shift instructions by emitting a shift with a mask. 
This only matches integer shift instructions in the md file.

-----Original Message-----
From: Richard Kenner [mailto:ken...@vlsi1.ultra.nyu.edu] 
Sent: Tuesday, August 8, 2017 12:52 PM
To: Michael Collison <michael.colli...@arm.com>
Cc: gcc-patches@gcc.gnu.org; nd <n...@arm.com>; pins...@gmail.com
Subject: RE: [PATCH] [Aarch64] Optimize subtract in shift counts

> This case is covered by Wilco's previous reply:
> 
> https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00575.html

Which I don't understand:

> No it's perfectly safe - it becomes an integer-only shift after the 
> split since it keeps the masking as part of the pattern.

Let say we have your first example:

long f1(long x, int i)
{
  return x >> (64 - i);
}

If "i" is -2, this should be a shift of 66 (which is indeed, technically 
undefined), but becomes a shift of 62.  What am I missing?

Reply via email to