Hi All, Below is the patterns defined for the mov and add instruction . [(set (match_operand:HI 0 "general_mov_operand" "=r,rRA") (match_operand:HI 1 "general_mov_operand" "rRAi,ri"))] "" {
} ) (define_insn "addhi3" [(set (match_operand:HI 0 "register_operand" "=Ar") (plus:HI (match_operand:HI 1 "register_operand" "%0") (match_operand:HI 2 "general_mov_operand" "Ar")))] "" "add\t%0, (%2)" ) The problem we stuck with is that the compiler emit unoptimal code for the below testcase with -O0 option int a,b; int func() { return a=b; } .s file ld BC, (a) ld WA, (b) add WA, BC ld (a), WA ret the compiler try to load a and b to the register BC and WA respectively in the expand_assignment and add them , then store back the result to a. But if you see the addhi3 definition ,it states that i'm allowed to emit instruction like add WA,(a) where second operand can be register indirect addressing . I can write peephole pattern to optimize the emitted code like .s file ld WA, (b) add WA, (a) ld (a), WA ret the reason for the unoptimal code is that the code is expanded to load the memory contents to the registers and then update the add operands accordingly. I don't want this to happen . I will be glad ,if somebody from the group share their experience or through some insights how i can achieve this . Thanks ~Umesh