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 [] 
Sent: Tuesday, August 8, 2017 12:52 PM
To: Michael Collison <>
Cc:; nd <>;
Subject: RE: [PATCH] [Aarch64] Optimize subtract in shift counts

> This case is covered by Wilco's previous reply:

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