From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66E09386F801; Fri, 5 Mar 2021 12:38:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66E09386F801 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99405] New: Rotate with mask not optimized on x86 for QI/HImode rotates Date: Fri, 05 Mar 2021 12:38:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc dependson target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Mar 2021 12:38:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99405 Bug ID: 99405 Summary: Rotate with mask not optimized on x86 for QI/HImode rotates Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org CC: jakub at gcc dot gnu.org, unlvsur at live dot com Depends on: 99396 Target Milestone: --- +++ This bug was initially created as a clone of Bug #99396 +++ In unsigned char f1 (unsigned char x, unsigned y) { return (x << (y & 7)) | (x= >> (-y & 7)); } unsigned short f2 (unsigned short x, unsigned y) { return (x << (y & 15)) |= (x >> (-y & 15)); } unsigned int f3 (unsigned int x, unsigned y) { return (x << (y & 31)) | (x = >> (-y & 31)); } unsigned char f4 (unsigned char x, unsigned y) { return (x >> (y & 7)) | (x= << (-y & 7)); } unsigned short f5 (unsigned short x, unsigned y) { return (x >> (y & 15)) |= (x << (-y & 15)); } unsigned int f6 (unsigned int x, unsigned y) { return (x >> (y & 31)) | (x = << (-y & 31)); } unsigned char f7 (unsigned char x, unsigned char y) { unsigned char v =3D y= & 7; unsigned char w =3D -y & 7; return (x << v) | (x >> w); } unsigned short f8 (unsigned short x, unsigned char y) { unsigned char v =3D= y & 15; unsigned char w =3D -y & 15; return (x << v) | (x >> w); } unsigned int f9 (unsigned int x, unsigned char y) { unsigned char v =3D y &= 31; unsigned char w =3D -y & 31; return (x << v) | (x >> w); } unsigned char f10 (unsigned char x, unsigned char y) { unsigned char v =3D = y & 7; unsigned char w =3D -y & 7; return (x >> v) | (x << w); } unsigned short f11 (unsigned short x, unsigned char y) { unsigned char v = =3D y & 15; unsigned char w =3D -y & 15; return (x >> v) | (x << w); } unsigned int f12 (unsigned int x, unsigned char y) { unsigned char v =3D y = & 31; unsigned char w =3D -y & 31; return (x >> v) | (x << w); } #ifdef __x86_64__ unsigned long long f13 (unsigned long long x, unsigned y) { return (x << (y= & 63)) | (x >> (-y & 63)); } unsigned long long f14 (unsigned long long x, unsigned y) { return (x >> (y= & 63)) | (x << (-y & 63)); } unsigned long long f15 (unsigned long long x, unsigned char y) { unsigned c= har v =3D y & 63; unsigned char w =3D -y & 63; return (x << v) | (x >> w); } unsigned long long f16 (unsigned long long x, unsigned char y) { unsigned c= har v =3D y & 63; unsigned char w =3D -y & 63; return (x >> v) | (x << w); } #endif we don't optimize away the and instructions in f{1,2,4,5,7,8,10,11}. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99396 [Bug 99396] std::rotl and std::rotr Does not convert into ROTATE on the gim= ple level=