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: rtl indexed addressing mode question


>>ps:My new macro loks like this.
>>  else if (LEGITIMATE_INDEXED_ADDRESS_P (X))           \
>>    {                                                  \
>>      rtx reg = gen_reg_rtx (Pmode);                   \
>>      emit_insn (gen_addsi3 (reg, force_operand(XEXP (X,0), 0), \
>>                 force_operand(XEXP (X,1),0)));        \
>>      (X) = gen_rtx_PLUS (Pmode, reg, GEN_INT (0));    \
>>      goto WIN;                                        \
>>    }                                                  \
>
>This doesn't look quite right.
>
>If given:
>
>   (mem:QI (plus:SI (reg:SI 50) (reg:SI 51)) 0)
>
>Youd clause will convert it into:
>
>   (set (reg:SI 52) (plus:SI (reg:SI 50) (reg:SI 51)))
>   (mem:QI (plus:SI (reg:SI 50) (const_int 0)) 0)
>
>where the addition of zero will get optimized away by the optimizer.
>Rather than go through all the extra work, Try the suggested version
>above and see what happens...

That should be:

   (set (reg:SI 52) (plus:SI (reg:SI 50) (reg:SI 51)))
   (mem:QI (plus:SI (reg:SI 52) (const_int 0)) 0)

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)


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