Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 19815
Product:  
Component:  
Status: UNCONFIRMED
Resolution:
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: andy hutchinson <andrewhutchinson@cox.net>
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 19815 depends on: Show dependency tree
Show dependency graph
Bug 19815 blocks:

Additional Comments:






Mark bug as waiting for feedback



    

    

View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2005-02-08 03:37
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 From abni 2009-08-19 11:57 -------
"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 ]

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug