From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9D0333858D32; Mon, 29 May 2023 06:14:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D0333858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685340886; bh=JZvQ6UFvqzaKTexVNE+juwGt37SjRWzO9rCoQsE5PeU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BCx9WTzU5KjAarUqs/VIiZ4ealiRqXYyXTt/AIJn0HVyFUI9rjeEzwkFuFEKrq+qJ dgUS3vhPJYXfbI7S7vYQ9pTS3Ro8GMDDguDnLlDU2c3fT5h9OLEPW/4dJkWaAQ87xT YWvVRE1eRmOnhxW9HRjWi0XF+pbHvKqcY9ifjhCM= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110018] Missing vectorizable_conversion(unsigned char -> double) for BB vectorizer Date: Mon, 29 May 2023 06:14:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110018 --- Comment #3 from Hongtao.liu --- Even we have direct optab for unsigned char to long long, BB vectorizer fai= ler to optimize void foo1 (long long* __restrict a, unsigned char* b) { a[0] =3D b[0]; a[1] =3D b[1]; a[2] =3D b[2]; a[3] =3D b[3]; a[4] =3D b[4]; a[5] =3D b[5]; a[6] =3D b[6]; a[7] =3D b[7]; } since we have vectype_out as V4DImode, but vectype_in as V8QImode as *vecty= pe =3D SLP_TREE_VECTYPE (child); If manually change the testcase to void foo1 (long long* __restrict a, unsigned char* b) { a[0] =3D b[0]; a[1] =3D b[1]; a[2] =3D b[2]; a[3] =3D b[3]; } Then BB vectorizer can do vectorization, but still failed for void foo1 (double* __restrict a, unsigned char* b) { a[0] =3D b[0]; a[1] =3D b[1]; a[2] =3D b[2]; a[3] =3D b[3]; } So it looks there're 2 separate issue 1. As mentioned in the PR, we can use intermediate type for vectorizable unsigned char to double. 2. There's mismatch between vectype_out and vectype_in as SLP_TREE_VECTYPE (child);=