From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F5663858014; Fri, 28 Oct 2022 05:22:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F5663858014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666934542; bh=d+BiKbTXSd2GIAGMkdgGJKkdfy7ZdAB//rZE9FrG+mE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ldrOf9QPIGBRe8xBPUOreNFgiVK3y0RYL0CTDlu2EZuK3dhvZ8HuBiRWb/dXPW51p 8JWkni6ifujmQG3vuBs2oSbCqg2MiprOIedbtUFqC9nOoiYq6P5PDPbjE0bv2OxYFu GrkprgUwstTkgh7zlWtcEJCV9hKC0bW3uCTZESno= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/107432] __builtin_convertvector generates inefficient code Date: Fri, 28 Oct 2022 05:22:22 +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: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht 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=3D107432 --- Comment #5 from Hongtao.liu --- > It's lowered by pass_lower_vector, ideally, can we use truncmn2 in > expand_VEC_CONVERT if src is bigger integer mode than dest. Currently, expand_vector_conversion uses VEC_PACK_TRUNC_EXPR ---------------cut begins------------------------ else if (modifier =3D=3D NARROW) { switch (code) { CASE_CONVERT: code1 =3D VEC_PACK_TRUNC_EXPR; optab1 =3D optab_for_tree_code (code1, arg_type, optab_default); break; ---------------Cut ends------------------------ But BB vectorizer can do the right thing for=20 void foo (long long* a, int* b) { b[0] =3D a[0]; b[1] =3D a[1]; b[2] =3D a[2]; b[3] =3D a[3]; } vmovdqu ymm0, YMMWORD PTR [rdi] vpmovqd XMMWORD PTR [rsi], ymm0 vzeroupper ret vect__1.5_16 =3D MEM [(long long int *)a_10(D)]; vect__2.6_18 =3D (vector(4) int) vect__1.5_16; # DEBUG BEGIN_STMT # DEBUG BEGIN_STMT # DEBUG BEGIN_STMT MEM [(int *)b_11(D)] =3D vect__2.6_18; return; Guess expand_vector_conversion can be optimized.=