Message ID | 3cc535f1d146348d5578fed0aa70c861592a59d1.1487685472.git.segher@kernel.crashing.org |
---|---|
State | New |
Headers | show |
On Tue, 2017-02-21 at 14:48 +0000, Segher Boessenkool wrote: > 2017-02-21 Segher Boessenkool <segher@kernel.crashing.org> > > * config/sh/sh.md (tstsi_t): If operands[0] is a SUBREG instead of > a REG, look at the REG it is a SUBREG of. > (splitter for cmpeqsi_t): Ditto. > > --- > gcc/config/sh/sh.md | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md > index 2645fca..e19e977 100644 > --- a/gcc/config/sh/sh.md > +++ b/gcc/config/sh/sh.md > @@ -561,8 +561,12 @@ (define_insn_and_split "tstsi_t" > gcc_assert (CONST_INT_P (operands[1])); > > HOST_WIDE_INT op1val = INTVAL (operands[1]); > + rtx reg = operands[0]; > + if (SUBREG_P (reg)) > + reg = SUBREG_REG (reg); > + gcc_assert (REG_P (reg)); > bool op0_dead_after_this = > - sh_reg_dead_or_unused_after_insn (curr_insn, REGNO > (operands[0])); > + sh_reg_dead_or_unused_after_insn (curr_insn, REGNO (reg)); > Thanks for dealing with those. That SUBREG vs. REG stuff is annoying. Isn't there a simple function that just does the right thing which can be used instead of manually open-coding these checks over and over again? Cheers, Oleg
On Wed, Feb 22, 2017 at 12:16:43AM +0900, Oleg Endo wrote: > That SUBREG vs. REG stuff is annoying. Isn't there a simple function > that just does the right thing which can be used instead of manually > open-coding these checks over and over again? There is reg_or_subregno, which would even work here :-) Segher
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 2645fca..e19e977 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -561,8 +561,12 @@ (define_insn_and_split "tstsi_t" gcc_assert (CONST_INT_P (operands[1])); HOST_WIDE_INT op1val = INTVAL (operands[1]); + rtx reg = operands[0]; + if (SUBREG_P (reg)) + reg = SUBREG_REG (reg); + gcc_assert (REG_P (reg)); bool op0_dead_after_this = - sh_reg_dead_or_unused_after_insn (curr_insn, REGNO (operands[0])); + sh_reg_dead_or_unused_after_insn (curr_insn, REGNO (reg)); if (optimize) { @@ -834,7 +838,11 @@ (define_split /* If the tested reg is not dead after this insn, it's probably used by something else after the comparison. It's probably better to leave it as it is. */ - if (find_regno_note (curr_insn, REG_DEAD, REGNO (operands[0])) == NULL_RTX) + rtx reg = operands[0]; + if (SUBREG_P (reg)) + reg = SUBREG_REG (reg); + gcc_assert (REG_P (reg)); + if (find_regno_note (curr_insn, REG_DEAD, REGNO (reg)) != NULL_RTX) FAIL; /* FIXME: Maybe also search the predecessor basic blocks to catch