On Thu, Sep 11, 2025 at 07:14:51PM +0200, Richard Biener wrote: > Yes, RTL expansion inserts an AND operation when !SHIFT_COUNT_TRUNCATED. > What I was saying there's no way to get a negative shift count flip shift > direction to RTL - it would require a target specific intrinsic that's a > builtin > call before RTL expansion and an UNSPEC after.
Of course the target can have patterns like: (set (match_operand:M 0) (if_then_else:M (lt:SI (match_operand:SI 2) (const_int 0)) (ashiftrt:M (match_operand:M 1) (neg:SI (match_dup 2))) (ashift:M (match_dup 1) (match_dup 2)))) or so, it doesn't need to use UNSPEC for that. Jakub