[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-12 Thread ro at CeBiTec dot Uni-Bielefeld.DE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

--- Comment #9 from ro at CeBiTec dot Uni-Bielefeld.DE ro at CeBiTec dot 
Uni-Bielefeld.DE ---
 --- Comment #8 from Eric Botcazou ebotcazou at gcc dot gnu.org ---
 I think that's easiest for Eric to say.

 Not really, I guess you want to debug the function and replay the computation
 since the cost is synthetized and doesn't come directly from the back-end.

I've found what's going on:

* In expmed.c (init_expmed_one_mode), l.194

  set_shiftadd_cost (speed, mode, m, set_src_cost (all-shift_add, speed));

  with all-shift_add something like

(plus:QI (mult:QI (reg:QI 109 [0])
(const_int 8 [0x8]))
(reg:QI 109 [0]))

* For the mult part, rtx_code calls sparc_rtx_cost, which has

case MULT:
  if (float_mode_p)
*total = sparc_costs-float_mul;
  else if (! TARGET_HARD_MUL)
*total = COSTS_N_INSNS (25);

  On SPARCv9/-m64, TARGET_HARD_MUL is false, so we get the 25*4 = 100 part,
  unlike v8, which explains why the test only fails for 64-bit.

Rainer


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-11 Thread ro at CeBiTec dot Uni-Bielefeld.DE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

--- Comment #7 from ro at CeBiTec dot Uni-Bielefeld.DE ro at CeBiTec dot 
Uni-Bielefeld.DE ---
 --- Comment #6 from amker at gcc dot gnu.org ---
 (In reply to Rainer Orth from comment #0)
 The new gcc.dg/tree-ssa/ivopts-lt-2.c test FAILs on 64-bit SPARC (only;
 32-bit is
 ok):
 
 FAIL: gcc.dg/tree-ssa/ivopts-lt-2.c scan-tree-dump-times ivopts PHI 1
 FAIL: gcc.dg/tree-ssa/ivopts-lt-2.c scan-tree-dump-times ivopts p_[0-9]* 
 1
 
 I'm attaching the ivopts dump.
[...]
 According to https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00345.html, could
 you have a look whether the huge cost returned on sparc64 is as expected?

I think that's easiest for Eric to say.

Rainer


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-11 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

Eric Botcazou ebotcazou at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-09-11
 Ever confirmed|0   |1

--- Comment #8 from Eric Botcazou ebotcazou at gcc dot gnu.org ---
 I think that's easiest for Eric to say.

Not really, I guess you want to debug the function and replay the computation
since the cost is synthetized and doesn't come directly from the back-end.


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-10 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

amker at gcc dot gnu.org changed:

   What|Removed |Added

 CC||amker at gcc dot gnu.org

--- Comment #6 from amker at gcc dot gnu.org ---
(In reply to Rainer Orth from comment #0)
 The new gcc.dg/tree-ssa/ivopts-lt-2.c test FAILs on 64-bit SPARC (only;
 32-bit is
 ok):
 
 FAIL: gcc.dg/tree-ssa/ivopts-lt-2.c scan-tree-dump-times ivopts PHI 1
 FAIL: gcc.dg/tree-ssa/ivopts-lt-2.c scan-tree-dump-times ivopts p_[0-9]* 
 1
 
 I'm attaching the ivopts dump.
 
   Rainer

Hi,
According to https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00345.html, could
you have a look whether the huge cost returned on sparc64 is as expected?

Thanks very much.


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-07 Thread danglin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

John David Anglin danglin at gcc dot gnu.org changed:

   What|Removed |Added

 CC||danglin at gcc dot gnu.org

--- Comment #5 from John David Anglin danglin at gcc dot gnu.org ---
Also seen on 32-bit hppa*-*-*.  64-bit is OK.


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-02 Thread amker.cheng at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

--- Comment #4 from bin.cheng amker.cheng at gmail dot com ---
Hi Rainer,
This is caused by abnormal huge cost of function call `shiftadd_cost (true,
DImode, 2)'.  It returns 100+ cost, resulting in huge cost when representing
use 1 with cand 4:

use 1
  compare
  in statement if (i_12 = 99)

  at position 
  type unsigned int
  base i_4(D) + 1
  step 1
  is a biv
  related candidates 

  i_4(D) is invariant (2), eliminable
  p_8 is invariant (1), eliminable

candidate 4 (important)
  original biv
  type int *
  base p_8
  step 4
  base object (void *) p_8

Use 1:
  candcostcompl.depends on
  040 inv_expr:0
  140
  4230 inv_expr:1   --huge cost.
  500
  600
  841

I worked out a patch fixing this from ivopt.  Because I am not firmiliar with
sparc ISA, could you please help me confirm that below fixed assembly is better
than the original version?

The orignal assembly:
f1:
sllx%o1, 2, %g1
add%o0, %g1, %o0
.LL2:
st%g0, [%o0]
add%o1, 1, %g1
add%o0, 4, %o0
cmp%g1, 99
bleu,pt%icc, .LL2
 srl%g1, 0, %o1
jmp%o7+8
 nop
.sizef1, .-f1

The fixed version assembly:
f1:
.register%g2, #scratch
sllx%o1, 2, %g1
mov99, %g2
add%o0, %g1, %o0
sub%g2, %o1, %o1
srl%o1, 0, %g1
add%g1, 1, %g1
sllx%g1, 2, %g1
add%o0, %g1, %g1
st%g0, [%o0]
.LL5:
add%o0, 4, %o0
cmp%o0, %g1
blu,a,pt %xcc, .LL5
 st%g0, [%o0]
jmp%o7+8
 nop
.sizef1, .-f1

Though it has larger loop setup code, the loop itself is simplified.

If yes, I will send out the patch for review.

Thanks,
bin


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-01 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

Rainer Orth ro at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|--- |5.0


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-01 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

--- Comment #1 from Rainer Orth ro at gcc dot gnu.org ---
Created attachment 33427
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33427action=edit
ivopts dump


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-01 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

--- Comment #2 from Rainer Orth ro at gcc dot gnu.org ---
Created attachment 33428
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33428action=edit
slp dump


[Bug tree-optimization/62631] gcc.dg/tree-ssa/ivopts-lt-2.c FAILs

2014-09-01 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62631

--- Comment #3 from Rainer Orth ro at gcc dot gnu.org ---
Created attachment 33429
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33429action=edit
bb-slp-26.c.120t.slp1 dump