From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4A3173861033; Thu, 28 Mar 2024 09:10:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A3173861033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711617041; bh=H/BUwslrkFiWVjdCXYoWGhQ0kmZ17XyvH8Y2fnbdE6E=; h=From:To:Subject:Date:From; b=LCmWOzLXt73l1clgY3KtY/wCzB9F8TAuSa9NP8elq0gij0FNl6Qcx+3tODgNeWq// bdbRsnpngYK0WzsRyO8RMNZBxrusSdUWZik0JBFi1u6L8cMvn88zuV+5LwagrG3cWO SKDOsuWezPz2/vsI7M2P/PssocluBVbXOYCXK3M0= From: "dizhao at os dot amperecomputing.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/114513] New: [aarch64] floating-point registers are used when GPRs are preferred Date: Thu, 28 Mar 2024 09:10:40 +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: dizhao at os dot amperecomputing.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=3D114513 Bug ID: 114513 Summary: [aarch64] floating-point registers are used when GPRs are preferred Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: dizhao at os dot amperecomputing.com Target Milestone: --- For the case below: typedef unsigned long int uint64_t; extern uint64_t rand_long (); double phi () { double phi; register uint64_t a, b; const uint64_t mask =3D 1ULL << 63; int i; /* Pick any two starting points */ a =3D rand_long (); b =3D rand_long (); /* Iterate until we approach overflow */ for (i =3D 0; (i < 64) && !((a | b) & mask); i++) { register uint64_t c =3D a + b; a =3D b; b =3D c; } phi =3D (double) b / (double) a; return phi; } On aarch64, GCC used floating-point registers for the loop: subs w1, w1, #0x1 fmov d15, d31 fmov d31, x2 b.eq 48 // b.none However, keeping "a" and "b" in GENERAL_REGS is much faster, like: mov x19, x0=20=20=20=20=20 mov x0, x3=20=20=20=20=20=20 subs w2, w2, #0x1 b.eq 48 The option I used is -Ofast/-O3, with -mtune=3Dgeneric/neoverse-n1/neoverse-n2/ampere1 .=