https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63783

--- Comment #20 from Michael Karcher <gcc-bugzilla at mkarcher dot 
dialup.fu-berlin.de> ---
(In reply to Oleg Endo from comment #19)
> > The or-then-SImode-compare optimization has an adverse effect on the test
> > coverage, it seems. In both cases, GET_MODE(src_reg) and GET_MODE(dst_reg)
> > are SImode, so the DImode output branch is not tested by any of your two
> > example source files.
> That is true as it stands now.  However, we already anticipate that there
> might be something going on with DImode stuff, so just adding the test might
> help debugging in the future.  Even if it doesn't add any value now, it
> doesn't hurt anyone either.

The test case is not a problem - but it would be helpful to have a testcase
that actually tests the DImode output case. I understand that it likely is not
possible with today's gcc to reach that branch, so it seems this has to stay
the way it is now. I am fine with it.

> > Furthermore, it looks like make_not_reg_insn will
> > actually produce bad code if it were ever called with GET_MODE(src_reg) ==
> > DImode.
> Please do explain.

Of course. The instructions involving src_reg in make_not_reg_insn dealing with
src_reg are completely quoted here:

+  // On SH we can do only SImode and DImode comparisons.
+  if (! (GET_MODE (src_reg) == SImode || GET_MODE (src_reg) == DImode))
+    return NULL;

In this fragment, you accept DImode source operands. So that code may be used
to replace a DImode compare.

+  emit_insn (gen_rtx_SET (VOIDmode, m_ccreg,
+              gen_rtx_fmt_ee (EQ, SImode, src_reg, const0_rtx)));

In this fragment, you are generating the replacement instruction, which is
always an SImode compare. Maybe I miss the point, but I fail to undestand how
an SImode compare might be acceptable on an DImode operand. Possibly, this even
ICEs, I don't know enough about gcc internals to know what happens if src_reg
is DImode which is passed to EQ in SImode.

Reply via email to