* [PATCH] Fix(?) PR66002
@ 2015-05-04 14:18 Richard Biener
2015-05-07 9:51 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2015-05-04 14:18 UTC (permalink / raw)
To: gcc-patches
This fixes a missed vectorization of a function in paq8p. Without
merged PHI nodes phiopt doesn't recognize adjacent MIN/MAX_EXPRs.
Certainly no other pass I schedule mergephi over cares for merged
PHIs (DCE might even be confused here).
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
Richard.
2015-05-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/66002
* passes.def: Schedule pass_merge_phi after VRP, right before
ifcombine and phiopt.
* gcc.dg/vect/vect-125.c: New testcase.
Index: gcc/passes.def
===================================================================
*** gcc/passes.def (revision 222760)
--- gcc/passes.def (working copy)
*************** along with GCC; see the file COPYING3.
*** 168,174 ****
NEXT_PASS (pass_build_alias);
NEXT_PASS (pass_return_slot);
NEXT_PASS (pass_fre);
- NEXT_PASS (pass_merge_phi);
NEXT_PASS (pass_vrp);
NEXT_PASS (pass_chkp_opt);
NEXT_PASS (pass_dce);
--- 168,173 ----
*************** along with GCC; see the file COPYING3.
*** 176,181 ****
--- 175,181 ----
NEXT_PASS (pass_call_cdce);
NEXT_PASS (pass_cselim);
NEXT_PASS (pass_copy_prop);
+ NEXT_PASS (pass_merge_phi);
NEXT_PASS (pass_tree_ifcombine);
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_tail_recursion);
Index: gcc/testsuite/gcc.dg/vect/vect-125.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-125.c (revision 0)
--- gcc/testsuite/gcc.dg/vect/vect-125.c (working copy)
***************
*** 0 ****
--- 1,19 ----
+ /* { dg-do compile } */
+ /* { dg-require-effective-target vect_int } */
+ /* { dg-require-effective-target vect_pack_trunc } */
+ /* { dg-require-effective-target vect_unpack } */
+
+ void train(short *t, short *w, int n, int err)
+ {
+ n=(n+7)&-8;
+ for (int i=0; i<n; ++i)
+ {
+ int wt=w[i]+((t[i]*err*2>>16)+1>>1);
+ if (wt<-32768) wt=-32768;
+ if (wt>32767) wt=32767;
+ w[i]=wt;
+ }
+ }
+
+ /* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail vect_no_int_max } } } */
+ /* { dg-final { cleanup-tree-dump "vect" } } */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix(?) PR66002
2015-05-04 14:18 [PATCH] Fix(?) PR66002 Richard Biener
@ 2015-05-07 9:51 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2015-05-07 9:51 UTC (permalink / raw)
To: gcc-patches
On Mon, 4 May 2015, Richard Biener wrote:
>
> This fixes a missed vectorization of a function in paq8p. Without
> merged PHI nodes phiopt doesn't recognize adjacent MIN/MAX_EXPRs.
> Certainly no other pass I schedule mergephi over cares for merged
> PHIs (DCE might even be confused here).
>
> Bootstrap and regtest running on x86_64-unknown-linux-gnu.
So after looking at the (small) fallout I decided to go with the
following instead.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2015-05-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/66002
* passes.def: Schedule another pass_merge_phi after ifcombine, right
before phiopt.
* gcc.dg/vect/vect-125.c: New testcase.
Index: gcc/testsuite/gcc.dg/vect/vect-125.c
===================================================================
*** gcc/testsuite/gcc.dg/vect/vect-125.c (revision 0)
--- gcc/testsuite/gcc.dg/vect/vect-125.c (working copy)
***************
*** 0 ****
--- 1,19 ----
+ /* { dg-do compile } */
+ /* { dg-require-effective-target vect_int } */
+ /* { dg-require-effective-target vect_pack_trunc } */
+ /* { dg-require-effective-target vect_unpack } */
+
+ void train(short *t, short *w, int n, int err)
+ {
+ n=(n+7)&-8;
+ for (int i=0; i<n; ++i)
+ {
+ int wt=w[i]+((t[i]*err*2>>16)+1>>1);
+ if (wt<-32768) wt=-32768;
+ if (wt>32767) wt=32767;
+ w[i]=wt;
+ }
+ }
+
+ /* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail vect_no_int_max } } } */
+ /* { dg-final { cleanup-tree-dump "vect" } } */
Index: gcc/passes.def
===================================================================
*** gcc/passes.def (revision 222872)
--- gcc/passes.def (working copy)
*************** along with GCC; see the file COPYING3.
*** 177,182 ****
--- 177,183 ----
NEXT_PASS (pass_cselim);
NEXT_PASS (pass_copy_prop);
NEXT_PASS (pass_tree_ifcombine);
+ NEXT_PASS (pass_merge_phi);
NEXT_PASS (pass_phiopt);
NEXT_PASS (pass_tail_recursion);
NEXT_PASS (pass_ch);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-07 9:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 14:18 [PATCH] Fix(?) PR66002 Richard Biener
2015-05-07 9:51 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).