[Bug target/53976] [SH] Unnecessary clrt/sett after bt/bf

2018-11-19 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53976

--- Comment #13 from Oleg Endo  ---
Thanks for the reminder.  The issue hasn't been fully resolved. Please leave
this PR open.  This will be helpful when getting back to the issue.

[Bug target/53976] [SH] Unnecessary clrt/sett after bt/bf

2018-11-19 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53976

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #12 from Martin Liška  ---
Can the bug be marked as resolved?

[Bug target/53976] [SH] Unnecessary clrt/sett after bt/bf

2014-11-23 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53976

--- Comment #11 from Oleg Endo  ---
Author: olegendo
Date: Sun Nov 23 21:45:18 2014
New Revision: 217989

URL: https://gcc.gnu.org/viewcvs?rev=217989&root=gcc&view=rev
Log:
gcc/
Backport from mainline
2014-11-23  Oleg Endo  

PR target/53976
* config/sh/sh_optimize_sett_clrt.cc
(sh_optimize_sett_clrt::find_last_ccreg_values): Return bool instead
of void.  Abort at complex edges.
(sh_optimize_sett_clrt::execute): Do nothing if find_last_ccreg_values
returned false.

Modified:
branches/gcc-4_9-branch/gcc/ChangeLog
branches/gcc-4_9-branch/gcc/config/sh/sh_optimize_sett_clrt.cc


[Bug target/53976] [SH] Unnecessary clrt/sett after bt/bf

2014-11-23 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53976

--- Comment #10 from Oleg Endo  ---
Author: olegendo
Date: Sun Nov 23 21:16:26 2014
New Revision: 217987

URL: https://gcc.gnu.org/viewcvs?rev=217987&root=gcc&view=rev
Log:
gcc/
PR target/53976
* config/sh/sh_optimize_sett_clrt.cc
(sh_optimize_sett_clrt::find_last_ccreg_values): Return bool instead
of void.  Abort at complex edges.
(sh_optimize_sett_clrt::execute): Do nothing if find_last_ccreg_values
returned false.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/sh/sh_optimize_sett_clrt.cc


[Bug target/53976] [SH] Unnecessary clrt/sett after bt/bf

2014-11-23 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53976

--- Comment #9 from Oleg Endo  ---
Created attachment 34078
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34078&action=edit
Reduced problem from linux kernel

This one exposes a problem of the sh_optimize_sett_clrt RTL pass, where it will
try to visit/evaluate too many basic blocks/edges and eventually run out of
memory.


[Bug target/53976] [SH] Unnecessary clrt/sett after bt/bf

2014-08-13 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53976

Oleg Endo  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2014-08-13
Summary|[SH] Unnecessary clrt after |[SH] Unnecessary clrt/sett
   |bt  |after bt/bf
 Ever confirmed|0   |1

--- Comment #8 from Oleg Endo  ---
Another case that could be handled is trying to invert comparisons so that
conditional branches from multiple basic blocks have the same T bit value.

The following code:

static const int table[] = { 0, 1, 2, 3, 4, 9, 10, 42 };

int test (int n)
{
  return *std::lower_bound (std::begin (table), std::end (table), n);
}

compiled with -m2 -ml -Os:

mov.l   .L37,r3
mov #8,r1
.L33:
cmp/pl  r1
bf.s.L36
mov r1,r7
sharr7
mov r7,r2
shll2   r2
add r3,r2
mov.l   @r2,r6
cmp/ge  r4,r6 <<<
bt  .L35  <<<
mov r2,r3
sett  <<<
add #4,r3
bra .L33
subcr7,r1
.L35:
bra .L33
mov r7,r1
.L36:
rts
mov.l   @r3,r0
.L38:
.align 2
.L37:
.long__ZN5test5L5tableE

In this case 'cmp/ge r4,r6; bt .L35' can be changed to 'cmp/gt r6,r4; bf .L35'
and the sett insn can be eliminated.