From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EB0013858D3C; Mon, 8 May 2023 08:09:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB0013858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683533386; bh=RfHeIbL6g3Jcpk2N1OK7lWCXNnPepeVkGJbg9/3R3M4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=atc6vXpd/9PS7mvMJnTgE4kfn2Yg2wM09OAUyMUHrF7ZuYOtOG70nxi3/KvYl23uQ nEjBybQWGtagmHIwwMgo7eDYwX+Gqz52ASq0aJdFHSbk1bT3vXqZcF0ggxO8BWs0mt AvU3fwpBVw7L6mVYk8mSPVpg+YlPv2NgLqLeCnC0= From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109764] V2SI multiply high is not vectorized on x86_64 Date: Mon, 08 May 2023 08:09:46 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak 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=3D109764 --- Comment #3 from Uro=C5=A1 Bizjak --- (In reply to Richard Biener from comment #2) > Confirmed. Pattern recog recognizes the widening multiplication but not a > highpart multiplication. That's currently missing. Please note that the following testcase that multiplies short -> int: --cut here-- #define N 2 unsigned short ur[N], ua[N], ub[N]; void mulh (void) { int i; for (i =3D 0; i < N; i++) ur[i] =3D ((unsigned int) ua[i] * ub[i]) >> 16; } void mulh_slp (void) { ur[0] =3D ((unsigned int) ua[0] * ub[0]) >> 16; ur[1] =3D ((unsigned int) ua[1] * ub[1]) >> 16; } --cut here-- vectorizes with -O2 -fno-vec-cost-model via .MULH: vect__15.6_1 =3D MEM [(short unsigned int *)&ua]; vect__17.9_3 =3D MEM [(short unsigned int *)&ub]; vect_patt_34.10_5 =3D .MULH (vect__15.6_1, vect__17.9_3); MEM [(short unsigned int *)&ur] =3D vect_patt_34.10_5; and generates expected: movd ua(%rip), %xmm0 movd ub(%rip), %xmm1 pmulhuw %xmm1, %xmm0 movd %xmm0, ur(%rip) in both cases.=