From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A37463858C39; Mon, 12 Jun 2023 08:06:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A37463858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686557197; bh=8pIp9V+UF6ercyq68RiWbQ5sPFj1lmL4UrEJybbj40c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oIwY3BGlz9JnQ6wFpQA6DT39jVK1Vu9U7XDqyWEhEnE1xTeYwLmdH7qP8C+xmtxT7 t85AcW7Xq8sKNbs+8c8HClmQ3GOgNMPfJM0smLWyi+AkD06ukxS094OYFQdL8rVcLL S3zFaIQpf7vhvVNIRg5lFSSi8/tcY3532kBXQYOg= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/108410] x264 averaging loop not optimized well for avx512 Date: Mon, 12 Jun 2023 08:06:37 +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: rguenther at suse dot de 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=3D108410 --- Comment #7 from rguenther at suse dot de --- On Mon, 12 Jun 2023, crazylht at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108410 >=20 > --- Comment #6 from Hongtao.liu --- >=20 > > and the key thing to optimize is > >=20 > > ivtmp_78 =3D ivtmp_77 + 4294967232; // -64 > > _79 =3D MIN_EXPR ; > > _80 =3D (unsigned char) _79; > > _81 =3D {_80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, = _80, > > _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _= 80, > > _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _= 80, > > _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _80, _= 80, > > _80, _80, _80, _80, _80, _80}; > >=20 > > that is we want to broadcast a saturated (to vector element precision) = value. >=20 > Yes, backend needs to support vec_pack_ssat_m, vec_pack_usat_m. Can x86 do this? We'd want to apply this to a scalar, so move ivtmp to xmm, apply pack_usat or as you say below, the non-existing us_trunc and then broadcast.=