|Summary:||Documentation change - GCC Internals MODES_TIEABLE_P|
|Product:||gcc||Reporter:||andy hutchinson <andrewhutchinson>|
|Component:||other||Assignee:||Not yet assigned to anyone <unassigned>|
|Severity:||minor||CC:||abnikant.singh, eric.weddington, gcc-bugs|
|Build:||Known to work:|
|Known to fail:||Last reconfirmed:||2012-01-11 00:00:00|
Description andy hutchinson 2005-02-08 03:37:27 UTC
Documentation change - GCC Internals The definition of MODES_TIEABLE_P is incorrect and has resulted in reduced optimisation for the avr target (and perhaps others) The definition is currently: "A C expression that is nonzero if a value of mode mode1 is accessible in mode mode2 without copying." This part would be ok but is then detailed as : "If HARD_REGNO_MODE_OK (r, mode1) and HARD_REGNO_MODE_OK (r, mode2) are always the same for any r, then MODES_TIEABLE_P (mode1, mode2) should be nonzero. If they differ for any r, you should define this macro to return zero unless some other mechanism ensures the accessibility of the value in a narrower mode." This second paragraph is too restrictive. MODES_TIEABLE_p may also be nonzero if r is accessible in any SMALLER mode. In the particular example of the avr target, word or larger registers are assigned even numbered registers ONLY. Byte registers have no such restriction. Because this does indeed fail the second paragraph criteria, MODE_TIEABLE_P has been set 0=FALSE preventing byte operations on the word register and uneeded register moves. It should have been set TRUE. I was tempted to report this as AVR target bug - but the code is not really the problem. Note that the definition is often included in target header files as well as gcc internal manual.
Comment 1 abnikant 2009-08-19 11:57:02 UTC
"If HARD_REGNO_MODE_OK (r, mode1) and HARD_REGNO_MODE_OK (r, mode2) are always the same for any r, then MODES_TIEABLE_P (mode1, mode2) should be nonzero. If they differ for any r, you should define this macro to return zero unless some other mechanism ensures the accessibility of the value in a narrower mode." In case of avr: if (mode1 != mode2) then HARD_REGNO_MODE_OK (r, mode1) != HARD_REGNO_MODE_OK (r, mode2) and hence MODES_TIEABLE_P (mode1, mode2) should be 0. [ But this is true only if we do not have other mechanism to access the value in narrower mode ]
Comment 2 Richard Biener 2012-01-11 12:46:52 UTC
Is this still an issue?