From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2B8113857BA3; Thu, 11 Jan 2024 08:10:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B8113857BA3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704960637; bh=bjDPa+G4Gk4KLc84dCFACGY4YOhiGUp8hJWeHEoSSfo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=r4gYaKbGEIvl6/U3d4cG0VvO58PD/qA/v2ULibtbD35my2JnKtYNCdDJPzzwp4y3y zsTwXCsf7oWzjFg9iddIJvuUg7c8KBhUWGgAM//BSVyoWfHl4VKJFcWpsMBcXDwRsa 6HdVuMFnNPZJZHSZsiEgGUuRz5VaiIAbJNUGsDnw= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113326] Optimize vector shift with constant delta on shifting-count operand Date: Thu, 11 Jan 2024 08:10:36 +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: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org 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=3D113326 --- Comment #5 from Andrew Pinski --- One more thing: ``` vect_shift_0 =3D vect_value >> { 0, 1, 2, 3 }; vect_shift_1 =3D vect_value >> { 4, 5, 6, 7 }; vect_shift_2 =3D vect_value >> { 8, 9, 10, 11 }; vect_shift_3 =3D vect_value >> { 12, 13, 14, 15 }; ``` vs ``` vect_shift_0 =3D vect_value >> { 0, 1, 2, 3 }; vect_shift_1 =3D vect_shift_0 >> { 4, 4, 4, 4 }; vect_shift_2 =3D vect_shift_0 >> { 8, 8, 8, 8 }; vect_shift_3 =3D vect_shift_0 >> { 12, 12, 12, 12 }; ``` the first has fully independent operations while in the second case, there = is one dependent and the are independent operations. On cores which has many vector units the first one might be faster than the second one. So this needs a cost model too.=