From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7D1533982401; Fri, 26 Feb 2021 08:27:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D1533982401 From: "lh_mouse at 126 dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99234] [10/11 regression] wrong result for 1.0/3.0 with -O2 -fno-omit-frame-pointer -frounding-math Date: Fri, 26 Feb 2021 08:27:29 +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: 10.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: lh_mouse at 126 dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ebotcazou at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.2 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2021 08:27:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99234 --- Comment #15 from Liu Hao --- Thanks. The 'Final fix' looks good to me. I applied it locally and built GCC. With a debugger, I verified that after = the try-catch statement, all non-volatile XMM registers (6-15) had been restored properly. ``` // x86_64-w64-mingw32-g++ -O2 -fno-omit-frame-pointer test.cc __attribute__((__noinline__)) void clobber_xmm6() { __asm__ volatile ("xorpd %%xmm6, %%xmm6" ::: "xmm6"); throw 42; // remove this to get expected result } int main() { static const double xmm5 =3D 5.123456; static const double xmm6 =3D 6.123456; static const double xmm7 =3D 7.123456; static const double xmm8 =3D 8.123456; static const double xmm9 =3D 9.123456; static const double xmm10 =3D 10.123456; static const double xmm11 =3D 11.123456; static const double xmm12 =3D 12.123456; static const double xmm13 =3D 13.123456; static const double xmm14 =3D 14.123456; static const double xmm15 =3D 15.123456; __asm__ volatile ("movsd %0, %%xmm5 " :: "m"(xmm5 )); __asm__ volatile ("movsd %0, %%xmm6 " :: "m"(xmm6 )); __asm__ volatile ("movsd %0, %%xmm7 " :: "m"(xmm7 )); __asm__ volatile ("movsd %0, %%xmm8 " :: "m"(xmm8 )); __asm__ volatile ("movsd %0, %%xmm9 " :: "m"(xmm9 )); __asm__ volatile ("movsd %0, %%xmm10" :: "m"(xmm10)); __asm__ volatile ("movsd %0, %%xmm11" :: "m"(xmm11)); __asm__ volatile ("movsd %0, %%xmm12" :: "m"(xmm12)); __asm__ volatile ("movsd %0, %%xmm13" :: "m"(xmm13)); __asm__ volatile ("movsd %0, %%xmm14" :: "m"(xmm14)); __asm__ volatile ("movsd %0, %%xmm15" :: "m"(xmm15)); try { clobber_xmm6(); } catch(...) { } double value; __asm__ volatile ("movsd %%xmm6, %0" : "=3Dx"(value)); __builtin_printf("value =3D %g\n", value); // expect `123.456` } ```=