[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #12 from Jakub Jelinek  ---
Thus, Roman, can you please post your patch to gcc-patches?  Thanks.

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-18 Thread zhroma at ispras dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #13 from Roman Zhuykov  ---
(In reply to Jakub Jelinek from comment #12)
> Thus, Roman, can you please post your patch to gcc-patches?
Ok, in addition to comment 3 link, reposted it right now
https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01336.html, and ask Martin to
help with creating new regression test, since I'm not ready to setup powerpc
qemu vm at the moment.

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #9 from Martin Sebor  ---
(In reply to Jakub Jelinek from comment #5)
> a) bootstrap/regtest it

The patch passes all C, C++, and FORTRAN tests with no regressions WRT
baxeline.
I'll look at (b) next.

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #11 from Martin Sebor  ---
The following is a list of names of tests that fail in the baseline but not
with the patch:

c-c++-common/torture/pr53505.c
gcc.c-torture/execute/pr54471.c
gcc.c-torture/execute/pr61682.c
gcc.dg/vect/costmodel/ppc/costmodel-vect-outer-fir.c
gcc.dg/vect/vect-cond-6.c
gcc.dg/vect/vect-outer-fir.c
gcc.dg/vect/vect-outer-fir-lb-big-array.c
gcc.dg/vect/vect-outer-fir-lb.c
gcc.dg/vect/vect-reduc-dot-s8a.c
gfortran.dg/inline_sum_2.f90
libgomp.c/autopar-1.c
libgomp.c/autopar-2.c
libgomp.c/autopar-3.c
libgomp.c/autopar-4.c
libgomp.c/autopar-5.c
libgomp.c/autopar-6.c
libgomp.c/autopar-7.c
libgomp.c/autopar-8.c
libgomp.c/simd-5.c
libgomp.c++/simd-5.C
libgomp.c++/simd-7.C
libgomp.c++/target-2.C
libgomp.fortran/jacobi.f
libgomp.fortran/udr7.f90
tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_value.cc
tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_value.cc
tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_value.cc
tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_value.cc
tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_value.cc

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #10 from Martin Sebor  ---
(In reply to Jakub Jelinek from comment #5)
> b) try make check -jN
> RUNTESTFLAGS='--target_board=unix/fmodulo-sched/-fmodulo-sched-allow-
> regmoves/-fsched-pressure' with unpatched vs. patched, see if it doesn't
> regress any test and perhaps improves some other than this one

The patch reduces the number of failed tests.   Below, the first numeric column
is the baseline (unpatched) result and the second one is patched.

=== gcc Summary ===

# of expected passes9990999925
# of unexpected failures278  262
# of unexpected successes   20   20
# of expected failures  315  315
# of unresolved testcases   11
# of unsupported tests  2027 2027


=== gfortran Summary ===

# of expected passes4145841461
# of unexpected failures21   18
# of expected failures  89   89
# of unsupported tests  83   83


=== g++ Summary ===

# of expected passes9724697247
# of unexpected failures13   12
# of expected failures  263  263
# of unsupported tests  3799 3799


=== libgomp Summary ===

# of expected passes4596 4610
# of unexpected failures16   2
# of unresolved testcases   22
# of unsupported tests  302  302


=== libstdc++ Summary ===

# of expected passes1096010965
# of unexpected failures46   41
# of expected failures  68   68
# of unsupported tests  232  233

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #8 from Jakub Jelinek  ---
(In reply to Roman Zhuykov from comment #7)
> (In reply to Jakub Jelinek from comment #5)
> > insufficient SMS testsuite coverage.
> Not sure it's helpful, but 3 weeks ago I succesfully reg-strapped some bunch
> of my SMS patches including this fix on x86-64 and aarch64 using trunk
> 20151222. fmodulo-sched and fmodulo-sched-allow-regmoves options were
> enabled by default,  fsched-pressure left untouched. No new regressions,
> excluding some scan-assembler-times failures because of loop versioning.
> Maybe later on stage1 I'll send all my stuff to gcc-patches.

Please do, if the patches aren't posted, others can't benefit from them.

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #5 from Jakub Jelinek  ---
(In reply to Martin Sebor from comment #4)
> Thanks for your help!  I can confirm that the first patch fixes the problem
> in the test cases on powerpc64le.  (I haven't done any other testing with
> it.)

Martin, do you think you could
a) bootstrap/regtest it
b) try make check -jN
RUNTESTFLAGS='--target_board=unix/fmodulo-sched/-fmodulo-sched-allow-regmoves/-fsched-pressure'
with unpatched vs. patched, see if it doesn't regress any test and perhaps
improves some other than this one
c) maybe try even bootstrap/regtest with both unpatched/patched compiler
changed to use these 3 options by default and see if we don't regress there?
Because a) is probably very insufficient testing here, given the insufficient
SMS testsuite coverage.

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-14 Thread zhroma at ispras dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #7 from Roman Zhuykov  ---
(In reply to Jakub Jelinek from comment #5)
> insufficient SMS testsuite coverage.
Not sure it's helpful, but 3 weeks ago I succesfully reg-strapped some bunch of
my SMS patches including this fix on x86-64 and aarch64 using trunk 20151222.
fmodulo-sched and fmodulo-sched-allow-regmoves options were enabled by default,
 fsched-pressure left untouched. No new regressions, excluding some
scan-assembler-times failures because of loop versioning. Maybe later on stage1
I'll send all my stuff to gcc-patches.

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #6 from Martin Sebor  ---
(In reply to Jakub Jelinek from comment #5)

Sure, I was already planning to do some of it today.

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-13 Thread zhroma at ispras dot ru
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #3 from Roman Zhuykov  ---
I'll try to help. While working with expanding SMS functionality 4-5 years ago
(https://gcc.gnu.org/ml/gcc-patches/2011-07/msg01807.html), I create several
fixes not connected to my main non-doloop-support patch. Unfortunately only two
of that fixes were approved and only one fix was committed.

Could you try this patch first of all:
https://gcc.gnu.org/ml/gcc-patches/2011-12/msg01800.html
This patch suits current trunk.

There are links to other fixes, I can provide newer versions for trunk if
needed.
https://gcc.gnu.org/ml/gcc-patches/2011-09/msg02049.html
https://gcc.gnu.org/ml/gcc-patches/2011-07/msg01804.html
https://gcc.gnu.org/ml/gcc-patches/2011-12/msg00505.html
https://gcc.gnu.org/ml/gcc-patches/2011-12/msg00506.html

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-13 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #4 from Martin Sebor  ---
Thanks for your help!  I can confirm that the first patch fixes the problem in
the test cases on powerpc64le.  (I haven't done any other testing with it.)

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

--- Comment #2 from Jakub Jelinek  ---
Looks like a SMS pass bug.
In the original loop there is a a[i] memory load followed by addition of i to
that, for understandable reasons SMS wants to move the load as far as possible
from the addition, so it is done in another iteration.
For that purpose, schedule_reg_moves adds:
756   move->insn = gen_move_insn (move->new_reg, copy_rtx
(prev_reg));
(insn 64 38 37 4 (set (reg:DI 197)
(reg:DI 181 [ ivtmp.5 ])) 444 {*movdi_internal64}
 (nil))
But, when emitting the prologue before the loop (unrolled two iterations, where
the first one does just the memory load and stuff before that and the second
one does the stuff from before the memory load from second iteration, then the
addition from first iteration and finally memory load from second iteration),
it emits a copy of insn 64 only in the second iteration (after the addition,
which is fine), but not in the first iteration.
Thus we end up with:
li 9,0
ld 5,.LC2@toc(2)
li 10,24
mtctr 10
sldi 6,9,2
lwzx 10,5,6
addi 9,9,1
sldi 6,9,2
add 7,10,8
mr 8,9
lwzx 10,5,6
add 3,7,3
addi 9,9,1
extsw 3,3
where another mr 8,9 instruction is missing from somewhere after li 9,0 until
before addi 9,9,1 instruction.
Do we have any SMS scheduling expert around?

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

Martin Sebor  changed:

   What|Removed |Added

 Target|powerpc64-unknown-linux-gnu |powerpc64*-unknown-linux-gn
   ||u
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-01-13
 CC||msebor at gcc dot gnu.org
   Host|x86_64-pc-linux-gnu |
 Ever confirmed|0   |1

--- Comment #1 from Martin Sebor  ---
Confirmed with today's top of trunk (6.0.0 20160113) also on powerpc764le with
-O1 and -Os.  

Using a slightly simplified test case

  int a[N] = { 0, 2, 4, 8 };

  __attribute__ ((noinline, noclone)) int main1 (void)
  {
int s = 0;
int i;
for (i = 0; i != sizeof a / sizeof *a; i++)
  s += i + a[i];
return s;
  }

and looking at the tree dumps, the first one that looks suspicious (with -O1)
is:

$ cat t.c.152t.ivopts

;; Function main1 (main1, funcdef_no=0, decl_uid=2350, cgraph_uid=0,
symbol_order=1)

__attribute__((noclone, noinline))
main1 ()
{
  unsigned long ivtmp.10;
  int i;
  int s;
  int _4;
  int _5;
  int * _14;
  void * _15;

  :
  _14 =  + 18446744073709551612;
  ivtmp.10_13 = (unsigned long) _14;

  :
  # s_10 = PHI 
  # i_12 = PHI 
  # ivtmp.10_9 = PHI 
  ivtmp.10_8 = ivtmp.10_9 + 4;
  _15 = (void *) ivtmp.10_8;
  _4 = MEM[base: _15, offset: 0B];
  _5 = _4 + i_12;
  s_6 = _5 + s_10;
  i_7 = i_12 + 1;
  if (i_7 != 4)
goto ;
  else
goto ;

  :
  goto ;

  :
  # s_11 = PHI 
  return s_11;
}

[Bug target/69252] [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure

2016-01-12 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |4.9.4