From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 048F1385783E; Tue, 3 Nov 2020 07:46:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 048F1385783E From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97642] Incorrect replacement of vmovdqu32 with vpblendd can cause fault Date: Tue, 03 Nov 2020 07:46:08 +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.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com 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: --- 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: Tue, 03 Nov 2020 07:46:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97642 --- Comment #3 from Hongtao.liu --- (In reply to Jakub Jelinek from comment #1) > The problem is that in the RTL representation there is nothing that would > tell cse, forward propagation or combiner etc. not to optimize the > (insn 7 6 8 2 (set (reg:QI 89) > (const_int 31 [0x1f])) "include/avx512vlintrin.h":865:20 77 > {*movqi_internal} > (nil)) > (insn 8 7 9 2 (set (reg:V8SI 87) > (vec_merge:V8SI (mem:V8SI (reg/v/f:DI 86 [ arr ]) [0 S32 A8]) > (reg:V8SI 88) > (reg:QI 89))) "include/avx512vlintrin.h":865:20 1423 > {avx512vl_loadv8si_mask} > (nil)) > into: > (insn 8 7 9 2 (set (reg:V8SI 87) > (vec_merge:V8SI (mem:V8SI (reg/v/f:DI 86 [ arr ]) [0 S32 A8]) > (reg:V8SI 88 [ tmp ]) > (const_int 31 [0x1f]))) "include/avx512vlintrin.h":865:20 4402 > {avx2_pblenddv8si} > (expr_list:REG_DEAD (reg:QI 89) > (expr_list:REG_DEAD (reg:V8SI 88 [ tmp ]) > (expr_list:REG_DEAD (reg/v/f:DI 86 [ arr ]) > (nil))))) > Guess we'd need to use some UNSPEC for the masked loads and have patterns > for combine to optimize those that have -1 masks into normal loads, or > disable the blend patterns with MEM operands for avx512f+ (i.e. force tho= se > into registers). I prefer UNSPEC solution, UNSPEC masked load patterns only needed for intrinsics, _load_mask could be keeped and renamed to _blendm. > Because the RTL representation really matches more the blend behavior than > the avx512 masking, where exceptions from the masked off elts just don't > show up.=