From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E5A2C3854810; Tue, 7 Mar 2023 13:58:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5A2C3854810 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678197535; bh=OEdEzVL3X65naLD30/7sCyXmSvr37oMX0JkjFCH8C7Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PORIpHYhh6hX/DzT0N7cDIlPiftmh/2bLLzELjqpWMbpaf+WzLp1sYRcfjk2l+mIY Svcpy0hvtW8ezdq0Bjh2IiQ4nZW4BE0JKeY1bP8UJJGckguS9UmO9BDtnjcK5EOGtf Q0z5lULf11ms9xaafw2bNdyxgNbn0ImyW03vPjes= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/109052] Unnecessary reload with -mfpmath=both Date: Tue, 07 Mar 2023 13:58:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ra X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak 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: 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=3D109052 --- Comment #2 from Uro=C5=A1 Bizjak --- The original testcase is: double foo (double a, double b) { double z =3D __builtin_fmod (a, 3.14); return z * b; } -O2 -fno-math-errno: foo: fldl .LC0(%rip) movsd %xmm0, -8(%rsp) fldl -8(%rsp) .L2: fprem fnstsw %ax testb $4, %ah jne .L2 fstp %st(1) fstpl -8(%rsp) --> movsd -8(%rsp), %xmm0 mulsd %xmm1, %xmm0 ret and with -mavx: foo: fldl .LC0(%rip) vmovsd %xmm0, -8(%rsp) fldl -8(%rsp) .L2: fprem fnstsw %ax testb $4, %ah jne .L2 fstp %st(1) fstpl -8(%rsp) --> vmovsd -8(%rsp), %xmm0 vmulsd %xmm1, %xmm0, %xmm0 ret=