Richard, The pattern will only be matched if the value is positive. More specifically if the constant value is 32 (SImode) or 64 (DImode).
-----Original Message----- From: Richard Kenner [mailto:ken...@vlsi1.ultra.nyu.edu] Sent: Monday, August 7, 2017 6:56 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 > On Aarc64 SHIFT_COUNT_TRUNCATED is only true if SIMD code generation > is disabled. This is because the simd instructions can be used for > shifting but they do not truncate the shift count. In that case, the change isn't safe! Consider if the value was negative, for example. Yes, it's technically undefined, but I'm not sure I'd want to rely on that.