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

--- Comment #9 from mpf at gcc dot gnu.org ---
Created attachment 42075
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42075&action=edit
Proposed fix

Off-thread James pointed out that one of my patches I did last year appeared to
fix this issue but it was one I reverted owing to breaking ARM (and probably
others). The thread was:

https://gcc.gnu.org/ml/gcc-patches/2017-02/msg00518.html

At the time I thought I had fixed the same problem twice and that the changes
to simplify_operand_subreg were sufficient. It occurs to me however that
simplify_operand_subreg only has the opportunity to fix
WORD_REGISTER_OPERATIONS issues affecting subreg(mem) patterns not subreg(reg)
patterns where reg is a pseudo that may yet be spilled.

I can't say that I am 100% convinced yet with my thinking here but I've
attached an updated version of the original patch with some changes:

* Incorporated Eric's feedback on the original patch to check
GET_MODE_PRECISION instead of GET_MODE_SIZE for comparing whether a mode is
strictly narrower
* Limited the test to word sized inner modes or smaller
* Limited the test to OP_OUT or OP_INOUT as I can't see any reason why it would
matter if we do a narrower input reload

This is barely tested but does fix testcase-c which is the only one I can get
to trigger.

Reply via email to