[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-03-27 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #20 from Jeffrey A. Law  ---
Author: law
Date: Wed Mar 27 16:18:06 2019
New Revision: 269967

URL: https://gcc.gnu.org/viewcvs?rev=269967=gcc=rev
Log:
PR rtl-optimization/87761
PR rtl-optimization/89826
* regcprop.c (copyprop_hardreg_forward_1): Move may_trap_p test
slightly later.
(pass_cprop_hardreg::execute): Call df_analyze after adding the
note problem to get REG_DEAD/REG_UNUSED notes updated.

PR rtl-optimization/87761
PR rtl-optimization/89826
* gcc.c-torture/execute/pr89826.c: New test.

Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr89826.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/regcprop.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-03-24 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

Jeffrey A. Law  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #19 from Jeffrey A. Law  ---
Fixed by various changes on the trunk.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-03-24 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #18 from Jeffrey A. Law  ---
Author: law
Date: Sun Mar 24 15:20:52 2019
New Revision: 269896

URL: https://gcc.gnu.org/viewcvs?rev=269896=gcc=rev
Log:
PR rtl-optimization/87761
* regcprop.c (copyprop_hardreg_forward_1): Check may_trap_p on SET,
not INSN.  Also check RTX_FRAME_RELATED_P.  Queue insns for DF rescan
as needed.
(pass_cprop_hardreg::execute): Add df note problem and defer insn
rescans.  Reprocess blocks as needed, calling df_analyze before
reprocessing.  Always call df_analyze before fixing up debug bind
insns.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/regcprop.c

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-03-22 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #17 from Jeffrey A. Law  ---
Author: law
Date: Fri Mar 22 18:14:56 2019
New Revision: 269880

URL: https://gcc.gnu.org/viewcvs?rev=269880=gcc=rev
Log:
PR rtl-optimization/87761
* config/mips/mips-protos.h (mips_split_move): Add new argument.
(mips_emit_move_or_split): Pass NULL for INSN into mips_split_move.
(mips_split_move): Accept new INSN argument.  Try to forward SRC
into the next instruction.
(mips_split_move_insn): Pass INSN through to mips_split_move.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/mips/mips-protos.h
trunk/gcc/config/mips/mips.c

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-03-14 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #16 from Jeffrey A. Law  ---
Yea, just not enough time to push through the regression I've seen.

At this point addressing fix-r4000-10.c looks like getting the DF/REG_NOTES
consistent within the regcprop pass.  Once that's in place we just need to
iterate on a subset of blocks within regcprop and all the right things just
happen.  My schedule starts to open up next week and I expect to wrap this part
of the BZ up then.

Note there is still the fpr-moves-5 regression in this BZ that I haven't looked
at  yet.  So even once fix-r4000-10.c is resolved we can't close this BZ.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-03-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #15 from Martin Liška  ---
Any progress on that Jeff?

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-26 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #14 from Jeffrey A. Law  ---
Author: law
Date: Tue Feb 26 17:08:06 2019
New Revision: 269218

URL: https://gcc.gnu.org/viewcvs?rev=269218=gcc=rev
Log:
PR rtl-optimization/87761
* regcprop.c (copyprop_hardreg_forward_1): Use REG_UNUSED notes to
detect obviously dead insns and delete them.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/regcprop.c

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-22 Thread law at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #13 from Jeffrey A. Law  ---
Author: law
Date: Fri Feb 22 16:38:43 2019
New Revision: 269123

URL: https://gcc.gnu.org/viewcvs?rev=269123=gcc=rev
Log:
PR rtl-optimization/87761
* config/mips/mips.md: Add new combiner pattern to recognize
a bitfield extraction using (ashiftrt (truncate (ashift (....

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/mips/mips.md

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-18 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #12 from Jeffrey A. Law  ---
octeon-exts-3 can be fixed with a relatively simple pattern in mips.md or with
a bit of code in combine.c.

fix-r4000-10.c is more interesting.  Hard register propagation does its thing
and exposes a bit of dead code.  Removing that dead code in turn exposes
additional hard register propagation opportunities, which then exposes more
dead code.  But running those passes in their entirety seems horribly
heavyweight for this issue.  Particularly since the test goes out of its way to
disable lower-subreg.

We had another BZ in this cycle where post-reload splitting exposed dead code. 
So we might be able to make a case for RTL DCE after splitting (or have some
gross mips.md patterns to avoid the dead code).  That would help some.  But to
really fix this hard register cprop would have to discover at least the trivial
cases where its actions expose dead code, remove the dead code and reprocess
the block.  I'm still not sure how wise such hacks to hard register cprop would
be.

I haven't dug into fpr-moves-5.c yet.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-18 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #11 from Jeffrey A. Law  ---
Note configuring for mips-linux will show the octeon-exts failures.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-18 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

Jeffrey A. Law  changed:

   What|Removed |Added

 CC||law at redhat dot com

--- Comment #10 from Jeffrey A. Law  ---
So fix-r4000-10.c is the only one that's still failing for me on the trunk.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-13 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #9 from Segher Boessenkool  ---
It looks more like the kind of thing that combine make_extraction,
make_compound_operation, expand_compound_operation comes up with.
This is not a new problem.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #8 from Jakub Jelinek  ---
(In reply to Segher Boessenkool from comment #7)
> truncate:SI of ashift:DI looks wrong already; I'd expect ashift:SI of a
> subreg?

But then it would be a simplify-rtx.c issue.  Though, not sure if it isn't too
late to change simplify-rtx.c to simplify that differently now.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-13 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #7 from Segher Boessenkool  ---
truncate:SI of ashift:DI looks wrong already; I'd expect ashift:SI of a subreg?

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-13 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-02-13
 CC||rts at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #6 from Jakub Jelinek  ---
I guess the backend needs to help combiner here, e.g. for octeon-exts-3.c
before the combiner change on
(insn 2 4 3 2 (set (reg/v:DI 196 [ i+-4 ])
(reg:DI 4 $4 [ i+-4 ])) "octeon-exts-3.c":34:1 312 {*movdi_64bit}
 (expr_list:REG_DEAD (reg:DI 4 $4 [ i+-4 ])
(nil)))
(insn 6 3 7 2 (set (reg:SI 198)
(ashift:SI (subreg/s/u:SI (reg/v:DI 196 [ i+-4 ]) 4)
(const_int 4 [0x4]))) "octeon-exts-3.c":35:13 444 {*ashlsi3}
 (expr_list:REG_DEAD (reg/v:DI 196 [ i+-4 ])
(nil)))
(insn 7 6 13 2 (set (reg:SI 197)
(ashiftrt:SI (reg:SI 198)
(const_int 24 [0x18]))) "octeon-exts-3.c":35:19 445 {*ashrsi3}
 (expr_list:REG_DEAD (reg:SI 198)
(nil)))
(insn 13 7 14 2 (set (reg/i:DI 2 $2)
(sign_extend:DI (reg:SI 197))) "octeon-exts-3.c":36:1 236 {extendsidi2}
 (expr_list:REG_DEAD (reg:SI 197)
(nil)))
there was:
Trying 2 -> 6:
Successfully matched this instruction:
(set (reg:SI 199 [ D.1424 ])
(ashift:SI (reg:SI 4 $4 [ i ])
(const_int 4 [0x4])))
Trying 6 -> 7:
Successfully matched this instruction:
(set (reg:SI 198 [ D.1424 ])
(sign_extract:SI (reg:SI 4 $4 [ i ])
(const_int 8 [0x8])
(const_int 20 [0x14])))
but after the combiner change the hard regs aren't propagated into the
instructions anymore, so we end up with:
Trying 2 -> 6:
Successfully matched this instruction:
(set (reg:SI 198)
(ashift:SI (subreg:SI (reg:DI 200) 4)
(const_int 4 [0x4])))
Trying 6 -> 7:
Failed to match this instruction:
(set (reg:SI 197)
(ashiftrt:SI (truncate:SI (ashift:DI (reg:DI 200)
(const_int 4 [0x4])))
(const_int 24 [0x18])))
So, I'd say adding define_insn_and_split which would handle the above pattern
from the failed match, i.e. ashiftrt with truncate of ashift and split it into
a sign_extract of the lowpart subreg, then it would succeed again.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-11 Thread paul.hua.gm at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #5 from Paul Hua  ---
(In reply to Jakub Jelinek from comment #4)
> Can you please recheck with current trunk, many RA improvements related to
> r265398 change went into trunk since then.

all those test still fails on trunk.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2019-02-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
Can you please recheck with current trunk, many RA improvements related to
r265398 change went into trunk since then.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2018-12-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

Richard Biener  changed:

   What|Removed |Added

   Keywords||ra
   Priority|P3  |P1

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2018-10-26 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #3 from Segher Boessenkool  ---
All of those look like register allocation problems, except perhaps that
last one.

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2018-10-26 Thread paul.hua.gm at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #2 from Paul Hua  ---
and and new fails:
  716 FAIL: gcc.target/mips/octeon-exts-3.c   -O2   scan-assembler-times
\\texts\\t 3
  717 FAIL: gcc.target/mips/octeon-exts-3.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none   scan-assembler-times \\texts\\t 3
  718 FAIL: gcc.target/mips/octeon-exts-3.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects   scan-assembler-times \\texts\\t 3
  719 FAIL: gcc.target/mips/octeon-exts-3.c   -O3 -g   scan-assembler-times
\\texts\\t 3
  720 FAIL: gcc.target/mips/octeon-exts-3.c   -Os   scan-assembler-times
\\texts\\t 3 

$cat octeon-exts-3.i

# 1
"/home/xuchenghua/GCC/gcc_git_trunk/gcc/testsuite/gcc.target/mips/octeon-exts-3.c"
# 1 ""
# 1 ""
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "" 2
# 1
"/home/xuchenghua/GCC/gcc_git_trunk/gcc/testsuite/gcc.target/mips/octeon-exts-3.c"

struct foo
{
  unsigned long long a:10;
  unsigned long long b:32;
  unsigned long long c:22;
};

__attribute__((nomips16)) unsigned
f (struct foo s)
{
  return s.b;
}

struct bar
{
  unsigned long long a:15;
  unsigned long long b:48;
  unsigned long long c:1;
};

__attribute__((nomips16)) int
g (struct bar s)
{
  return (int) s.b;
}

__attribute__((nomips16)) int
h (int i)
{
  return (i << 4) >> 24;
}


./gcc/cc1 -fpreprocessed octeon-exts-3.i -mel -quiet -dumpbase octeon-exts-3.c
-march=octeon -mgp64 -mno-micromips -mabi=64 -mllsc -mips64r2 -mno-shared
-auxbase-strip octeon-exts-3.s -O2 -version -fdiagnostics-color=never
-fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-ffat-lto-objects -fno-ident -o octeon-exts-3.s -mno-abicalls

good :

h:
.frame  $sp,0,$31   # vars= 0, regs= 0/0, args= 0, gp= 0
.mask   0x,0
.fmask  0x,0
.setnoreorder
.setnomacro
jr  $31
exts$2,$4,20,7
.setmacro
.setreorder

bad:

h:
.frame  $sp,0,$31   # vars= 0, regs= 0/0, args= 0, gp= 0
.mask   0x,0
.fmask  0x,0
sll $2,$4,4
.setnoreorder
.setnomacro
jr  $31
sra $2,$2,24
.setmacro
.setreorder

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2018-10-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

Richard Biener  changed:

   What|Removed |Added

   Keywords||missed-optimization
   Target Milestone|--- |9.0

[Bug rtl-optimization/87761] [9 regression][MIPS] New FAIL: gcc.target/mips/fix-r4000-10.c -O1 start with r265398

2018-10-26 Thread paul.hua.gm at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87761

--- Comment #1 from Paul Hua  ---
and other new fails:

  681 FAIL: gcc.target/mips/fpr-moves-5.c   -O1   scan-assembler
\\tsdc1\\t\$f12,0(\$6)\\n   
  682 FAIL: gcc.target/mips/fpr-moves-5.c   -O1   scan-assembler
\\tsdc1\\t\$f13,8(\$6)\\n   
  683 FAIL: gcc.target/mips/fpr-moves-5.c   -O2   scan-assembler
\\tsdc1\\t\$f12,0(\$6)\\n   
  684 FAIL: gcc.target/mips/fpr-moves-5.c   -O2   scan-assembler
\\tsdc1\\t\$f13,8(\$6)\\n   
  685 FAIL: gcc.target/mips/fpr-moves-5.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none   scan-assembler \\tsdc1\\t\$f12,0(\$6)\\n 
  686 FAIL: gcc.target/mips/fpr-moves-5.c   -O2 -flto -fno-use-linker-plugin
-flto-partition=none   scan-assembler \\tsdc1\\t\$f13,8(\$6)\\n 
  687 FAIL: gcc.target/mips/fpr-moves-5.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects   scan-assembler \\tsdc1\\t\$f12,0(\$6)\\n 
  688 FAIL: gcc.target/mips/fpr-moves-5.c   -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects   scan-assembler \\tsdc1\\t\$f13,8(\$6)\\n 
  689 FAIL: gcc.target/mips/fpr-moves-5.c   -O3 -g   scan-assembler
\\tsdc1\\t\$f12,0(\$6)\\n   
  690 FAIL: gcc.target/mips/fpr-moves-5.c   -O3 -g   scan-assembler
\\tsdc1\\t\$f13,8(\$6)\\n   
  691 FAIL: gcc.target/mips/fpr-moves-5.c   -Os   scan-assembler
\\tsdc1\\t\$f12,0(\$6)\\n   
  692 FAIL: gcc.target/mips/fpr-moves-5.c   -Os   scan-assembler
\\tsdc1\\t\$f13,8(\$6)\\n   


$ cat fpr-moves-5.i

# 1
"/home/xuchenghua/GCC/gcc_git_trunk/gcc/testsuite/gcc.target/mips/fpr-moves-5.c"
# 1 ""
# 1 ""
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "" 2
# 1
"/home/xuchenghua/GCC/gcc_git_trunk/gcc/testsuite/gcc.target/mips/fpr-moves-5.c"




__attribute__((nomips16)) void
foo (long double d, long double *x)
{
  *x = d;
}

__attribute__((nomips16)) long double
bar (long double d, long double *x)
{
  register long double l1 asm ("$8") = d;
  register long double l2 asm ("$10") = x[1];
  register long double l3 asm ("$f20") = 0.0;
  asm ("#foo" : "=d" (l1) : "d" (l1));
  asm ("#foo" : "=d" (l2) : "d" (l2));
  asm volatile ("#foo" :: "f" (l3));
  x[1] = l1;
  return l2;
}

$./cc1 -fpreprocessed fpr-moves-5.i -mel -quiet -dumpbase fpr-moves-5.c
-mabi=64 -mhard-float -mgp64 -mlong64 -march=mips64r2 -mllsc -mips64r2
-mno-shared -auxbase-strip fpr-moves-5.s -O1 -version -fdiagnostics-color=never
-fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers
-ffat-lto-objects -fno-ident -o fpr-moves-5.s


good asm:

foo:
.frame  $sp,0,$31   # vars= 0, regs= 0/0, args= 0, gp= 0
.mask   0x,0
.fmask  0x,0
.setnoreorder
.setnomacro
sdc1$f12,0($6)
jr  $31
sdc1$f13,8($6)

bad asm:

foo:
.frame  $sp,0,$31   # vars= 0, regs= 0/0, args= 0, gp= 0
.mask   0x,0
.fmask  0x,0
.setnoreorder
.setnomacro
dmfc1   $2,$f12
dmfc1   $3,$f13
sd  $2,0($6)
jr  $31
sd  $3,8($6)