[Bug target/65250] [SH] Improve comparisons followed by a negated cstore

2023-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65250

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED
   Target Milestone|--- |8.0

--- Comment #3 from Andrew Pinski  ---
Fixed for GCC by r8-2701-g9dc3d6a96167b4c84824be5e472fba4956297033 .

Basically the gimple level is able to optimize that directly to:
  _1 = (unsigned int) value_3(D);
  _5 = _1 <= 2;

No reason to try to have combine optimize it any more.

[Bug target/65250] [SH] Improve comparisons followed by a negated cstore

2023-10-21 Thread olegendo at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65250

--- Comment #2 from Oleg Endo  ---
Briefly checked this one on GCC-13.  It generates the optimal sequence.

[Bug target/65250] [SH] Improve comparisons followed by a negated cstore

2015-09-05 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65250

--- Comment #1 from Oleg Endo  ---
The patch attachment 36012 for PR 54236 improves the treg_set_expr machinery by
doing proper comparison inversion, instead of trying only EQ <-> NE.  This will
be the prerequisite to match a

(set (reg:SI 168)
 (leu:SI (reg:SI 4 r4 [ value ])
 (const_int 2 [0x2])))

with a treg_set_expr.

As for the multiple-set negc movrt insn, it's probably better to get rid of
that altogether.  Its main purpose is to indicate that the T reg is clobbered
by the negc and to get a little bit of constant sharing of the -1 constant.  If
constant optimization is done after split1, this will be not necessary anymore.
 In some cases, a sett insn after a negc with constant -1 can be optimized
away.  To keep this, a negc insn that initially clobbers the T reg should be
converted to the full multiple-set negc insn "negc" after combine/split1.  Then
the clrt_sett optimization pass (PR 53976) should be extended to understand
addc, subc and negc insns which involve constants, to figure out whether a clrt
or sett is really needed.  Before that PR 67459 needs to be fixed.