From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C2C6D385840D; Wed, 24 Apr 2024 00:02:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2C6D385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713916946; bh=R2of2NwnXsqJ7AN4DqoYhLOtcrKWigJYjUL4s2C2pq0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nb70MXLj3nuEZYd5BN8lKCZou9KOqx8HuFudGd2EyP3rgd+IJGzGcp/Pl9eYjx70r eCGWwK1gVk70rvewbEZbOukKPUfeOd8zriP48Vicsp0ZAjaHCNXJ6tAoQ2AumQSt3e EhDVsZ6K31FK5ZdOPyom0iqOURCPxTIyDN/Mp47g= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/98477] aarch64: Unnecessary GPR -> FPR moves for conditional select Date: Wed, 24 Apr 2024 00:02:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=3D98477 --- Comment #5 from Andrew Pinski --- So adding the `r` alternative to *cmov_insn (GPF) works kinda of but = then we seem to have a register allocation issue. Even this still causes FPREGS from being chosen: ``` void foo (int a, double *b) { double t =3D a ? 10000.0 : 200.0; asm("":"+r"(t)); *b =3D t; } ``` Someone else will need to look into register allocator issue later on. I did find a testcase where we don't get the fmovs though (which forces to = use x0). ``` void foo (int a, double *b) { double t =3D a ? 10000.0 : 200.0; register double tt __asm__("x0"); tt =3D t; asm("":"+r"(tt)); *b =3D tt; } ``` With that we now get: ``` cmp w0, 0 mov x0, 149533581377536 mov x2, 4641240890982006784 movk x0, 0x40c3, lsl 48 csel x0, x2, x0, eq str x0, [x1] ret ``` So at least I can write up a testcase ...=