From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C84483858D28; Tue, 21 Feb 2023 00:54:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C84483858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676940889; bh=79M8y8UbzYMYCCcQXTn7hO891cHzBaqSiFL3r6bmNv4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bLJib4fw+yONfdfNYhvrcSMz5JBHeNIYOaQRWzWzL1P++9lxMgiXkbWTU8tzdAEhZ XrEVidItVMV/zHee3jZSPl4uUiuaUTg1wfWOICzr9j5wQkeOhBuj9X/aQJyLweWohR gkB2kMA5NTayJcmkgy2bnop91OHWL3WBzgZ9/HgE= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108804] missed vectorization in presence of conversion from uint64_t to float Date: Tue, 21 Feb 2023 00:54:47 +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: 12.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement 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=3D108804 --- Comment #3 from Hongtao.liu --- I think the point here is: although it's unit64_t -> float, but the range o= f x and y can be represent as int32(k & 0x007FFFFF) | 0x3F800000), so we can u= se int32 -> float instructions which are supported by the backend. So it looks to me a middle-end issue. A simple testcase clang generates vcvtdq2ps but gcc doesn't vectorize. #include uint64_t d[512]; float f[1024]; void foo() { for (int i=3D0; i<512; ++i) { uint64_t k =3D d[i]; f[i]=3D(k & 0x3F30FFFF); } } manually add convertion then gcc also can do vectorization. #include uint64_t d[512]; float f[1024]; void foo() { for (int i=3D0; i<512; ++i) { uint64_t k =3D d[i]; f[i]=3D(int)(k & 0x3F30FFFF); } }=