title: GCC compiler porting to new architecture : Call external library function
body: <p>I'm porting GCC compiler to a new processor architecture. It is similer to v850 architecture ("/gcc/config/v850") and almost done. But I have a problem in multiplication arithmetic operation. Architecture supports only unsigned multiplication. In signed case, I have to use "__mulsi3" library function from lib1funcs.asm. So I need to call library function when it is signed. Implemented "mulsi3" instruction as follows. Does anybody know how can call any library functions from {target}.md file or {target}.c file? help me...</p>
  
  <p>I followed "sh" architecture ("/gcc/config/sh") and implemented like sh architecture. GCC build ok.  but when I compile test code on target, there is a bug message. (file => emit-rtl.c:862)</p>
  
  <hr>
  
  <h2>mulsi3 instruction</h2>
  
  <pre><code>    (define_insn "mulsi3"
          [(set (match_operand:SI 0 "register_operand" "=r,r")
              (mult:SI (match_operand:SI 1 "nonmemory_operand" "r,r")
                  (match_operand:SI 2 "nonmemory_operand" "r,i")))]
          ""
          "*
          {
          /* REG */
          if(GET_CODE (operands[2]) == REG)
          {
              return \"mul %0,%1,%2\";
          }
          /* IMMEDIATE */
          else
          {
              /* unsigned case */
              if(CONST_OK_FOR_M(INTVAL(operands[2])))
              {
                  return \"muli %0,%1,%2\";
              }
              /* signed case */
              else
              {
                  /******************************************/
                  /* need to call __mulsi3 library function */
                  /******************************************/
              }
          }
      }
      "
      [(set_attr "length" "6,6")
      (set_attr "cc" "none_0hit,none_0hit")
      (set_attr "type" "mult")])
  </code></pre>
  
  <hr>