From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AB6B83858D35; Tue, 10 Oct 2023 11:56:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB6B83858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696938982; bh=YaVkcV70PBXLzqMnWzsFLL8z3FUODejZwIAjrkJhGa4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VOw2lvQ4+hNk/8IFxcOaV3eTzNC0tPUtk66LdOe4YLcc6hAgGBptn/HkEx6r6w5xx Z0WpXFUkSAnUiaXV8Nl574if+BNEOghtr9HeX2T0hwJQ2mJqGeHTO98kBBBDELNC24 4Gkh/sM7G6StFkkwwYZhRkRRFcYFIcaEU8NUZmD8= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111751] RISC-V: RVV unexpected vectorization Date: Tue, 10 Oct 2023 11:56:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: juzhe.zhong at rivai dot ai X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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=3D111751 --- Comment #18 from JuzheZhong --- (In reply to Richard Biener from comment #16) > (In reply to JuzheZhong from comment #14) > > Also this case ICE: > >=20 > > typedef unsigned char __attribute__((vector_size(4))) uvec; > >=20 > > int main (int argc, char *argv[]) { > > int i; > > int x =3D 0; > > uvec uc0 =3D (uvec) {argc, 1, 2, 10}; > > unsigned char uc1[4] =3D {0, 3, 2, 200}; > > signed char ucg[4] =3D {1, 0, 0, 0 }; > > signed char ucl[4] =3D {0, 1, 0, 1 }; > >=20 > > #define uc0_ ((unsigned char *)&uc0) > >=20 > > for (i =3D 0; i < 4; i ++) { > > x |=3D ucg[i] !=3D (uc0_[i] > uc1[i]); > > x |=3D ucl[i] !=3D (uc0_[i] < uc1[i]); > > } > > return x; > > } > >=20 > > during GIMPLE pass: isel > > dump file: auto.c.256t.isel > > auto.c: In function 'main': > > auto.c:3:5: internal compiler error: in gimple_expand_vec_cond_expr, at > > gimple-isel.cc:328 > > 3 | int main (int argc, char *argv[]) { > > | ^~~~ > > 0x1bb55bd gimple_expand_vec_cond_expr > > ../../../../gcc/gcc/gimple-isel.cc:325 > > 0x1bb57c6 execute > > ../../../../gcc/gcc/gimple-isel.cc:390 > >=20 > >=20 > > Looks odd, it ICE at gimple-isel.cc: > >=20 > > gcc_assert (VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (op0)) >=20 > I have a fix for the first issue. For this one the issue seems to be that > we do have vec_cmp for _2 > { 0, 3, 2, 200 } when doing instruction > selection for >=20 > mask__11.18_97 =3D VEC_COND_EXPR 0, 0 }>; >=20 > note the value is of vector boolean type. But we fail to have > vcond_maskV4BIV4BI. >=20 > ISTR we have fixed sth similar > by adding missing patterns with VnBImode result? But maybe forgot about > VLS modes here? Confirm the second issue is fixed after I added vcond_mask of VLS BOOL mask mode I will commit it after I finish RISC-V regression.=