<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    I think its mostly just for ease of implementation. Looks like LLVM
    already optimizes __bulitin_memcpy -> bitcast, and piggybacking
    on the existing builtin saves us from from having to write custom
    Parse/Sema/IRGen for a new construct. Also, I think we'd
    (hypothetically) have to fallback to IRGenning __builtin_memcpy in
    general since IR bitcast doesn't support IR aggregates, but C++
    bit_cast does.<br>
    <br>
    <div class="moz-cite-prefix">On 10/31/18 4:05 PM, JF Bastien wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:AE33E7B3-BCCE-47D3-BDC8-E3D488EF9FBE@apple.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">It seems simpler to map it directly to the existing
        IR construct (bitcast) instead of the odd IR memcpy. But đź¤·â€Ťâ™‚️ </div>
      <div dir="ltr"><br>
        On Oct 31, 2018, at 3:40 PM, Erik Pilkington <<a
          href="mailto:erik.pilkington@gmail.com" moz-do-not-send="true">erik.pilkington@gmail.com</a>>
        wrote:<br>
        <br>
      </div>
      <blockquote type="cite">
        <div dir="ltr">
          <meta http-equiv="Content-Type" content="text/html;
            charset=utf-8">
          <p><br>
          </p>
          <br>
          <div class="moz-cite-prefix">On 10/31/18 3:23 PM, Richard
            Smith via cfe-dev wrote:<br>
          </div>
          <blockquote type="cite"
cite="mid:CAOfiQqnAT=TkPJMhK6433dH6sgxknkP62-0NijT3-NNsEvAqMw@mail.gmail.com">
            <meta http-equiv="content-type" content="text/html;
              charset=utf-8">
            <div dir="ltr">
              <div class="gmail_quote">
                <div dir="ltr">On Mon, 29 Oct 2018 at 13:09, JF Bastien
                  via cfe-dev <<a
                    href="mailto:cfe-dev@lists.llvm.org"
                    moz-do-not-send="true">cfe-dev@lists.llvm.org</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div
                    style="word-wrap:break-word;line-break:after-white-space">Richard
                    recently made __builtin_memcpy constexpr in some
                    cases: <a href="https://reviews.llvm.org/rL338941"
                      target="_blank" moz-do-not-send="true">https://reviews.llvm.org/rL338941</a><br>
                    His patch currently disallows all type-puns.
                    <div><br>
                    </div>
                    <div>Erik is looking at implementing a bit_cast
                      intrinsic for clang,</div>
                  </div>
                </blockquote>
                <div><br>
                </div>
                <div>Is there a reason to make it a new builtin (which I
                  think is what you're suggesting) rather than extending
                  the existing __builtin_memcpy support to cover all the
                  bit_cast cases? (Eg, is the idea to make it exactly
                  cover the cases that std::bit_cast supports?) If we
                  want both, it'd be good to at least make the two share
                  code.</div>
              </div>
            </div>
          </blockquote>
          <br>
          No real reason I guess, I suppose that approach would lead to
          a lot less boilerplate, so it probably makes more sense. I'll
          have a chance to really dig into this in a week or two, so
          hopefully I'll can put a patch up soon.<br>
          <br>
          <blockquote type="cite"
cite="mid:CAOfiQqnAT=TkPJMhK6433dH6sgxknkP62-0NijT3-NNsEvAqMw@mail.gmail.com">
            <div dir="ltr">
              <div class="gmail_quote">
                <div> </div>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div
                    style="word-wrap:break-word;line-break:after-white-space">
                    <div>at which point libc++ can use it. ADT won’t be
                      able to do so until we migrate to C++20 (and
                      toolchains support it).</div>
                    <div><br>
                    </div>
                    <div>We also want to reach out to the RedHat
                      maintainers of libstdc++ to make sure we don’t
                      adopt a weirdly different builtin.</div>
                    <div><br>
                      <br>
                      <div><br>
                        <blockquote type="cite">
                          <div>On Oct 29, 2018, at 12:56 PM, will wray
                            via cfe-dev <<a
                              href="mailto:cfe-dev@lists.llvm.org"
                              target="_blank" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>>
                            wrote:</div>
                          <br
                            class="m_2445159788289606080Apple-interchange-newline">
                          <div>
                            <div dir="ltr">
                              <div>std::bit_cast was added to the C++ 20
                                draft this summer:</div>
                              <div><a
                                  href="http://eel.is/c++draft/bit.cast"
                                  target="_blank" moz-do-not-send="true">http://eel.is/c++draft/bit.cast</a></div>
                              <br
                                class="m_2445159788289606080gmail-Apple-interchange-newline">
                              In September JFB added a header with
                              implementation (in llvm namespace):<br>
                              llvm/include/llvm/ADT/bit.h<br>
                              <br>
                              Â  // This file implements the C++20
                              <bit> header.<br>
                              Â  ...<br>
                              Â  // - It isn't constexpr because that
                              requires compiler support.<br>
                              <div><br>
                              </div>
                              <div>What compiler support is it waiting
                                on? What's the status?</div>
                              <div><br>
                              </div>
                            </div>
_______________________________________________<br>
                            cfe-dev mailing list<br>
                            <a href="mailto:cfe-dev@lists.llvm.org"
                              target="_blank" moz-do-not-send="true">cfe-dev@lists.llvm.org</a><br>
                            <a
                              href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
                              target="_blank" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </div>
                  _______________________________________________<br>
                  cfe-dev mailing list<br>
                  <a href="mailto:cfe-dev@lists.llvm.org"
                    target="_blank" moz-do-not-send="true">cfe-dev@lists.llvm.org</a><br>
                  <a
                    href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
                </blockquote>
              </div>
            </div>
            <br>
            <fieldset class="mimeAttachmentHeader"></fieldset>
            <br>
            <pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org" moz-do-not-send="true">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
          </blockquote>
          <br>
        </div>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>