From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DE1883858C66; Sat, 25 May 2024 17:15:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE1883858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716657315; bh=zdkI3UxXLOyDUvgJEr2INSY4F+7GqVZUjvTDbdYZX6o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VnsAAHTsnIbrRyvsEQrcvTy2HcCFu1yTSMH33AH7iuhQ0QS6vP5/cfhycQGVd8eNA ZXzyWFl9y4EgW7KvckcCzrTgF/IrPdjOnzJaN+skETyCLjF6tzIm8iCC8zku7OplQ9 W6kr0vWC6qUv1jQmTCy1ymk0Ha7qmjYxrP8bt+yQ= From: "amonakov at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115161] [15 Regression] highway-1.0.7 miscompilation of some SSE2 intrinsics Date: Sat, 25 May 2024 17:15:14 +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: 15.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: amonakov at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 15.0 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=3D115161 --- Comment #23 from Alexander Monakov --- (In reply to Sergei Trofimovich from comment #22) > Here `pcmpeqd %xmm2,%xmm1` is a problematic instruction. Why does `gcc` u= se > `%xmm2` (result of `cvttps2dq`) instead of, say `%xmm0` which contains > `0xFFFFffff` pattern? %xmm0 contains the first all-ones argument to assert_eq. The comparison nee= ds to happen against a register that contains 0x7fff_ffff (x4), and GCC "think= s" that %xmm2 contains that value. At -O1, the optimization is done by the RTL= CSE pass (you can confirm by switching it off with -fdisable-rtl-cse1 along -O1= ), it sees (insn 6 5 7 2 (set (reg:V4SF 97) (mem/u/c:V4SF (symbol_ref/u:DI ("*.LC1") [flags 0x2]) [0 S16 A128]= )) "/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/xmmintrin.h":386:19 1335 {movv4sf_internal} (expr_list:REG_EQUAL (const_vector:V4SF [ (const_double:SF 4.294967296e+9 [0x0.8p+33]) repeated x4 ]) (nil))) (insn 10 9 11 2 (set (reg:V4SI 98) (fix:V4SI (reg:V4SF 97))) "/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include/emmintrin.h":832:19 2635 {fix_truncv4sfv4si2} (expr_list:REG_EQUAL (const_vector:V4SI [ (const_int 2147483647 [0x7fffffff]) repeated x4 ]) (expr_list:REG_DEAD (reg:V4SF 99) (nil)))) Note the incorrect REG_EQUAL caused by inappropriate use of fix:V4SI where = the source code had cvttps2dq.=