From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2C0AA3858294; Sat, 9 Jul 2022 03:45:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C0AA3858294 From: "law at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106240] New: [13 Regression] Recent change causes missed vectorization opportunity on mips Date: Sat, 09 Jul 2022 03:45:50 +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: law 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: Sat, 09 Jul 2022 03:45:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106240 Bug ID: 106240 Summary: [13 Regression] Recent change causes missed vectorization opportunity on mips Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: law at gcc dot gnu.org Target Milestone: --- This can be see on the mipsisa32r2-linux-gnu target with a cross compiler. Starting a couple months ago these tests started failing on mipsisa32r2-linux-gnu: Tests that now fail, but worked before (24 tests): gcc.target/mips/mips-ps-5.c -O1 scan-assembler \tadd\\.ps\t gcc.target/mips/mips-ps-5.c -O1 scan-assembler \tc\\.eq\\.ps\t gcc.target/mips/mips-ps-5.c -O1 scan-assembler \tmov[tf]\\.ps\t gcc.target/mips/mips-ps-5.c -O2 scan-assembler \tadd\\.ps\t gcc.target/mips/mips-ps-5.c -O2 scan-assembler \tc\\.eq\\.ps\t gcc.target/mips/mips-ps-5.c -O2 scan-assembler \tmov[tf]\\.ps\t gcc.target/mips/mips-ps-5.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions scan-assembler \tadd\\.ps\t gcc.target/mips/mips-ps-5.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions scan-assembler \tc\\.eq\\.ps\t gcc.target/mips/mips-ps-5.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions scan-assembler \tmov[tf]\\.ps\t gcc.target/mips/mips-ps-5.c -O3 -g scan-assembler \tadd\\.ps\t gcc.target/mips/mips-ps-5.c -O3 -g scan-assembler \tc\\.eq\\.ps\t gcc.target/mips/mips-ps-5.c -O3 -g scan-assembler \tmov[tf]\\.ps\t gcc.target/mips/mips-ps-7.c -O1 scan-assembler \tadd\\.ps\t gcc.target/mips/mips-ps-7.c -O1 scan-assembler \tc\\.eq\\.ps\t gcc.target/mips/mips-ps-7.c -O1 scan-assembler \tmov[tf]\\.ps\t gcc.target/mips/mips-ps-7.c -O2 scan-assembler \tadd\\.ps\t gcc.target/mips/mips-ps-7.c -O2 scan-assembler \tc\\.eq\\.ps\t gcc.target/mips/mips-ps-7.c -O2 scan-assembler \tmov[tf]\\.ps\t gcc.target/mips/mips-ps-7.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions scan-assembler \tadd\\.ps\t gcc.target/mips/mips-ps-7.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions scan-assembler \tc\\.eq\\.ps\t gcc.target/mips/mips-ps-7.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions scan-assembler \tmov[tf]\\.ps\t gcc.target/mips/mips-ps-7.c -O3 -g scan-assembler \tadd\\.ps\t gcc.target/mips/mips-ps-7.c -O3 -g scan-assembler \tc\\.eq\\.ps\t gcc.target/mips/mips-ps-7.c -O3 -g scan-assembler \tmov[tf]\\.ps\t This change is the trigger: commit 68e0063397ba820e71adc220b2da0581dce29ffa Author: Richard Biener Date: Mon Apr 11 13:36:53 2022 +0200 Force the selection operand of a GIMPLE COND_EXPR to be a register This goes away with the selection operand allowed to be a GENERIC tcc_comparison tree. It keeps those for vectorizer pattern recog, those are short lived and removing this instance is a bigger task. The patch doesn't yet remove dead code and functionality, that's left for a followup. Instead the patch makes sure to produce valid GIMPLE IL and continue to optimize COND_EXPRs where the previous IL allowed and the new IL showed regressions in the testsuite. [ ... ] Basically before this change we were able to vectorize the loop and after t= hat change we no longer vectorize the loop. Testcase: /* { dg-do compile } */ /* { dg-options "-mpaired-single -mgp64 -ftree-vectorize forbid_cpu=3Docteo= n.*" } */ /* { dg-skip-if "requires vectorization" { *-*-* } { "-O0" "-Os" } { "" } }= */ extern float a[] __attribute__ ((aligned (8))); extern float b[] __attribute__ ((aligned (8))); extern float c[] __attribute__ ((aligned (8))); NOMIPS16 void foo (void) { int i; for (i =3D 0; i < 16; i++) a[i] =3D b[i] =3D=3D c[i] + 1 ? b[i] : c[i]; } /* { dg-final { scan-assembler "\tadd\\.ps\t" } } */ /* { dg-final { scan-assembler "\tc\\.eq\\.ps\t" } } */ /* { dg-final { scan-assembler "\tmov\[tf\]\\.ps\t" } } */ Compilation line: /home/jlaw/test/obj/mipsisa32r2-linux-gnu/obj/gcc/gcc/xgcc -B/home/jlaw/test/obj/mipsisa32r2-linux-gnu/obj/gcc/gcc/ /home/jlaw/test/gcc/gcc/testsuite/gcc.target/mips/mips-ps-5.c -fdiagnostics-plain-output -O2 -DNOMIPS16=3D"__attribute__((nomips16))" -DNOMICROMIPS=3D"__attribute__((nomicromips))" -DNOCOMPRESSION=3D"__attribute__((nocompression))" -mabi=3Do64 -mips64r2 -mhard-float -mdouble-float -mfp64 -mgp64 -mlong32 -mpaired-single -modd-sp= reg -ftree-vectorize -fno-ident -S -o mips-ps-5.s -fdump-tree-all-details As one would expect this patch changes the form of the COND_EXPRs and ultimately we're unable to vectorize as a result. I haven't dug any deeper than that.=