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]

copy to mode reg help needed


Fellows,

I got a problem:
I define shift operations like:
------------------------------------------------------------
(define_expand "ashlqi3"
  [(set (match_operand:QI 0 "nonimmediate_operand"       "=rm")
        (ashift:QI (match_operand:QI 1 "nonimmediate_operand" "%0")
                   (match_operand:QI 2 "general_operand"  "rmi")))]
  ""
  "{
        if(!register_operand(operand0, QImode) && is_shift_better_in_reg(operands))
        {
                operands[0] = copy_to_mode_reg(QImode,operand0);
                operands[1] = copy_to_mode_reg(QImode,operand1);
                emit_insn (gen_ashlqi3fnl(operands[0], operands[1], operands[2]));
                DONE;
        }
}")
  
  
(define_insn "ashlqi3fnl"
  [(set (match_operand:QI 0 "register_operand"       "=r")
        (ashift:QI (match_operand:QI 1 "register_operand" "%0")
                   (match_operand:QI 2 "general_operand"  "rmi")))]
  ""
  "* return msp430_emit_ashlqi3(insn, operands,NULL);"
  [(set_attr "length" "8")
   (set_attr "cc" "clobber")])
  
  
(define_insn "*ashlqi3"
  [(set (match_operand:QI 0 "memory_operand"       "=m")
        (ashift:QI (match_operand:QI 1 "memory_operand" "%0")
                   (match_operand:QI 2 "general_operand"  "rmi")))]
  ""
  "* return msp430_emit_ashlqi3(insn, operands,NULL);"
  [(set_attr "length" "8")
   (set_attr "cc" "clobber")])
-----------------------------------------------------
so, If source code is like:
extern char d;
void setd()
{
	d <<= 5;
}

the compiler still uses d as a memory reference:
RTL dump is the following:
/****************
(insn 12 23 14 (set (mem/f:QI (symbol_ref:HI ("d")) 1)
        (ashift:QI (mem/f:QI (symbol_ref:HI ("d")) 1)
            (const_int 5 [0x5]))) 154 {*ashlqi3} (nil)
    (nil))
*****************/
        rla.b   &d       ;  12  *ashlqi3        [length = 15]
        rla.b   &d
        rla.b   &d
        rla.b   &d
        rla.b   &d

Can anybody tell me why it uses *ashlqi3 pattern, when I force ashlqi3fnl one?

Thanks in advance,
Dmitry.

*********************************************************************
   ("`-''-/").___..--''"`-._     (\       Dimmy the Wild      UA1ACZ
    `6_ 6  )   `-.  (     ).`-.__.`)      Enterprise Information Sys 
    (_Y_.)'  ._   )  `._ `. ``-..-'       Nevsky prospekt,   20 / 44
  _..`--'_..-_/  /--'_.' ,'               Saint Petersburg,   Russia
 (il),-''  (li),'  ((!.-'                 +7 (812) 314-8860, 5585314
*********************************************************************


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