<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 6/20/14, 9:19 AM, David Blaikie
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAENS6EvEHr4yzfXybGha2VwAcawTUeNb3=Us94j14Dan_VKcEw@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <p dir="ltr">That's probably not the right approach (best to keep
        this conversation on list because this is certainly not my area
        of expertise and other people might have better opinions).</p>
      <p dir="ltr">If your new instruction is just a better way of
        describing adds on your chip then it should just be a custom
        target or sub target or CPU feature in the backend (llvms lib
        target, specifically the x86 target), I'd guess.</p>
    </blockquote>
    <br>
    I think Pratik is doing this for a research project, in which case
    doing it quickly is probably better than doing it properly.  As long
    as the code generator and/or assembler understands the new
    instruction, I think using inline assembly is the quicker way to
    implement it.  For a real product, creating a real target/subtarget
    feature would be the right way to go.<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
    <blockquote
cite="mid:CAENS6EvEHr4yzfXybGha2VwAcawTUeNb3=Us94j14Dan_VKcEw@mail.gmail.com"
      type="cite">
      <div class="gmail_quote">On Jun 19, 2014 11:19 PM, "pratik dand"
        <<a moz-do-not-send="true"
          href="mailto:pratikdand143@gmail.com">pratikdand143@gmail.com</a>>
        wrote:<br type="attribution">
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">
            <div>
              <div>Dear David,<br>
                <br>
              </div>
              It's done at the IR level by <br>
              call void asm sideeffect "addl .. .. ..",
              "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0.<br>
              <br>
            </div>
            <div>
              But I am looking for something more.<br>
            </div>
            <div>I am planning to replace addl of X86 by my new
              instruction addencl. Hence, on seeing an "add nsw" in the
              LLVM IR I want to replace it with an assembly
              corresponding to my new instruction. The problem being, at
              the IR level I wouldn't know the registers allocated to
              the tmp variables of IR.<br>
              <br>
            </div>
            <div>I am looking to support a new custom add instruction
              without adding it to the backend.<br>
              <br>
            </div>
            <div>Regards,<br>
            </div>
            <div>Pratik  <br>
            </div>
            <div>
              <div class="gmail_extra"><br>
                <br>
                <div class="gmail_quote">
                  On Fri, Jun 20, 2014 at 1:20 PM, David Blaikie <span
                    dir="ltr"><<a moz-do-not-send="true"
                      href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>
                  wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    Oh, wait - which way. Writing inline assembly
                    /using/ llvm IR (eg:<br>
                    LLVM IR embedded as inline assembly in C) or writing
                    inline assembly<br>
                    (for actual assembly) in LLVM IR?<br>
                    <br>
                    For the former, see my first response. For the
                    latter - I'd just look<br>
                    at what IR clang produces for inline assembly given
                    in a c file, etc.<br>
                    <div>
                      <div><br>
                        On Thu, Jun 19, 2014 at 10:18 PM, David Blaikie
                        <<a moz-do-not-send="true"
                          href="mailto:dblaikie@gmail.com"
                          target="_blank">dblaikie@gmail.com</a>>
                        wrote:<br>
                        > Hasn't been implemented. Could be, if
                        someone really wanted to.<br>
                        ><br>
                        > On Thu, Jun 19, 2014 at 8:37 PM, pratik
                        dand <<a moz-do-not-send="true"
                          href="mailto:pratikdand143@gmail.com"
                          target="_blank">pratikdand143@gmail.com</a>>
                        wrote:<br>
                        >> Dear,<br>
                        >><br>
                        >> Can anybody comment on inserting inline
                        assembly in LLVM IR?<br>
                        >><br>
                        >> --<br>
                        >> Pratik<br>
                        >><br>
                        >><br>
                        >>
                        _______________________________________________<br>
                        >> LLVM Developers mailing list<br>
                        >> <a moz-do-not-send="true"
                          href="mailto:LLVMdev@cs.uiuc.edu"
                          target="_blank">LLVMdev@cs.uiuc.edu</a>      
                          <a moz-do-not-send="true"
                          href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
                        >> <a moz-do-not-send="true"
                          href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
                          target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
                        >><br>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <br>
                <br clear="all">
                <br>
                -- <br>
                Pratik
                <div><br>
                </div>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>