[Bug target/63783] [4.9/5 Regression] [SH] Miscompilation of boolean negation on SH4 using -O2

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Nov 22 10:39:00 GMT 2014


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

--- Comment #19 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Michael Karcher from comment #18)
> As I said, I did not try your patch, but just read the source. The assembly
> you quoted convinces me that there is no problem in the code actually
> produced by your patch, which is great. This is caused by the pattern
> or-then-SImode-compare, as you explained.
> 
> 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.

> 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.

> So I would strongly suggest to narrow it to only accept SImode input
> operands, so it fails to apply instead of generate bad code if something
> manages to call it with DImode input.

If that should ever happen, we already have a test case that will pop up in the
test results.



More information about the Gcc-bugs mailing list