From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 670433858D38; Tue, 17 Oct 2023 11:03:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 670433858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697540594; bh=Wjv6FAhdVFQ+XZkFD/xwknvw9ZcOf8eRdfzeOie2Hh8=; h=From:To:Subject:Date:From; b=t4cYEECy7KI9i0XbR5NT97/gkmuZ40LzzV0DcayQi5WmTDV/noAuSA0DKblacolLt aDfI6hVuP13nRh9AcHOFvEwqpBsxrTv/6CpqZrMqEKkniXJdsexnnPuknfiqlBA9be ivvX1eFpkWbNSm2CQmzlTNHfVlz4354ug7srRmU4= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111848] New: RISC-V: RVV cost model pick unexpected big LMUL Date: Tue, 17 Oct 2023 11:03:14 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: juzhe.zhong at rivai dot ai 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=3D111848 Bug ID: 111848 Summary: RISC-V: RVV cost model pick unexpected big LMUL Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: juzhe.zhong at rivai dot ai Target Milestone: --- #include void f3 (uint8_t *restrict a, uint8_t *restrict b, uint8_t *restrict c, uint8_t *restrict d, int n) { for (int i =3D 0; i < n; ++i) { a[i * 8] =3D c[i * 8] + d[i * 8]; a[i * 8 + 1] =3D c[i * 8] + d[i * 8 + 1]; a[i * 8 + 2] =3D c[i * 8 + 2] + d[i * 8 + 2]; a[i * 8 + 3] =3D c[i * 8 + 2] + d[i * 8 + 3]; a[i * 8 + 4] =3D c[i * 8 + 4] + d[i * 8 + 4]; a[i * 8 + 5] =3D c[i * 8 + 4] + d[i * 8 + 5]; a[i * 8 + 6] =3D c[i * 8 + 6] + d[i * 8 + 6]; a[i * 8 + 7] =3D c[i * 8 + 6] + d[i * 8 + 7]; b[i * 8] =3D c[i * 8 + 1] + d[i * 8]; b[i * 8 + 1] =3D c[i * 8 + 1] + d[i * 8 + 1]; b[i * 8 + 2] =3D c[i * 8 + 3] + d[i * 8 + 2]; b[i * 8 + 3] =3D c[i * 8 + 3] + d[i * 8 + 3]; b[i * 8 + 4] =3D c[i * 8 + 5] + d[i * 8 + 4]; b[i * 8 + 5] =3D c[i * 8 + 5] + d[i * 8 + 5]; b[i * 8 + 6] =3D c[i * 8 + 7] + d[i * 8 + 6]; b[i * 8 + 7] =3D c[i * 8 + 7] + d[i * 8 + 7]; } } This case pick LMUL =3D 8 which causes horrible vector register spillings. After experiment, the ideal LMUL should be 2.=