From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 292083858D1E; Fri, 30 Sep 2022 14:41:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 292083858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664548893; bh=uSE+cXDbiemBMBqvcZ1sjTGuZ0pO4VPhGYrZgdmezs4=; h=From:To:Subject:Date:From; b=L9aMP2cFq/OnKTzt4RM0XpT9s5j0yKMjdTOv/QgQ5AxyZxDQvzmdgvyHhv7xvTXUG Pkzb/TZNRy2r3vMn7P5S8s8q6+PaKzvuzpRXQ+5y0tHCz/WVvnY8TwQKDqnxk2nHAp ghW5Nt1HFmRTNhPSMjLMBblBdJHgK/t3FyGXnjEc= From: "amonakov at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107099] New: uncprop a bit Date: Fri, 30 Sep 2022 14:41:32 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: amonakov 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107099 Bug ID: 107099 Summary: uncprop a bit Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: amonakov at gcc dot gnu.org Target Milestone: --- For the following testcase #include __attribute__((target("avx"))) int f(__m128i a[], long n) { for (long i =3D 0; i < n; i++) if (!_mm_testz_si128(a[i], a[i])) return 0; return 1; } gcc -O2 generates f: test rsi, rsi jle .L4 xor eax, eax jmp .L3 .L10: add rax, 1 cmp rsi, rax je .L4 .L3: mov rdx, rax sal rdx, 4 vmovdqa xmm0, XMMWORD PTR [rdi+rdx] xor edx, edx vptest xmm0, xmm0 sete dl je .L10 mov eax, edx ret .L4: mov edx, 1 mov eax, edx ret Note the redundant assignments to edx in the loop and compare with gcc -O2 -fdisable-tree-uncprop1 Also note that generally uncprop adds a data dependency where only a control dependency existed, hurting speculative execution (hence more appropriate f= or -Os than -O2).=