<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi, Pete:<br>
    <br>
      Do you mind to implement
    ScalarTargetTransformInfo::getPopcntHwSupport() for ARM? <br>
    This function will enable scalar opt to recognize popcount idioms.<br>
    <br>
    Thanks<br>
    Shuxin<br>
    <br>
    <div class="moz-cite-prefix">On 12/4/12 2:43 PM, Evan Cheng wrote:<br>
    </div>
    <blockquote
      cite="mid:B9AF0A4B-764F-4B0D-86DB-A893032BA405@apple.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <br>
      <div>
        <div>On Dec 4, 2012, at 6:44 AM, Pete Couperus <<a
            moz-do-not-send="true" href="mailto:pjcoup@gmail.com">pjcoup@gmail.com</a>>
          wrote:</div>
        <br class="Apple-interchange-newline">
        <blockquote type="cite">Hi Evan,<br>
          <br>
          Thanks for the review.  Currently, this only enables HW
          support for vector types, not scalars.  It would be easy
          enough to add scalar support in.<br>
          Should I roll that into this patch?  Or put it in a following
          patch?<br>
          If you'd like a following patch, would you mind committing
          this one for me?<br>
        </blockquote>
        <div><br>
        </div>
        I've committed it as r169325 after some minor changes (including
        naming the test case popcnt.ll). Please add the scalar support.
        Thanks!</div>
      <div><br>
      </div>
      <div>Evan</div>
      <div><br>
        <blockquote type="cite">Thanks!<br>
          <br>
          Pete<br>
          <br>
          <br>
          <div class="gmail_quote">On Mon, Dec 3, 2012 at 6:29 PM, Evan
            Cheng <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:evan.cheng@apple.com" target="_blank">evan.cheng@apple.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div style="word-wrap:break-word">I don't think use
                Pat<> buys anything here. The C++ lowering code is
                actually much more readable.
                <div>
                  <br>
                </div>
                <div>The patch looks fine to me. Please
                  add ScalarTargetTransformInfo::PopcntHwSupport() to
                  take advantage of the popcount loop idiom recognition
                  support (See r168931). ARM crafty score should
                  improve!</div>
                <div>
                  <br>
                </div>
                <div>Evan</div>
                <div><br>
                  <div>
                    <div>
                      <div>
                        <div class="h5">
                          <div>On Nov 30, 2012, at 11:37 PM, Pete
                            Couperus <<a moz-do-not-send="true"
                              href="mailto:pjcoup@gmail.com"
                              target="_blank">pjcoup@gmail.com</a>>
                            wrote:</div>
                          <br>
                        </div>
                      </div>
                      <blockquote type="cite">
                        <div>
                          <div class="h5">Hi Anton,<br>
                            <br>
                            I don't think this will work cleanly using
                            Pat<>.  The custom lowering uses a
                            bitcast, which gives me an unrecoverable
                            error for using bitconvert in an output
                            pattern, or a non-fatal (?) Type inference
                            contradiction error.<br>
                            <br>
                            Assuming there was some way around this, the
                            unoptimized pattern for the v4i16 case looks
                            something like:<br>
                            def : Pat<(v4i16 (ctpop DPR:$Dm)),<br>
                                      (v4i16 (EXTRACT_SUBREG<br>
                                        (v8i16 (VMOVLuv8i16<br>
                                          (v8i8  (VUZPd8<br>
                                            (v8i8 (IMPLICIT_DEF)),<br>
                                            (v8i8  (VADDv8i8<br>
                                              (v8i8  (VREV16d8<br>
                                                (v8i8 (VCNTd (v8i8
                            DPR:$Dm)))<br>
                                              )),<br>
                                              (v8i8 (VCNTd (v8i8
                            DPR:$Dm)))<br>
                                            )),<br>
                                            (v8i8  (VADDv8i8<br>
                                              (v8i8  (VREV16d8<br>
                                                (v8i8 (VCNTd (v8i8
                            DPR:$Dm)))<br>
                                              )),<br>
                                              (v8i8 (VCNTd (v8i8
                            DPR:$Dm)))<br>
                                            ))<br>
                                          ))<br>
                                        )), dsub_0<br>
                                      ))>;<br>
                            <br>
                            This actually builds with the Type inference
                            errors, and gives the right assembly.<br>
                            As is, I think this is more clearly
                            expressed in the code.<br>
                            So, unless there are ways to deal with these
                            issues in tablegen that I haven't thought
                            of, it needs to be lowered in the code.<br>
                            Was fun to try though :).  Any other
                            comments?<br>
                            <br>
                            Pete<br>
                            <br>
                            <br>
                            <div class="gmail_quote">On Fri, Nov 30,
                              2012 at 6:05 AM, Pete Couperus <span
                                dir="ltr"><<a moz-do-not-send="true"
                                  href="mailto:pjcoup@gmail.com"
                                  target="_blank">pjcoup@gmail.com</a>></span>
                              wrote:<br>
                              <blockquote class="gmail_quote"
                                style="margin:0 0 0 .8ex;border-left:1px
                                #ccc solid;padding-left:1ex">
                                Hi Anton,<br>
                                <br>
                                Thanks for taking a look.  I had trouble
                                with complex patterns for other similar
                                items, but I'll take another look at
                                this case if that actually sounds
                                feasible.<br>
                                Looking at LowerCTTZ, using Pat<>
                                would be the same for cttz, although its
                                lowering is much simpler, correct?  Is
                                there guidelines for when to use
                                Pat<> and when to lay it out in
                                the code?<br>
                                Thanks again for taking a look!<span><font
                                    color="#888888"><br>
                                    <br>
                                    Pete</font></span>
                                <div><br>
                                  <br>
                                  <br>
                                  <br>
                                  <div class="gmail_quote">On Thu, Nov
                                    29, 2012 at 9:53 PM, Anton
                                    Korobeynikov <span dir="ltr"><<a
                                        moz-do-not-send="true"
                                        href="mailto:anton@korobeynikov.info"
                                        target="_blank">anton@korobeynikov.info</a>></span>
                                    wrote:<br>
                                    <blockquote class="gmail_quote"
                                      style="margin:0 0 0
                                      .8ex;border-left:1px #ccc
                                      solid;padding-left:1ex">Pete,<br>
                                      <div><br>
                                        > The population count
                                        intrinsic (ctpop) is supported
                                        on ARM/NEON for v8i8 and<br>
                                        > v16i8 types via NEON's vcnt
                                        instruction.<br>
                                        > This patch leverages vcnt
                                        and other NEON instructions to
                                        custom lower ctpop<br>
                                        > for v2i32/v4i32 and
                                        v4i16/v8i16 types.<br>
                                        > As you'll see, a fair chunk
                                        of this patch is comments
                                        describing the<br>
                                        > lowering, which I am happy
                                        to adjust to people's liking.<br>
                                        > Please review!<br>
                                        > Thanks!<br>
                                      </div>
                                      Can't you use Pat<> magic in
                                      .td file to expand ctpop into
                                      series of<br>
                                      nodes? It seems exactly what's
                                      your lowering does...<br>
                                      <br>
                                      --<br>
                                      With best regards, Anton
                                      Korobeynikov<br>
                                      Faculty of Mathematics and
                                      Mechanics, Saint Petersburg State
                                      University<br>
                                    </blockquote>
                                  </div>
                                  <br>
                                </div>
                              </blockquote>
                            </div>
                            <br>
                          </div>
                        </div>
                        _______________________________________________<br>
                        llvm-commits mailing list<br>
                        <a moz-do-not-send="true"
                          href="mailto:llvm-commits@cs.uiuc.edu"
                          target="_blank">llvm-commits@cs.uiuc.edu</a><br>
                        <a moz-do-not-send="true"
                          href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits"
                          target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
llvm-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>