From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 040233858D1E; Fri, 28 Jan 2022 07:05:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 040233858D1E From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104265] New: Missed vectorization in 526.blender_r Date: Fri, 28 Jan 2022 07:05:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2022 07:05:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104265 Bug ID: 104265 Summary: Missed vectorization in 526.blender_r Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- Blenders hottest spot is rayobject_bb_intersect_test which can be summarize= d as struct Isect { float start[3]; float dir[3]; float dist; float origstart[3]; float origdir[3]; int bv_index[6]; float idot_axis[3]; /* More stuff. */ void *userdata; /* aligns it to 8 */ }; int rayobject_bb_intersect_test (struct Isect *isec, const float *bb) { float t1x =3D (bb[isec->bv_index[0]] - isec->start[0]) * isec->idot_axis[= 0]; float t2x =3D (bb[isec->bv_index[1]] - isec->start[0]) * isec->idot_axis[= 0]; float t1y =3D (bb[isec->bv_index[2]] - isec->start[1]) * isec->idot_axis[= 1]; float t2y =3D (bb[isec->bv_index[3]] - isec->start[1]) * isec->idot_axis[= 1]; float t1z =3D (bb[isec->bv_index[4]] - isec->start[2]) * isec->idot_axis[= 2]; float t2z =3D (bb[isec->bv_index[5]] - isec->start[2]) * isec->idot_axis[= 2]; if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2= y < t1z) return 0; if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return 0; if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0; return 1; } at least on x86 with SSE4 (for some extra permutes) we can vectorize the comparisons, carefully filling extra lanes of V4SF vectors with redundant data from another lane starting with {t1x,t1y,t1z,} {t2x,t2y,t2z,} vectors. AOCC does this kind of vectorization and receives a nice 25% uplift in performance from it.=