https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109906
Bug ID: 109906 Summary: a rrotate (32-b) -> a lrotate b Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` static inline unsigned rotateright(unsigned x, int t) { if (t >= 32) __builtin_unreachable(); unsigned tl = x >> (t); unsigned th = x << (32-t); return tl | th; } unsigned rotateleft(unsigned t, int x) { return rotate (t, 32-x); } ``` I would have assumed GCC would produce a rotate left for rotateleft but does not currently.