This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: divmodsi4


Omar Torres wrote on 13 October 2008 19:46:

> On Fri, Oct 10, 2008 at 10:40 AM, Dave Korn <dave.korn@artimi.com> wrote:
>> Ian Lance Taylor wrote on 10 October 2008 15:53:
>> 
>>> "Omar Torres" <gcc.omar@gmail.com> writes:
>>> 
>>>>  The problem is that both, the quotient and reminder, registers are
>>>> getting marked with a REG_UNUSED note:

>>> This makes it sounds like the whole insn is useless.  I wonder why it
>>> hasn't simply been deleted?
>> 
>>  Is it not unusual that the insn sets r1 in SImode, but the note says it
>> is unused in QImode?  Does that mean only the lowest byte is unused?

>  A closer look revealed that this insn is not deleted because it is
> needed to (partially) set (reg:SI 33).
>  But, as Dave suggested, only the lower part of the quotient is used
> afterwards. Below is the src code and the corresponding basic block.
> 
>  I suspect that a workaround will be to look not only for the presence
> of the REG_UNUSED note, but check check the reg's mode as well, to
> successfully determine whether the quotient or remainder  is needed in
> divmodsi4.
> 
>  Do you agree this will be a practical approach, or is it fundamentally
> flawed? 

  Hi Omar, sorry I couldn't get back to you sooner.

  As far as looking at the mode of the REG_UNUSED and noticing that it is
smaller than the mode of the reg in the (set) rtx, I'm sure that will work
fine for selecting which insn to emit.

  The one thing I can't comment on is whether it's valid to have a REG_UNUSED
for a part of a register like this; it could be that the note is generated
incorrectly in the first place, and maybe this could lead to other problems.
In any other context, the (reg:QI) would need to be a (subreq:QI (reg:SI)),
but I don't know if that applies to these notes, and besides we're after
regalloc and now in strict rtl mode, so the natural mode of the original
pseudo might not be relevant any more now that it's been allocated to a real
hard reg.

  Maybe Ian or someone else can comment; is it normal to have these partial
REG_UNUSED notes?


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]