https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82830
Bug ID: 82830 Summary: short rotate with truncated length Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- Target: x86_64-*-* #include <x86intrin.h> unsigned short f(unsigned short x,int n){ return _rotwl(x,n&15); } andl $15, %ecx rolw %cl, %ax I believe the masking is unnecessary. We have some related things in i386.md, but only for SWI48.