From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EA4F63858C36; Mon, 21 Nov 2022 02:43:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA4F63858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668998609; bh=2b6965FZKPJXEtpZ/Pr4gfL7uVhwWcyH5TjkcwTLGgc=; h=From:To:Subject:Date:From; b=ULUt1gdfay5HcKddycEST8yxzcgHoVmSs3BNF4SqxbkgTXfpfDbi5MvXftL8grTql +25exlLp5b75d/Wa0oOoD4rCfANkWIVNaZPqhAZ7sm/gmpvAPxAUd17GsTk5c6FAhu yLs0rQVjlvqYG4juVW582b5LIDItWLX09xIgxlqQ= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/107775] New: misoptimization in vec_set lower part of vector in the memory. Date: Mon, 21 Nov 2022 02:43:29 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht 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 cc target_milestone cf_gcctarget 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=3D107775 Bug ID: 107775 Summary: misoptimization in vec_set lower part of vector in the memory. Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: crazylht at gmail dot com CC: tnfchris at gcc dot gnu.org Target Milestone: --- Target: aarch64-linux-gnu The case is found when i'm looking at https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606373.html, curren= tly x86 gcc can optimize set_lower same as set_lower1, but not after adjusting = in can_change_mode_class. The issue can be reproduce with aarch64 gcc. I'm loo= king at rtl dump, the main difference comes from subreg1, where currently it will split 128-bit load/store into 2 64-bit load/stores which expose the opportu= nity to optimize the upper 64-bit load/store off. typedef double v2df __attribute__((vector_size(16))); v2df reg; void set_lower (double b) { double v[2]; *((v2df*)&v[0]) =3D reg; v[0] =3D b; reg =3D *((v2df*)&v[0]); } void set_lower1 (double b) { reg[0] =3D b; }=