Bug 66877

Summary: [6 Regression] FAIL: gcc.dg/vect/vect-over-widen-3-big-array.c -flto -ffat-lto-objects scan-tree-dump-times vect "vect_recog_over_widening_pattern: detected" 2
Product: gcc Reporter: ktkachov
Component: middle-endAssignee: Alan Lawrence <alan.lawrence.arm>
Status: RESOLVED FIXED    
Severity: normal CC: nickc, rguenther
Priority: P3 Keywords: missed-optimization
Version: 6.0   
Target Milestone: 6.0   
Host: Target: arm-none-eabi
Build: Known to work: 5.2.0
Known to fail: 6.0 Last reconfirmed: 2015-07-15 00:00:00
Attachments: Vectorizer dump

Description ktkachov 2015-07-15 11:01:13 UTC
After https://gcc.gnu.org/ml/gcc-patches/2015-07/msg00743.html
I see this test fail on arm targets.

Changing the scan-tree-dump-times to scan for only one occurrence makes the test pass
Comment 1 Richard Biener 2015-07-15 11:03:14 UTC
I will have a look.
Comment 2 Richard Biener 2015-12-17 12:43:28 UTC
Hmm, with a cross to arm-none-eabi and -O2 -ftree-vectorize I see

grep 'vect_recog_over_widening_pattern: detected' t.c.146t.vect
t.c:14:3: note: vect_recog_over_widening_pattern: detected: _130 = (signed short) patt_131;
t.c:14:3: note: vect_recog_over_widening_pattern: detected: patt_128 = _129 << 3;
t.c:14:3: note: vect_recog_over_widening_pattern: detected: _126 = (signed short) patt_127;
t.c:14:3: note: vect_recog_over_widening_pattern: detected: patt_124 = _125 << 3;

any other configury / option besides that required?  Yes, 4 is also not 2,
the other two are from

t.c:14:3: note: ***** Re-trying analysis with vector size 8

and it doesn't vectorize at all because it doesnt' support unaligned loads.

Please provide more information to reproduce with a cross or attach the vectorizer dump.
Comment 3 Nick Clifton 2016-01-18 17:27:56 UTC
Created attachment 37387 [details]
Vectorizer dump

Hi Richard,

  Here is a dump from a failing testcase.  This was from a toolchain configured as --target=arm-eabi built using today's FSF mainline sources.

Cheers
  Nick
Comment 4 Richard Biener 2016-01-19 14:41:18 UTC
For some reason you get widening shifts recognized while I get them not supported by the HW (with the cross at -O2 -ftree-vectorize).  -mfpu=neon doesn't help.

I still can't reproduce your dump file with

/space/rguenther/src/svn/trunk3/configure --target=arm-none-eabi
gcc> /cc1 -quiet t.c -O2 -ftree-vectorize -fdump-tree-vect-details -fno-vect-cost-model -fno-common -mfpu=neon -march=armv7-a

please advise further.

Also you might want to try if guarding the check with { target ! vect_widen_shift } and adding a variant for vect_widen_shift to scan for 1 occurence fixes the
testcase.  That would make sense to me.
Comment 5 ktkachov 2016-01-19 14:45:04 UTC
(In reply to Richard Biener from comment #4)
> For some reason you get widening shifts recognized while I get them not
> supported by the HW (with the cross at -O2 -ftree-vectorize).  -mfpu=neon
> doesn't help.
> 
> I still can't reproduce your dump file with
> 
> /space/rguenther/src/svn/trunk3/configure --target=arm-none-eabi
> gcc> /cc1 -quiet t.c -O2 -ftree-vectorize -fdump-tree-vect-details
> -fno-vect-cost-model -fno-common -mfpu=neon -march=armv7-a
> 

Can you try adding -mfloat-abi=hard to the command line?
Comment 6 rguenther@suse.de 2016-01-19 15:10:29 UTC
On Tue, 19 Jan 2016, ktkachov at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66877
> 
> --- Comment #5 from ktkachov at gcc dot gnu.org ---
> (In reply to Richard Biener from comment #4)
> > For some reason you get widening shifts recognized while I get them not
> > supported by the HW (with the cross at -O2 -ftree-vectorize).  -mfpu=neon
> > doesn't help.
> > 
> > I still can't reproduce your dump file with
> > 
> > /space/rguenther/src/svn/trunk3/configure --target=arm-none-eabi
> > gcc> /cc1 -quiet t.c -O2 -ftree-vectorize -fdump-tree-vect-details
> > -fno-vect-cost-model -fno-common -mfpu=neon -march=armv7-a
> > 
> 
> Can you try adding -mfloat-abi=hard to the command line?

Thanks, that way it works.  Just figured I can't test if
the suggested testsuite addition works though.
Comment 7 Alan Lawrence 2016-01-22 10:53:07 UTC
I can test on ARM ;), so taken - https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01727.html.
Comment 8 Alan Lawrence 2016-02-23 16:23:51 UTC
Fix committed r232720.