From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3948F3858C53; Thu, 4 Jan 2024 09:07:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3948F3858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704359259; bh=uLZgNK2PilTocaIKpprpUw5pDoCsOEh+GaEPcaxV9Hs=; h=From:To:Subject:Date:From; b=GLaphKfl2sTbSWGt5vWAOlBSf2/JNSnSERyE6uFc0Vz2lppRDfGr0ivfFa39LftCA e9K1fBsj+977wSmwZ8ACNfOcSyJi+3/3DbVtkXar/JX58ZLBtpif/EKeSdYemdDhIw umFyt29fJfs4RJHVy3+uXnLDlYznT3FXfGJbkJoY= From: "denis.campredon at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/113231] New: x86_64 use MMX instructions for simple shift operations Date: Thu, 04 Jan 2024 09:07:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: denis.campredon at gmail dot com 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 bug_severity priority component assigned_to reporter 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113231 Bug ID: 113231 Summary: x86_64 use MMX instructions for simple shift operations Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with -Os, the following functions use MMX instructions for simple shift. ------------------ void foo(int *i) { *i *=3D2; } void bar(int *i) { *i <<=3D2; } void baz(int *i) { *i >>=3D2; } ------------------ foo(int*): movd xmm0, DWORD PTR [rdi] pslld xmm0, 1 movd DWORD PTR [rdi], xmm0 ret bar(int*): movd xmm0, DWORD PTR [rdi] pslld xmm0, 2 movd DWORD PTR [rdi], xmm0 ret baz(int*): movd xmm0, DWORD PTR [rdi] psrad xmm0, 2 movd DWORD PTR [rdi], xmm0 ret ----------------- I would expect the generated code to use "sar" or "sal" instructions like O2 uses. The functions used to generate optimal code with version 9.5.=