From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B760E3858D34; Thu, 2 Jul 2020 12:45:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B760E3858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593693907; bh=GN99z3GD4+9/cfZTbIQu6wcSrNgMruRelg0zFr/eESg=; h=From:To:Subject:Date:From; b=FXltQhL3JR/rkMOiOiYBbEuvWJOT8+1z9BBciGzh01lWNoX5TcGNbqY1bQVLlNYnP RxR7KZdNkbLM/cBEBHGJAVzbNd3FvjTx/QnrafGw4rk85BCH7Nc13pmxAxhJ9wNQfI GfBO8waZrL5gbS5ymbRC3K6p/w4TTbZP8jpt0YDQ= From: "zhongyunde at tom dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/96031] New: suboptimal codegen for store low 16-bits value Date: Thu, 02 Jul 2020 12:45:07 +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: 8.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhongyunde at tom 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 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: Thu, 02 Jul 2020 12:45:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96031 Bug ID: 96031 Summary: suboptimal codegen for store low 16-bits value Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhongyunde at tom dot com Target Milestone: --- For the following code, as instruction strh only store the low 16-bits valu= e, so the 'and w2, w2, 65535 ' is redundant. test base on the ARM64 gcc 8.2 on https://gcc.godbolt.org/, so get complica= ted assemble. typedef unsigned int UINT32; typedef unsigned short UINT16; UINT16 array[12]; void foo (UINT32 len, UINT32 step)=20=20=20=20=20=20=20=20=20=20=20=20=20=20 { UINT32 index =3D 1; for (index =3D 1 ; index < len; index++ ) { array[index] =3D index * step; } } // the assemble of kernel loop body -------------------------- b .L4 // .L6: add x3, x3, 2 // ivtmp.6, ivtmp.6, .L4: strh w2, [x4, 2] // ivtmp.4, MEM[base: _2, offset: 2B] add w2, w1, w2 // tmp105, _12, ivtmp.4 and w2, w2, 65535 // ivtmp.4, tmp105 ???? cmp x3, x0 // ivtmp.6, _23 mov x4, x3 // ivtmp.6, ivtmp.6 bne .L6 //,=