<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Expose option for maximum vector width"
   href="https://bugs.llvm.org/show_bug.cgi?id=40518">40518</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Expose option for maximum vector width
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ckennelly@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>atdt@google.com, echristo@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With the addition of the -mprefer-vector-width option, there may be hot
functions where we want to use as wide of vector instructions as are available
from the target ISA.

While it is possible to solve this problem using intrinsics or a chain of
macros (#ifdef __SOME_INSTRUCTION_SET__ ... #elif __OTHER_SET__ ...), this
requires modifying the code to as targets change.  We would like to be able to
apply a function attribute requesting "max" width vectors to avoid these
workarounds.

Consider:

__attribute__((__min_vector_width__(256))) void DoStuff(int* buf, int n) {
  // ...
}

When rebuilding this code for a platform with 512-bit vectors available, we
might prefer narrower vectors (for the reasons originally mentioned on
<a href="http://lists.llvm.org/pipermail/llvm-dev/2017-November/119078.html">http://lists.llvm.org/pipermail/llvm-dev/2017-November/119078.html</a>) in general,
but want to leverage our ISA for this particular function (based on profiling)
to request:

__attribute__((__min_vector_width__(max))) void DoStuff(int* buf, int n) {
  // ...
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>