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]

deleted insns ???


Fellows,
for shift operations I define the pattern as follows:
----------------------------------------------------------------------
(define_expand "ashlhi3"
  [(set (match_operand:HI 0 "nonimmediate_operand"       "")
        (ashift:HI (match_operand:HI 1 "nonimmediate_operand" "")
                   (match_operand:HI 2 "general_operand"  "")))]
""
"{
   if(!const_int_operand(operands[2],VOIDmode))
   {
     operands[0] = force_reg(HImode,operands[0]);
     operands[1] = force_reg(HImode,operands[1]);
     operands[2] = copy_to_mode_reg(HImode,operands[2]);
     emit_insn(gen_ashlhi3_cnt (operands[0], operands[1], operands[2]));
     DONE;
   }
}")
(define_expand "ashlhi3_cnt"
  [(parallel [(set (match_operand:HI 0 "register_operand"       "+r")
              (ashift:HI (match_operand:HI 1 "register_operand" "0")
                         (match_operand:HI 2 "register_operand" "=&r")))
              (clobber (match_dup 2))])]
  ""
  "")
(define_insn "*ashlhi3_cnt"
  [(parallel [(set (match_operand:HI 0 "register_operand"       "+r")
              (ashift:HI (match_operand:HI 1 "register_operand" "0")
                         (match_operand:HI 2 "register_operand" "=&r")))
              (clobber (match_dup 2))])]
  ""
  "* return msp430_emit_ashlhi3(insn, operands,NULL);"
  [(set_attr "length" "5")
   (set_attr "cc" "clobber")])
---------------------------------------------------------
Then for the code given:
extern int a,b;	// ints are 16bits
void foo()
{
	a <<= b;
}

And when optimization is turned off, gcc deletes the shift instruction.
Why? did I miss something?

cheers,
Dmitry



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