Hi All,
 I am having trouble distinguishing div vs mod while implementing the
divmodsi4 instruction. The gccint documentation states:
"If an instruction that just produces a quotient or just a remainder
exists and is more efficient than the instruction that produces both,
write the output routine of 'divmodm4' to call find_reg_note and look
for a REG_UNUSED note on the quotient or remainder and generate the
appropriate instruction."

 The problem is that both, the quotient and reminder, registers are
getting marked with a REG_UNUSED note:

 (insn 12 11 17 (parallel [
            (set (reg:SI 1 %r3 [33])
                (div:SI (reg:SI 1 %r3 [30])
                    (reg:SI 5 %iph [orig:31 current ] [31])))
            (set (reg:SI 5 %iph [34])
                (mod:SI (reg:SI 1 %r3 [30])
                    (reg:SI 5 %iph [orig:31 current ] [31])))
        ]) 56 {*divmodsi4} (insn_list:REG_DEP_TRUE 10
(insn_list:REG_DEP_TRUE 11 (nil)))
    (expr_list:REG_UNUSED (reg:SI 5 %iph [34])
        (expr_list:REG_UNUSED (reg:QI 2 %r2)
            (expr_list:REG_UNUSED (reg:QI 1 %r3)
                (nil)))))

Any suggestions on how I might be able to work around this?
Thanks!
-Omar


Here is my expander and  matching patter:
(define_expand "divmodsi4"
  [(parallel [(set (match_operand:SI 0 "register_operand" "")
                   (div:SI (match_operand:SI 1 "general_operand" "")
                           (match_operand:SI 2 "general_operand" "")))
              (set (match_operand:SI 3 "nonimmediate_operand" "")
                   (mod:SI (match_dup 1) (match_dup 2)))])]
  ""
  "")

(define_insn "*divmodsi4"
  [(set (match_operand:SI 0 "register_operand" "=f")
        (div:SI (match_operand:SI 1 "general_operand" "g")
                (match_operand:SI 2 "general_operand" "g")))
   (set (match_operand:SI 3 "nonimmediate_operand" "=g")
        (mod:SI (match_dup 1) (match_dup 2)))]
  "!TARGET_SOFTLIB"
  "*
    return output_divmod (insn, operands, 1);
  ")

Reply via email to