Hello, Our unsigned multiplication uses 2 words, while our signed multiplication uses 1. So, we are trying to use smult for an unsigned multiplication whenever the following multiplication disregard the MSW of the result.
The rules currently take the shape: ,---- | (define_expand "umulqihi3" | [ | (use (match_operand:HI 0 "register_operand" "")) | (use (match_operand:QI 1 "register_operand" "")) | (use (match_operand:QI 2 "general_operand" "")) | ] | "" | { | if(GET_CODE(operands[2])==CONST_INT) | emit_insn(gen_umulqihi3_const(operands[0],operands[1],operands[2])); | else | emit_insn(gen_umulqihi3_general(operands[0],operands[1],operands[2])); | DONE; | }) | | (define_insn "umulqihi3_const" | [ | (set (match_operand:HI 0 "register_operand" "=d") | (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" | "%d")) | (match_operand:HI 2 "immediate_operand" "i"))) | ] | "" | { | if(find_regno_note(insn, REG_UNUSED, RAH)) | /* If the MSW is never used we can use smult */ | return make_mulqihi3(operands, 1); | else | return make_mulqihi3(operands, 0); | } | [(set_attr "cc" "none")] | ) | | (define_insn "umulqihi3_general" | [ | (set (match_operand:HI 0 "register_operand" "=d") | (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" | "%d")) | (zero_extend:HI (match_operand:QI 2 "general_operand" | "xwmi")))) | ] | "" | { | if(find_regno_note(insn, REG_UNUSED, RAH)) | /* If the MSW is never used we can use smult */ | return make_mulqihi3(operands, 1); | else | return make_mulqihi3(operands, 0); | } | [(set_attr "cc" "none")] | ) `---- These rules were created in gcc42 and the idea was that we can use smult instead of umult whenever RAH (MSW of the result) is not used afterwards. The 2nd argument of make_mulqihi3 determines if we emit an smult instead of an umult. The way found to do this was to try to look for a REG_UNUSED. This worked in gcc42 but we just noticed that it doesn't for gcc43. So we are looking for an alternative way to tell GCC that if the instructions following a multiplication don't use the MSW part of the multiplication (in RAH), then an smult should be emitted instead of an umult. Any advice on how best to code this restriction? Cheers, -- PMatos